Skip to content

Commit 4467ff3

Browse files
Feature/ndrs2 2040/sheffield crc missing sris (#151)
* update sheffield colorectal importer rules * updated panels * added new panels, expanded variant regexes * correcte typo * corrected variant regexes * pulled in Laura's original changes' @ * small corrections * removed no gene teststatud addition - causes problems elsewhere * added facility to add test status where no genes are present for other_genes * code updated - counts look better * removed duplicate code * removed comments * removed comments * fixing issue with no gene and not creating a duplicate object * removed commented out line * few code review changes, added tests --------- Co-authored-by: lauramccluskey <laura.mccluskey3@nhs.net>
1 parent 37b60d5 commit 4467ff3

File tree

3 files changed

+129
-14
lines changed

3 files changed

+129
-14
lines changed

lib/import/colorectal/providers/sheffield/sheffield_handler_colorectal.rb

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SheffieldHandlerColorectal < Import::Germline::ProviderHandler
1111

1212
def process_fields(record)
1313
genotype_str = record.raw_fields['genetictestscope'].strip
14-
return if NON_CRC_GENTICTESCOPE.include? genotype_str.downcase
14+
return if NON_CRC_GENETICTESTSCOPE.include? genotype_str.downcase
1515

1616
genocolorectal = Import::Colorectal::Core::Genocolorectal.new(record)
1717
genocolorectal.add_passthrough_fields(record.mapped_fields,
@@ -32,6 +32,9 @@ def add_test_scope_from_geno_karyo(genocolorectal, record)
3232
genotype_str = record.raw_fields['genetictestscope'].strip
3333
karyo = record.raw_fields['karyotypingmethod'].strip
3434
moleculartestingtype = record.raw_fields['moleculartestingtype'].strip
35+
if genotype_str.downcase.match(/r211\s::\sinherited\spolyposis\sand\searly\sonset\scolorectal\scancer/)
36+
genotype_str="r211 :: inherited polyposis and early onset colorectal cancer, germline testing"
37+
end
3538
process_method = GENETICTESTSCOPE_METHOD_MAPPING[genotype_str.downcase]
3639
if process_method
3740
public_send(process_method, karyo, genocolorectal, moleculartestingtype)
@@ -90,6 +93,9 @@ def process_scope_r210(karyo, genocolorectal, moleculartestingtype)
9093
end
9194

9295
def process_scope_r211(karyo, genocolorectal, moleculartestingtype)
96+
if karyo.downcase.match(/r211.1\s::\ssmall\spanel\sin\sleeds.*send\sdna\ssample/)
97+
karyo='R211.1 :: Small panel in Leeds - send DNA sample'
98+
end
9399
if R211_PANEL_GENE_MAPPING_FS.keys.include? karyo
94100
@logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}"
95101
genocolorectal.add_test_scope(:full_screen)
@@ -106,6 +112,17 @@ def process_scope_r211(karyo, genocolorectal, moleculartestingtype)
106112
end
107113
end
108114

115+
116+
def process_scope_r414(karyo, genocolorectal, moleculartestingtype)
117+
if R414_PANEL_GENE_MAPPING_FS.keys.include? karyo
118+
@logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}"
119+
genocolorectal.add_test_scope(:full_screen)
120+
@genes_set = R414_PANEL_GENE_MAPPING_FS[karyo]
121+
else
122+
genocolorectal.add_test_scope(:no_genetictestscope)
123+
end
124+
end
125+
109126
def process_scope_fap_familial(karyo, genocolorectal, _moleculartestingtype)
110127
if FAP_FAM_PANEL_GENE_MAPPING_TAR.keys.include? karyo
111128
@logger.debug "ADDED TARGETED TEST for: #{karyo}"
@@ -149,7 +166,7 @@ def process_scope_myh(karyo, genocolorectal, moleculartestingtype)
149166
scope = MOLECULAR_SCOPE_MAPPING[moleculartestingtype.downcase]
150167
@logger.debug "ADDED #{scope} TEST for: #{moleculartestingtype}"
151168
genocolorectal.add_test_scope(scope)
152-
@genes_set = %w[APC MUTYH]
169+
@genes_set = %w[MUTYH]
153170
else
154171
genocolorectal.add_test_scope(:no_genetictestscope)
155172
end
@@ -218,12 +235,25 @@ def process_fullscreen_records(genocolorectal, record, genocolorectals)
218235

