Skip to content

Commit

Permalink
Merge pull request #69 from NHSDigital/develop
Browse files Browse the repository at this point in the history
dms-2024-i1-r4
  • Loading branch information
kenny-lee-1 authored Mar 4, 2024
2 parents ef03b0e + 9bbf9ba commit c9955d9
Show file tree
Hide file tree
Showing 280 changed files with 27,025 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ gem 'nokogiri', '~> 1.11'
gem 'regexp-examples'

gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery-ui-rails', github: 'jquery-ui-rails/jquery-ui-rails', tag: 'v7.0.0'

group :test do
gem 'simplecov'
Expand Down
138 changes: 73 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,67 +1,75 @@
GIT
remote: https://github.com/jquery-ui-rails/jquery-ui-rails.git
revision: 413265e81f790f795239e07e7e25e01429b2f18d
tag: v7.0.0
specs:
jquery-ui-rails (7.0.0)
railties (>= 3.2.16)

GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
actioncable (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
actioncable (6.1.7.7)
actionpack (= 6.1.7.7)
activesupport (= 6.1.7.7)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actionmailbox (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
mail (>= 2.7.1)
actionmailer (6.1.7.6)
actionpack (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activesupport (= 6.1.7.6)
actionmailer (6.1.7.7)
actionpack (= 6.1.7.7)
actionview (= 6.1.7.7)
activejob (= 6.1.7.7)
activesupport (= 6.1.7.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.7.6)
actionview (= 6.1.7.6)
activesupport (= 6.1.7.6)
actionpack (6.1.7.7)
actionview (= 6.1.7.7)
activesupport (= 6.1.7.7)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.6)
actionpack (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actiontext (6.1.7.7)
actionpack (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
nokogiri (>= 1.8.5)
actionview (6.1.7.6)
activesupport (= 6.1.7.6)
actionview (6.1.7.7)
activesupport (= 6.1.7.7)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.6)
activesupport (= 6.1.7.6)
activejob (6.1.7.7)
activesupport (= 6.1.7.7)
globalid (>= 0.3.6)
activemodel (6.1.7.6)
activesupport (= 6.1.7.6)
activemodel (6.1.7.7)
activesupport (= 6.1.7.7)
activemodel-caution (6.1.7.6)
actionpack (~> 6.1.7.0)
activemodel (~> 6.1.7.0)
activerecord (~> 6.1.7.0)
activesupport (~> 6.1.7.0)
railties (~> 6.1.7.0)
activerecord (6.1.7.6)
activemodel (= 6.1.7.6)
activesupport (= 6.1.7.6)
activestorage (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activesupport (= 6.1.7.6)
activerecord (6.1.7.7)
activemodel (= 6.1.7.7)
activesupport (= 6.1.7.7)
activestorage (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
activerecord (= 6.1.7.7)
activesupport (= 6.1.7.7)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.6)
activesupport (6.1.7.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -81,6 +89,7 @@ GEM
rubyzip (>= 0.9.5)
bcrypt (3.1.19)
bindex (0.8.1)
bio-vcf (0.9.5)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
Expand Down Expand Up @@ -195,8 +204,6 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.6.3)
launchy (2.5.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -266,10 +273,11 @@ GEM
net-smtp
rails (>= 6.0, < 7.1)
will_paginate
ndr_import (10.2.0)
ndr_import (11.0.2)
activemodel
activesupport (>= 6.0, < 7.1)
activesupport (>= 6.1, < 7.1)
avro (~> 1.11.0)
bio-vcf (~> 0.9.5)
docx (~> 0.3)
msworddoc-extractor (= 0.2.0)
ndr_support (>= 5.3.2, < 6)
Expand All @@ -279,7 +287,7 @@ GEM
roo (~> 2.0)
roo-xls
rubyzip (~> 2.0)
seven_zip_ruby (~> 1.3)
seven-zip (~> 1.4)
spreadsheet (= 1.2.6)
ndr_pseudonymise (0.4.2)
activesupport
Expand Down Expand Up @@ -317,14 +325,14 @@ GEM
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
nio4r (2.5.9)
nokogiri (1.15.4)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.15.4-arm64-darwin)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-darwin)
nokogiri (1.16.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -364,28 +372,28 @@ GEM
puma (>= 5.0)
rack
racc (1.7.1)
rack (2.2.8)
rack (2.2.8.1)
rack-mini-profiler (3.1.1)
rack (>= 1.2.0)
rack-proxy (0.7.7)
rack
rack-test (2.1.0)
rack (>= 1.3)
railroady (1.6.0)
rails (6.1.7.6)
actioncable (= 6.1.7.6)
actionmailbox (= 6.1.7.6)
actionmailer (= 6.1.7.6)
actionpack (= 6.1.7.6)
actiontext (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activemodel (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
rails (6.1.7.7)
actioncable (= 6.1.7.7)
actionmailbox (= 6.1.7.7)
actionmailer (= 6.1.7.7)
actionpack (= 6.1.7.7)
actiontext (= 6.1.7.7)
actionview (= 6.1.7.7)
activejob (= 6.1.7.7)
activemodel (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
bundler (>= 1.15.0)
railties (= 6.1.7.6)
railties (= 6.1.7.7)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
Expand All @@ -394,9 +402,9 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
railties (6.1.7.7)
actionpack (= 6.1.7.7)
activesupport (= 6.1.7.7)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -462,7 +470,7 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
seven_zip_ruby (1.3.0)
seven-zip (1.4.2)
shellany (0.0.1)
show_me_the_cookies (6.0.0)
capybara (>= 2, < 4)
Expand Down Expand Up @@ -550,7 +558,7 @@ DEPENDENCIES
guard-test
highline
jquery-rails
jquery-ui-rails
jquery-ui-rails!
libv8-node (~> 16.10)
loofah (>= 2.3.1)
mail (>= 2.1.1, < 2.8.0)
Expand Down
46 changes: 35 additions & 11 deletions lib/import/brca/providers/royal_marsden/royal_marsden_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ class RoyalMarsdenHandler < Import::Germline::ProviderHandler
'2b' => 2,
'2c' => 3,
'variant' => 2 }.freeze
NON_PATH_VARIANT_CLASS = { '2a' => 1,
'2b' => 2,
'variant' => 2 }.freeze

TEST_TYPE_MAP = { 'affected' => :diagnostic,
'unaffected' => :predictive }.freeze
# rubocop:disable Lint/MixedRegexpCaptureTypes
CDNA_REGEX_PROT = /c\.(?<cdna>.+)(?=(?<separtors>_|;.)p\.(?<impact>.+))/i.freeze
CDNA_REGEX_NOPROT = /c\.(?<cdna>.+)/i.freeze
CDNA_REGEX_PROT = /c\.(?<cdna>.+)(?=(?<separators>_|;.)p\.(?<impact>.+))/i
CDNA_REGEX_NOPROT = /c\.(?<cdna>.+)/i
DEL_DUP_REGEX = /(?<deldup>Deletion|Duplication)\s(ex|exon)s?\s?
(?<exon>\d+([a-z -]+\d+)?)|
(exon|ex)s?\s?(?<exon>\d+([a-z -]+\d+)?)\s?
Expand All @@ -50,8 +53,8 @@ def process_fields(record)
record.raw_fields,
PASS_THROUGH_FIELDS)
process_varpathclass(genotype, record)
process_teststatus(genotype, record)
process_variant(genotype, record)
process_teststatus(genotype, record)
process_large_deldup(genotype, record)
process_test_scope(genotype, record)
process_test_type(genotype, record)
Expand Down Expand Up @@ -85,6 +88,7 @@ def process_varpathclass(genotype, record)
@logger.debug 'NO VARIANT PATHCLASS DETECTED'
return
end

varpathclass = record.raw_fields['variantpathclass'].downcase.strip
# unless record.raw_fields['variantpathclass'].nil?
# if varpathclass.present? && VARIANT_PATH_CLASS[varpathclass]
Expand All @@ -98,15 +102,24 @@ def process_teststatus(genotype, record)
@logger.debug 'UNABLE TO DETERMINE TESTSTATUS'
return
end

teststatus = record.raw_fields['teststatus']
nonpathvarclass = record.raw_fields['variantpathclass']&.downcase&.strip
# unless record.raw_fields['teststatus'].nil?
if normal_test?(teststatus)
genotype.add_status(1)
elsif failed_test?(teststatus)
process_assign_teststatus(genotype, teststatus, nonpathvarclass)
end

def process_assign_teststatus(genotype, teststatus, nonpathvarclass)
if failed_test?(teststatus)
genotype.add_status(9)
genotype.add_variant_class(nil)
elsif non_pathogenic_variant_test?(teststatus, nonpathvarclass)
genotype.add_status(10)
elsif positive_test?(teststatus)
genotype.add_status(2)
elsif normal_test?(teststatus)
genotype.add_status(1)
elsif borderline_test?(teststatus)
genotype.add_status(7)
end
end

Expand Down Expand Up @@ -154,7 +167,6 @@ def process_large_deldup(genotype, record)

def normal_test?(teststatus)
%r{NO PATHOGENIC (VARIANT|DEL/DUP) IDENTIFIED}.match(teststatus) ||
/non-pathogenic variant detected/.match(teststatus) ||
/No mutation detected/.match(teststatus)
end

Expand All @@ -164,9 +176,21 @@ def failed_test?(teststatus)

def positive_test?(teststatus)
/c\..+/.match(teststatus) ||
/Deletion*/.match(teststatus) ||
/Duplication*/.match(teststatus) ||
/Exon*/i.match(teststatus)
/Deletion.*/.match(teststatus) ||
/Duplication.*/.match(teststatus) ||
/Exon.*/i.match(teststatus) ||
/Del.*ex\s?1*/i.match(teststatus) ||
/Ex.*del/i.match(teststatus) ||
/BRCA.*exon.*Deletion/i.match(teststatus)
end

def borderline_test?(teststatus)
/borderline/.match(teststatus)
end

def non_pathogenic_variant_test?(teststatus, nonpathvarclass)
/non-pathogenic\svariant\sdetected/i.match(teststatus) ||
NON_PATH_VARIANT_CLASS[nonpathvarclass]
end
end
end
Expand Down
Loading

0 comments on commit c9955d9

Please sign in to comment.