219236
def process_targeted_no_scope_records(genocolorectal, record, genocolorectals)
220237
genotype_str = record.raw_fields['genotype']
221-
if normal?(genotype_str)
238+
if genotype_str.scan(/fail/i).size.positive?
239+
gene=get_gene(record)
240+
genocolorectal.add_status(9)
241+
genocolorectals.append(genocolorectal)
242+
elsif normal?(genotype_str)
222243
process_normal_targeted(genocolorectal, record, genocolorectals)
223244
elsif positive_cdna?(genotype_str) || positive_exonvariant?(genotype_str)
224245
process_variant_targeted(genocolorectal, record, genocolorectals)
225246
elsif only_protein_impact?(genotype_str)
226247
process_only_protein_rec(genocolorectal, record, genocolorectals)
248+
elsif genotype_str.scan(/^pathogenic\smutation\sdetected/).size.positive?
249+
gene = get_gene(record)
250+
genocolorectal.add_status(2)
251+
genocolorectals.append(genocolorectal)
252+
else
253+
gene=get_gene(record)
254+
genocolorectal.add_status(4)
255+
genocolorectals.append(genocolorectal)
256+
227257
end
228258
end
229259

@@ -242,7 +272,13 @@ def process_normal_targeted(genocolorectal, record, genocolorectals)
242272

243273
def process_normal_full_screen(genocolorectal, genocolorectals)
244274
negative_genes = @genes_set
245-
add_other_genes_with_status(negative_genes, genocolorectal, genocolorectals, 1)
275+
if !negative_genes.empty?
276+
add_other_genes_with_status(negative_genes, genocolorectal, genocolorectals, 1)
277+
else
278+
genocolorectals.append(genocolorectal)
279+
end
280+
281+
246282
genocolorectals
247283
end
248284

@@ -256,8 +292,7 @@ def add_other_genes_with_status(other_genes, genocolorectal, genocolorectals, st
256292
genotype_othr.add_gene_location(nil)
257293
genocolorectals.append(genotype_othr)
258294
end
259-
genocolorectals
260-
end
295+
end
261296

262297
def positive_cdna?(genotype_string)
263298
genotype_string.scan(CDNA_REGEX).size.positive?

lib/import/helpers/colorectal/providers/rcu/constants.rb

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Constants
2222
genotype
2323
age].freeze
2424

25-
NON_CRC_GENTICTESCOPE = [
25+
NON_CRC_GENETICTESTSCOPE = [
2626
'r208 :: inherited breast cancer and ovarian cancer',
2727
'r208 :: brca1 and brca2 testing at high familial risk',
2828
'r205 :: inherited breast cancer (without ovarian cancer) at very high familial risk',
@@ -62,7 +62,9 @@ module Constants
6262
'fap familial mutation' => :process_scope_fap_familial,
6363
'hnpcc' => :process_scope_hnpcc,
6464
'myh' => :process_scope_myh,
65-
'breast ovarian & colorectal cancer panel' => :process_scope_colo_ovarian_panel
65+
'breast ovarian & colorectal cancer panel' => :process_scope_colo_ovarian_panel,
66+
'r211 :: inherited polyposis and early onset colorectal cancer, germline testing'=> :process_scope_r211,
67+
'r414 :: apc associated polyposis'=> :process_scope_r414
6668
}.freeze
6769

6870
COLO_PANEL_GENE_MAPPING_FS = {
@@ -74,8 +76,7 @@ module Constants
7476
'Extended CRC panel - analysis only' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM
7577
APC MUTYH BMPR1A PTEN POLD1
7678
POLE SMAD4 STK11],
77-
'Full panel' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM APC MUTYH BMPR1A PTEN POLD1 POLE SMAD4
78-
STK11],
79+
'Full panel' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM APC MUTYH BMPR1A PTEN POLD1 POLE SMAD4 STK11],
7980
'MLH1 MSH2 MSH6 PMS1 & PMS2' => %w[MLH1 MSH2 MSH6 PMS1 PMS2],
8081
'MLH1 MSH2 MSH6 and PMS2' => %w[MLH1 MSH2 MSH6 PMS2],
8182
'MLH1 MSH2 and MSH6' => %w[MLH1 MSH2 MSH6],
@@ -90,6 +91,11 @@ module Constants
9091
'STK11 familial mutation' => %w[STK11]
9192
}.freeze
9293

94+
95+
R414_PANEL_GENE_MAPPING_FS = {
96+
'R414.1 :: APC sequencing in Leeds' => %w[APC]
97+
}.freeze
98+
9399
R209_PANEL_GENE_MAPPING_FS = {
94100
'R209.1 :: NGS - APC and MUTYH only' => %w[APC MUTYH],
95101
'R209.1 :: Small panel in Leeds' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM APC MUTYH BMPR1A
@@ -110,13 +116,19 @@ module Constants
110116
R210_PANEL_GENE_MAPPING_FS = {
111117
'R210.2 :: Small panel in Leeds' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
112118
'R210.2 :: Unknown mutation(s) by Small panel' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
113-
'R210.5 :: Unknown mutation(s) by MLPA or equivalent' => %w[MLH1 MSH2 EPCAM]
119+
'R210.5 :: Unknown mutation(s) by MLPA or equivalent' => %w[MLH1 MSH2 EPCAM],
120+
'R210.1 :: Unknown mutation(s) by Microsatellite instability'=> %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
121+
'R210.2 :: Small panel in Leeds - Send DNA'=> %w[MLH1 MSH2 MSH6 PMS2 EPCAM]
114122
}.freeze
115123

116124
R210_PANEL_GENE_MAPPING_TAR = {
117125
'R240.1 :: Diagnostic familial' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
118126
'R242.1 :: Predictive MLPA' => %w[MLH1 MSH2 EPCAM],
119-
'R242.1 :: Predictive testing' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM]
127+
'R242.1 :: Predictive testing' => %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
128+
'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood'=> %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
129+
'R242.1 :: Predictive testing - MLPA in Leeds - Send DNA'=> %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
130+
'R242.1 :: Predictive testing - Seq in Leeds - Send Blood'=> %w[MLH1 MSH2 MSH6 PMS2 EPCAM],
131+
'R242.1 :: Predictive testing - Seq in Leeds - Send DNA'=> %w[MLH1 MSH2 MSH6 PMS2 EPCAM]
120132
}.freeze
121133

122134
R210_PANEL_GENE_MAPPING_MOL = {
@@ -125,13 +137,19 @@ module Constants
125137
}.freeze
126138

127139
R211_PANEL_GENE_MAPPING_FS = {
140+
'R211.1 :: Small Panel in Leeds' => %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11],
141+
'R211.1 :: Small panel in Leeds - send DNA sample'=> %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11],
128142
'R211.1 :: APC and MUTYH genes in Leeds' => %w[APC MUTYH],
129143
'R211.2 :: Unknown mutation(s) by MLPA or equivalent' => %w[APC MUTYH]
130144
}.freeze
131145

132146
R211_PANEL_GENE_MAPPING_TAR = {
133147
'R240.1 :: Diagnostic familial' => %w[APC MUTYH],
134-
'R242.1 :: Predictive testing' => %w[APC MUTYH]
148+
'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood'=> %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11],
149+
'R242.1 :: Predictive testing' => %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11],
150+
'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11],
151+
'R242.1 :: Predictive testing - Seq in Leeds - Analysis only'=> %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11],
152+
'R242.1 :: Predictive testing - Seq in Leeds - Send DNA'=> %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN RNF43 SMAD4 STK11]
135153
}.freeze
136154

137155
R211_PANEL_GENE_MAPPING_MOL = {
@@ -185,7 +203,7 @@ module Constants
185203

186204
# rubocop:disable Lint/MixedRegexpCaptureTypes
187205
NORMAL_VAR_REGEX = %r{(?<not>no|not)[a-z /]+
188-
(?<det>detected|reported|deteected|deteceted)+}ix.freeze
206+
(?<det>detected|reported|deteected|deteceted|present)+}ix.freeze
189207

190208
CDNA_REGEX = /c\.\[?(?<cdna>
191209
([0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+)|

test/lib/import/colorectal/providers/sheffield/sheffield_handler_colorectal_test.rb

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,52 @@ def setup
163163
assert_nil genocolorectals[0].attribute_map['gene']
164164
end
165165

166+
test 'process_targeted_no_scope_failure' do
167+
exon_record = build_raw_record('pseudo_id1' => 'bob')
168+
exon_record.raw_fields['genetictestscope'] = 'efgh'
169+
exon_record.raw_fields['karyotypingmethod'] = 'abcd'
170+
exon_record.raw_fields['genotype'] = 'Fail'
171+
exon_record.raw_fields['moleculartestingtype'] = 'Diagnostic testing'
172+
@handler.add_test_scope_from_geno_karyo(@genotype, exon_record)
173+
genocolorectals = @handler.process_variants_from_record(@genotype, exon_record)
174+
assert_equal 1, genocolorectals.size
175+
assert_equal 'Unable to assign Colorectal Lynch or MMR genetictestscope', @genotype.attribute_map['genetictestscope']
176+
assert_nil genocolorectals[0].attribute_map['proteinimpact']
177+
assert_equal 9, genocolorectals[0].attribute_map['teststatus']
178+
end
179+
180+
test 'process_targeted_no_scope_normal' do
181+
exon_record = build_raw_record('pseudo_id1' => 'bob')
182+
exon_record.raw_fields['genetictestscope'] = 'efgh'
183+
exon_record.raw_fields['karyotypingmethod'] = 'abcd'
184+
exon_record.raw_fields['genotype'] = 'no pathogenic variant detected'
185+
exon_record.raw_fields['moleculartestingtype'] = 'Diagnostic testing'
186+
@handler.add_test_scope_from_geno_karyo(@genotype, exon_record)
187+
genocolorectals = @handler.process_variants_from_record(@genotype, exon_record)
188+
assert_equal 1, genocolorectals.size
189+
assert_equal 'Unable to assign Colorectal Lynch or MMR genetictestscope', @genotype.attribute_map['genetictestscope']
190+
assert_nil genocolorectals[0].attribute_map['proteinimpact']
191+
assert_nil genocolorectals[0].attribute_map['codingdnasequencechange']
192+
assert_equal 1, genocolorectals[0].attribute_map['teststatus']
193+
assert_nil genocolorectals[0].attribute_map['gene']
194+
end
195+
196+
test 'process_targeted_no_scope_abnormal' do
197+
exon_record = build_raw_record('pseudo_id1' => 'bob')
198+
exon_record.raw_fields['genetictestscope'] = 'efgh'
199+
exon_record.raw_fields['karyotypingmethod'] = 'abcd'
200+
exon_record.raw_fields['genotype'] = 'MSH2-c.1234_1345del-p.(Gln123fs)-Heterozygous-UV4'
201+
exon_record.raw_fields['moleculartestingtype'] = 'Diagnostic testing'
202+
@handler.add_test_scope_from_geno_karyo(@genotype, exon_record)
203+
genocolorectals = @handler.process_variants_from_record(@genotype, exon_record)
204+
assert_equal 1, genocolorectals.size
205+
assert_equal 'Unable to assign Colorectal Lynch or MMR genetictestscope', @genotype.attribute_map['genetictestscope']
206+
assert_equal 2, genocolorectals[0].attribute_map['teststatus']
207+
assert_equal 'p.Gln123fs', genocolorectals[0].attribute_map['proteinimpact']
208+
assert_equal 'c.1234_1345del', genocolorectals[0].attribute_map['codingdnasequencechange']
209+
assert_equal 2804, genocolorectals[0].attribute_map['gene']
210+
end
211+
166212
test 'process_cdna_change' do
167213
@logger.expects(:debug).with('SUCCESSFUL cdna change parse for: 1653dup')
168214
@handler.process_cdna_change(@genotype, @record.raw_fields['genotype'])
@@ -202,6 +248,22 @@ def setup
202248
assert_equal 1, genocolorectals[0].attribute_map['variantgenotype']
203249
end
204250

251+
test 'unusual characters in panel name' do
252+
exon_record = build_raw_record('pseudo_id1' => 'bob')
253+
exon_record.raw_fields['genetictestscope'] = 'R211 :: Inherited polyposis and early onset colorectal cancer – germline testing'
254+
exon_record.raw_fields['karyotypingmethod'] = 'R211.1 :: Small panel in Leeds – send DNA sample'
255+
exon_record.raw_fields['genotype'] = 'PMS2-c.[1234A>G]-Heterozygous-UV5'
256+
exon_record.raw_fields['moleculartestingtype'] = 'Diagnostic testing'
257+
@handler.add_test_scope_from_geno_karyo(@genotype, exon_record)
258+
genocolorectals = @handler.process_variants_from_record(@genotype, exon_record)
259+
assert_equal 15, genocolorectals.size
260+
assert_equal 'Full screen Colorectal Lynch or MMR', genocolorectals[0].attribute_map['genetictestscope']
261+
assert_nil genocolorectals[0].attribute_map['proteinimpact']
262+
assert_equal 'c.1234A>G', genocolorectals[0].attribute_map['codingdnasequencechange']
263+
assert_equal 1, genocolorectals[0].attribute_map['sequencevarianttype']
264+
assert_equal 3394, genocolorectals[0].attribute_map['gene']
265+
end
266+
205267
private
206268

207269
def clinical_json

0 commit comments

Comments
 (0)