From 1bdb6efd0b4c64d44a8643e8343f7cecf2d3e99e Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Wed, 15 Jan 2025 11:23:49 +0000 Subject: [PATCH 01/11] updates to sheffield regex --- .../providers/sheffield/sheffield_handler.rb | 129 +++++++++++++----- .../brca/providers/rcu/rcu_constants.rb | 48 +++++-- 2 files changed, 136 insertions(+), 41 deletions(-) diff --git a/lib/import/brca/providers/sheffield/sheffield_handler.rb b/lib/import/brca/providers/sheffield/sheffield_handler.rb index efd47c33..a7523647 100644 --- a/lib/import/brca/providers/sheffield/sheffield_handler.rb +++ b/lib/import/brca/providers/sheffield/sheffield_handler.rb @@ -10,17 +10,17 @@ class SheffieldHandler < Import::Germline::ProviderHandler include Import::Helpers::Brca::Providers::Rcu::RcuConstants def process_fields(record) - geno = record.raw_fields['genetictestscope'] + geno = record.raw_fields['genetictestscope'] return if NON_BRCA_SCOPE.include?(geno) - + @genes_set=[] genotype = Import::Brca::Core::GenotypeBrca.new(record) genotype.add_passthrough_fields(record.mapped_fields, record.raw_fields, PASS_THROUGH_FIELDS) + add_test_type(genotype, record) add_organisationcode_testresult(genotype) add_test_scope_from_geno_karyo(genotype, record) - res = process_variants_from_record(genotype, record) res.map { |cur_genotype| @persister.integrate_and_store(cur_genotype) } end @@ -34,13 +34,13 @@ def add_test_scope_from_geno_karyo(genotype, record) karyo = record.raw_fields['karyotypingmethod'].strip process_method = GENETICTESTSCOPE_METHOD_MAPPING[genotype_str] if process_method - send(process_method, karyo, genotype) + send(process_method, karyo, genotype, record) else genotype.add_test_scope(:no_genetictestscope) end end - def process_scope_familial_mutation(karyo, genotype) + def process_scope_familial_mutation(karyo, genotype, record) if BRCA_FAMILIAL_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) @@ -50,7 +50,7 @@ def process_scope_familial_mutation(karyo, genotype) end end - def process_scope_gene_analysis(karyo, genotype) + def process_scope_gene_analysis(karyo, genotype, record) if BRCA_ANALYSIS_GENE_MAPPING_FS.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -64,7 +64,7 @@ def process_scope_gene_analysis(karyo, genotype) end end - def process_scope_ovarian_panel(karyo, genotype) + def process_scope_ovarian_panel(karyo, genotype, record) if OVRN_CNCR_PNL_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED FULL_SCREEN for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -74,7 +74,7 @@ def process_scope_ovarian_panel(karyo, genotype) end end - def process_scope_colo_ovarian_panel(karyo, genotype) + def process_scope_colo_ovarian_panel(karyo, genotype, record) if OVRN_COLO_PNL_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED FULL_SCREEN for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -84,7 +84,7 @@ def process_scope_colo_ovarian_panel(karyo, genotype) end end - def process_scope_r205(karyo, genotype) + def process_scope_r205(karyo, genotype, record) if R205_GENE_MAPPING_FS.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -98,7 +98,7 @@ def process_scope_r205(karyo, genotype) end end - def process_scope_r206(karyo, genotype) + def process_scope_r206(karyo, genotype, record) if R206_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -113,7 +113,7 @@ def process_scope_r206(karyo, genotype) end end - def process_scope_r207(karyo, genotype) + def process_scope_r207(karyo, genotype,record) if R207_GENE_MAPPING_FS.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -127,7 +127,7 @@ def process_scope_r207(karyo, genotype) end end - def process_scope_r208(karyo, genotype) + def process_scope_r208(karyo, genotype, record) if R208_GENE_MAPPING_FS.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -141,7 +141,60 @@ def process_scope_r208(karyo, genotype) end end - def process_scope_r240(karyo, genotype) + def process_scope_r208_new(karyo, genotype, record) + genotype_genes=[] + genotype_str = record.raw_fields['genotype'].to_s + genotype_genes = genotype_str.scan(BRCA_REGEX).flatten.uniq + if R208_GENE_MAPPING_FS_NEW.keys.include? karyo + @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" + genotype.add_test_scope(:full_screen) + @genes_set = R208_GENE_MAPPING_FS_NEW[karyo].dup + #add genes from genotype column + @genes_set=@genes_set.concat(genotype_genes) + if karyo.match(/R208\.1\s::\sNGS\sin\sLeeds/) + date = DateTime.parse(record.raw_fields['authoriseddate']) + if date >= DateTime.parse('01/02/2023') + @genes_set=@genes_set.concat(['RAD51C', 'RAD51D']) + end + end + elsif R208_GENE_MAPPING_TAR_NEW.keys.include? karyo + @logger.debug "ADDED TARGETED TEST for: #{karyo}" + genotype.add_test_scope(:targeted_mutation) + @genes_set = R208_GENE_MAPPING_TAR_NEW[karyo].dup + #add genes from genotype column + @genes_set=@genes_set.concat(genotype_genes) + else + genotype.add_test_scope(:no_genetictestscope) + end + @genes_set=@genes_set.uniq + end + + def process_scope_r430(karyo, genotype, record) + #TODO update this mapping to FS + if R430_GENE_MAPPING.keys.include? karyo + genotype.add_test_scope(:full_screen) + @genes_set = R430_GENE_MAPPING[karyo] + else + genotype.add_test_scope(:no_genetictestscope) + end + end + + def process_scope_r444(karyo, genotype, record) + if karyo.match(/R444\.1\s::\sPARPi\sfor\sBreast\scancer.*NGS\sin\sLeeds/) + karyo="R444.1 :: PARPi for Breast cancer - NGS in Leeds" + end + if karyo.match(/R444\.2\s::\sPARPi\sfor\sProstate\sCancer.*NGS\sin\sLeeds\ssend\sDNA\sto\sLeeds/) + karyo="R444.2 :: PARPi for Prostate Cancer - NGS in Leeds send DNA to Leeds" + end + if R444_GENE_MAPPING.keys.include? karyo + @genes_set = R444_GENE_MAPPING[karyo] + genotype.add_test_scope(:full_screen) + else + genotype.add_test_scope(:no_genetictestscope) + end + end + + def process_scope_r240(karyo, genotype, record) if R240_GENE_MAPPING_TAR.keys.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) @@ -151,7 +204,7 @@ def process_scope_r240(karyo, genotype) end end - def process_scope_r242(karyo, genotype) + def process_scope_r242(karyo, genotype, record) if R242_GENE_MAPPING_TAR.keys.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) @@ -170,7 +223,7 @@ def add_test_type(genotype, record) def process_variants_from_record(genotype, record) genotypes = [] if full_screen?(genotype) - process_fullscreen_records(genotype, record, genotypes) + genotypes=process_fullscreen_records(genotype, record, genotypes) elsif targeted?(genotype) || no_scope?(genotype) process_targeted_no_scope_records(genotype, record, genotypes) end @@ -283,7 +336,7 @@ def process_single_gene(genotype, record) def add_other_genes_with_status(other_genes, genotype, genotypes, status) other_genes.each do |gene| genotype_other = genotype.dup - @logger.debug "SUCCESSFUL gene parse for #{status} status for: #{gene}" + @logger.debug "SUCxCESSFUL gene parse for #{status} status for: #{gene}" genotype_other.add_status(status) genotype_other.add_gene(gene) genotype_other.add_protein_impact(nil) @@ -294,26 +347,32 @@ def add_other_genes_with_status(other_genes, genotype, genotypes, status) end def process_multi_genes(genotype, record, genotypes) - positive_genes = record.raw_fields['genotype'].scan(BRCA_REGEX).flatten.uniq - raw_genotypes = record.raw_fields['genotype'].split(positive_genes[-1]) - raw_genotypes[1].prepend(positive_genes[-1]) - process_raw_genotypes(raw_genotypes, genotype, genotypes) + positive_genes = record.raw_fields['genotype'].scan(BRCA_REGEX).flatten + positive_genes_length= positive_genes.length() + + positive_genes=positive_genes.join('|') + raw_genotypes = record.raw_fields['genotype'].split(/(?=#{positive_genes})/) + + genotypes=process_raw_genotypes(raw_genotypes, genotype, genotypes) + genotypes end def process_raw_genotypes(raw_genotypes, genotype, genotypes) raw_genotypes.each do |raw_genotype| raw_genotype.scan(BRCA_REGEX) - genotype_dup = genotype.dup - genotype_dup.add_gene($LAST_MATCH_INFO[:brca]&.upcase) - if positive_cdna?(raw_genotype) || positive_exonvariant?(raw_genotype) - process_exons(genotype_dup, raw_genotype) - process_cdna_change(genotype_dup, raw_genotype) - process_protein_impact(genotype_dup, raw_genotype) - genotype_dup.add_status(2) - else - genotype_dup.add_status(1) + if !raw_genotype.scan(BRCA_REGEX).empty? + genotype_dup = genotype.dup + genotype_dup.add_gene($LAST_MATCH_INFO[:brca]&.upcase) + if positive_cdna?(raw_genotype) || positive_exonvariant?(raw_genotype) + process_exons(genotype_dup, raw_genotype) + process_cdna_change(genotype_dup, raw_genotype) + process_protein_impact(genotype_dup, raw_genotype) + genotype_dup.add_status(2) + else + genotype_dup.add_status(1) + end + genotypes.append(genotype_dup) end - genotypes.append(genotype_dup) end genotypes end @@ -339,9 +398,12 @@ def process_fullscreen_records(genotype, record, genotypes) process_failed_full_screen(genotype, record, genotypes) elsif positive_cdna?(genotype_str) || positive_exonvariant?(genotype_str) process_variant_fs_records(genotype, record, genotypes) - elsif only_protein_impact?(record) || - genotype_str.scan(/see\sbelow|comments/ix).size.positive? + elsif only_protein_impact?(record) ||genotype_str.scan(/see\sbelow|comments/ix).size.positive? + ## TODO should this be process_protein_targeted_instead??? add_other_genes_with_status(@genes_set, genotype, genotypes, 4) + else + #TODO should those with unknown status be given a status of 4???? + add_other_genes_with_status(@genes_set,genotype, genotypes, 4) end genotypes end @@ -360,7 +422,7 @@ def process_multiple_variant_fs_record(genotype, record, genotypes) if positive_genes.blank? add_other_genes_with_status(@genes_set, genotype, genotypes, 4) elsif positive_genes.size > 1 - process_multi_genes(genotype, record, genotypes) + genotypes=process_multi_genes(genotype, record, genotypes) else process_positive_record(genotype, record, genotypes, positive_genes) end @@ -385,6 +447,7 @@ def process_single_variant_fs_record(genotype, record, genotypes) end def process_positive_record(genotype, record, genotypes, positive_gene) + genotype_str = record.raw_fields['genotype'].to_s mutation = get_cdna_mutation(genotype_str) protein = get_protein_impact(genotype_str) diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 1ff2b102..659d614d 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -24,9 +24,11 @@ module RcuConstants 'and ovarian cancer at high familial risk levels' => :process_scope_r206, 'R207 :: Inherited ovarian cancer (without breast cancer)' => :process_scope_r207, 'R208 :: BRCA1 and BRCA2 testing at high familial risk' => :process_scope_r208, - 'R208 :: Inherited breast cancer and ovarian cancer' => :process_scope_r208, + 'R208 :: Inherited breast cancer and ovarian cancer' => :process_scope_r208_new, 'R240 - Familial Diagnostic testing - Hered Cancers' => :process_scope_r240, - 'R242 - Predictive testing - Hered Cancers' => :process_scope_r242 + 'R242 - Predictive testing - Hered Cancers' => :process_scope_r242, + 'R430 :: Inherited Prostate Cancer'=> :process_scope_r430, + 'R444 :: NICE approved PARP inhibitor treatment'=> :process_scope_r444 }.freeze BRCA_FAMILIAL_GENE_MAPPING = { @@ -143,6 +145,24 @@ module RcuConstants 'R370.1 :: Confirmation of research result' => %w[BRCA1 BRCA2 PALB2] }.freeze + R208_GENE_MAPPING_FS_NEW = { + 'R208.1 :: NGS in Leeds' => %w[ATM, BRCA1, BRCA2, CHEK2, PALB2], + 'R208.1 :: NGS in Leeds - Send DNA to Leeds' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2], + 'R208.1 :: PALB2 - NGS in Leeds - Analysis only' => %w[PALB2], + 'R387.1 :: BRCA1 BRCA2 PALB2 analysis only' => %w[BRCA1 BRCA2 PALB2] + }.freeze + + R208_GENE_MAPPING_TAR_NEW = { + 'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing - Seq in Sheffield' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + 'R242.1 :: Predictive testing MLPA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6] + }.freeze + R240_GENE_MAPPING_TAR = { 'R242.1 :: Familial diagnostic testing - ATM gene' => %w[ATM] }.freeze @@ -151,6 +171,17 @@ module RcuConstants 'R242.1 :: Predictive testing - ATM gene' => %w[ATM] }.freeze + + R430_GENE_MAPPING = { + 'R420.1 :: NGS in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 MLH1 MSH2 MSH6 PALB2] + }.freeze + + R444_GENE_MAPPING = { + 'R444.1 :: PARPi for Breast cancer - NGS in Leeds' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D], + 'R444.2 :: PARPi for Prostate Cancer - NGS in Leeds send DNA to Leeds' => %w[BRCA1, BRCA2] + }.freeze + + PASS_THROUGH_FIELDS = %w[consultantcode providercode collecteddate @@ -177,20 +208,20 @@ module RcuConstants MSH2|MSH6|PMS2|STK11|PTEN|BRIP1|NBN|RAD51C|RAD51D)/ix # rubocop:disable Lint/MixedRegexpCaptureTypes - CDNA_REGEX = /c\.\[?(? + CDNA_REGEX = /c(\.|\[)-?\*?\[?(? ([0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+)| - ([0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| + ([0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| ([0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGTdelinsup])| ([0-9]+[ACGTdelinsup]+[+>_-][ACGTdelinsup])| ([0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| - ([0-9]+[+>_-][0-9]+[+>_-][0-9]+[0-9]+[ACGTdelinsup]+)| + ([0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| ([0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGTdelinsup]+)| ([0-9]+[ACGTdelinsup]+) )\]?/ix MLPA_FAIL_REGEX = /#{BRCA_REGEX}\s(?MLPA?\sfail)+/ix - PROTEIN_REGEX = /p\.(\[\()?(?.([a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?)| + PROTEIN_REGEX = /p(\.|\[)(\[\()?(?.([a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?)| ([a-z]+[0-9]+[^[:alnum:]]))(\)\])?/ix EXON_VARIANT_REGEX = /((?het|homo)[a-z ]+)? @@ -198,8 +229,8 @@ module RcuConstants ([a-z 0-9]+(?exon|exons)\s (?[0-9]+((to|and|-|\s)+[0-9]+)?))| ((?het|homo)[a-z ]+)? - (?exon|exons)\s(?[0-9]+((to|and|-|\s)+[0-9]+)?) - ([a-z ]+(?deletion|duplication|duplicated))?/ix + (?exon|exons|ex)\s?(?[0-9]+((to|and|-|\s)+[0-9]+)?) + ([a-z\s]+(?deletion|duplication|duplicated|del))?/ix NORMAL_VAR_REGEX = %r{(?no|not)[a-z /]+ (?detect|report|detet|mutation)+}ix @@ -210,3 +241,4 @@ module RcuConstants end end end + From fd38fc9ed747ea40b022f39dcfb8219bc8bd33b7 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Mon, 27 Jan 2025 14:47:47 +0000 Subject: [PATCH 02/11] update mistake in panel --- lib/import/helpers/brca/providers/rcu/rcu_constants.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 659d614d..f4a7ffb1 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -134,7 +134,7 @@ module RcuConstants 'R208.2 :: Unknown mutation(s) by MLPA or equivalent' => %w[BRCA1 BRCA2], 'R387.1 :: BRCA1 BRCA2 PALB2 analysis only' => %w[BRCA1 BRCA2 PALB2], 'R208.1 :: NGS in Leeds' => %w[BRCA1 BRCA2 PALB2], - 'R208.1 :: PALB2 - NGS in Leeds - Analysis only' => %w[BRCA1 BRCA2 PALB2] + 'R208.1 :: PALB2 - NGS in Leeds - Analysis only' => %w[PALB2] }.freeze R208_GENE_MAPPING_TAR = { From f6a51bcd09ca4dd5aa3d9c61488ea5e591e68430 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Wed, 12 Feb 2025 17:19:25 +0000 Subject: [PATCH 03/11] Update panels --- .../providers/sheffield/sheffield_handler.rb | 140 ++++++++-------- .../brca/providers/rcu/rcu_constants.rb | 154 ++++++++++++------ 2 files changed, 179 insertions(+), 115 deletions(-) diff --git a/lib/import/brca/providers/sheffield/sheffield_handler.rb b/lib/import/brca/providers/sheffield/sheffield_handler.rb index a7523647..92f6a4a4 100644 --- a/lib/import/brca/providers/sheffield/sheffield_handler.rb +++ b/lib/import/brca/providers/sheffield/sheffield_handler.rb @@ -10,14 +10,14 @@ class SheffieldHandler < Import::Germline::ProviderHandler include Import::Helpers::Brca::Providers::Rcu::RcuConstants def process_fields(record) - geno = record.raw_fields['genetictestscope'] + geno = record.raw_fields['genetictestscope'] return if NON_BRCA_SCOPE.include?(geno) - @genes_set=[] + + @genes_set = [] genotype = Import::Brca::Core::GenotypeBrca.new(record) genotype.add_passthrough_fields(record.mapped_fields, record.raw_fields, PASS_THROUGH_FIELDS) - add_test_type(genotype, record) add_organisationcode_testresult(genotype) add_test_scope_from_geno_karyo(genotype, record) @@ -41,10 +41,10 @@ def add_test_scope_from_geno_karyo(genotype, record) end def process_scope_familial_mutation(karyo, genotype, record) - if BRCA_FAMILIAL_GENE_MAPPING.keys.include? karyo + if BRCA_FAMILIAL_GENE_MAPPING.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = BRCA_FAMILIAL_GENE_MAPPING[karyo] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end @@ -55,15 +55,26 @@ def process_scope_gene_analysis(karyo, genotype, record) @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @genes_set = BRCA_ANALYSIS_GENE_MAPPING_FS[karyo] - elsif BRCA_ANALYSIS_GENE_MAPPING_TAR.keys.include? karyo + elsif BRCA_ANALYSIS_GENE_MAPPING_TAR.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = BRCA_ANALYSIS_GENE_MAPPING_TAR[karyo] + get_genes_set_targeted(record) + else genotype.add_test_scope(:no_genetictestscope) end end + def get_genes_set_targeted(record) + karyo_column = record.raw_fields['karyotypingmethod'].strip + geno_column = record.raw_fields['geno'].strip + @genes_set=[] + GENES_LIST.each do |gene| + @genes_set.append(karyo_column.scan(gene)) + end + + end + def process_scope_ovarian_panel(karyo, genotype, record) if OVRN_CNCR_PNL_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED FULL_SCREEN for: #{karyo}" @@ -89,10 +100,10 @@ def process_scope_r205(karyo, genotype, record) @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @genes_set = R205_GENE_MAPPING_FS[karyo] - elsif R205_GENE_MAPPING_TAR.keys.include? karyo + elsif R205_GENE_MAPPING_TAR.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = R205_GENE_MAPPING_TAR[karyo] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end @@ -106,22 +117,21 @@ def process_scope_r206(karyo, genotype, record) elsif ['R242.1 :: Predictive testing'].include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = %w[ATM BRCA1 BRCA2 BRIP1 CDH1 CHEK2 EPCAM MLH1 MSH2 MSH6 PALB2 PTEN - RAD51C RAD51D STK11 TP53 PMS2] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end end - def process_scope_r207(karyo, genotype,record) + def process_scope_r207(karyo, genotype, record) if R207_GENE_MAPPING_FS.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @genes_set = R207_GENE_MAPPING_FS[karyo] - elsif R207_GENE_MAPPING_TAR.keys.include? karyo + elsif R207_GENE_MAPPING_TAR.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = R207_GENE_MAPPING_TAR[karyo] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end @@ -132,48 +142,43 @@ def process_scope_r208(karyo, genotype, record) @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @genes_set = R208_GENE_MAPPING_FS[karyo] - elsif R208_GENE_MAPPING_TAR.keys.include? karyo + elsif R208_GENE_MAPPING_TAR.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = R208_GENE_MAPPING_TAR[karyo] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end end def process_scope_r208_new(karyo, genotype, record) - genotype_genes=[] genotype_str = record.raw_fields['genotype'].to_s genotype_genes = genotype_str.scan(BRCA_REGEX).flatten.uniq if R208_GENE_MAPPING_FS_NEW.keys.include? karyo @logger.debug "ADDED FULL_SCREEN TEST for: #{karyo}" genotype.add_test_scope(:full_screen) @genes_set = R208_GENE_MAPPING_FS_NEW[karyo].dup - #add genes from genotype column - @genes_set=@genes_set.concat(genotype_genes) + # add genes from genotype column + @genes_set = @genes_set.concat(genotype_genes) if karyo.match(/R208\.1\s::\sNGS\sin\sLeeds/) date = DateTime.parse(record.raw_fields['authoriseddate']) - if date >= DateTime.parse('01/02/2023') - @genes_set=@genes_set.concat(['RAD51C', 'RAD51D']) - end + @genes_set = @genes_set.concat(%w[RAD51C RAD51D]) if date >= DateTime.parse('01/02/2023') end - elsif R208_GENE_MAPPING_TAR_NEW.keys.include? karyo + elsif R208_GENE_MAPPING_TAR_NEW.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = R208_GENE_MAPPING_TAR_NEW[karyo].dup - #add genes from genotype column - @genes_set=@genes_set.concat(genotype_genes) + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end - @genes_set=@genes_set.uniq + @genes_set = @genes_set.uniq end def process_scope_r430(karyo, genotype, record) - #TODO update this mapping to FS + # TODO: update this mapping to FS if R430_GENE_MAPPING.keys.include? karyo - genotype.add_test_scope(:full_screen) @genes_set = R430_GENE_MAPPING[karyo] + genotype.add_test_scope(:full_screen) else genotype.add_test_scope(:no_genetictestscope) end @@ -181,34 +186,34 @@ def process_scope_r430(karyo, genotype, record) def process_scope_r444(karyo, genotype, record) if karyo.match(/R444\.1\s::\sPARPi\sfor\sBreast\scancer.*NGS\sin\sLeeds/) - karyo="R444.1 :: PARPi for Breast cancer - NGS in Leeds" + karyo = 'R444.1 :: PARPi for Breast cancer - NGS in Leeds' end if karyo.match(/R444\.2\s::\sPARPi\sfor\sProstate\sCancer.*NGS\sin\sLeeds\ssend\sDNA\sto\sLeeds/) - karyo="R444.2 :: PARPi for Prostate Cancer - NGS in Leeds send DNA to Leeds" + karyo = 'R444.2 :: PARPi for Prostate Cancer - NGS in Leeds send DNA to Leeds' end if R444_GENE_MAPPING.keys.include? karyo @genes_set = R444_GENE_MAPPING[karyo] genotype.add_test_scope(:full_screen) - else + else genotype.add_test_scope(:no_genetictestscope) end end def process_scope_r240(karyo, genotype, record) - if R240_GENE_MAPPING_TAR.keys.include? karyo + if R240_GENE_MAPPING_TAR.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = R240_GENE_MAPPING_TAR[karyo] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end end def process_scope_r242(karyo, genotype, record) - if R242_GENE_MAPPING_TAR.keys.include? karyo + if R242_GENE_MAPPING_TAR.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" genotype.add_test_scope(:targeted_mutation) - @genes_set = R242_GENE_MAPPING_TAR[karyo] + get_genes_set_targeted(record) else genotype.add_test_scope(:no_genetictestscope) end @@ -223,7 +228,7 @@ def add_test_type(genotype, record) def process_variants_from_record(genotype, record) genotypes = [] if full_screen?(genotype) - genotypes=process_fullscreen_records(genotype, record, genotypes) + genotypes = process_fullscreen_records(genotype, record, genotypes) elsif targeted?(genotype) || no_scope?(genotype) process_targeted_no_scope_records(genotype, record, genotypes) end @@ -290,7 +295,7 @@ def process_protein_targeted(genotype, record, genotypes) process_single_gene(genotype, record) genotype.add_status(2) genotype.add_gene_location('') - process_protein_impact(genotype, genotype_str) + process_protein_impact(record, genotype, genotype_str) genotypes.append(genotype) genotypes end @@ -317,9 +322,9 @@ def process_positive_targeted(genotype, record, genotypes) process_multi_genes(genotype, record, genotypes) else process_single_gene(genotype, record) - process_protein_impact(genotype, genotype_str) - process_cdna_change(genotype, genotype_str) - process_exons(genotype, genotype_str) + process_protein_impact(record, genotype, genotype_str) + process_cdna_change(genotype, genotype_str, record) + process_exons(record, genotype, genotype_str) genotypes.append(genotype) end genotypes @@ -342,37 +347,37 @@ def add_other_genes_with_status(other_genes, genotype, genotypes, status) genotype_other.add_protein_impact(nil) genotype_other.add_gene_location(nil) genotypes.append(genotype_other) + end genotypes end def process_multi_genes(genotype, record, genotypes) positive_genes = record.raw_fields['genotype'].scan(BRCA_REGEX).flatten - positive_genes_length= positive_genes.length() + positive_genes.length - positive_genes=positive_genes.join('|') + positive_genes = positive_genes.join('|') raw_genotypes = record.raw_fields['genotype'].split(/(?=#{positive_genes})/) - - genotypes=process_raw_genotypes(raw_genotypes, genotype, genotypes) - genotypes + + process_raw_genotypes(raw_genotypes, genotype, genotypes, record) end - def process_raw_genotypes(raw_genotypes, genotype, genotypes) + def process_raw_genotypes(raw_genotypes, genotype, genotypes, record) raw_genotypes.each do |raw_genotype| raw_genotype.scan(BRCA_REGEX) - if !raw_genotype.scan(BRCA_REGEX).empty? - genotype_dup = genotype.dup - genotype_dup.add_gene($LAST_MATCH_INFO[:brca]&.upcase) - if positive_cdna?(raw_genotype) || positive_exonvariant?(raw_genotype) - process_exons(genotype_dup, raw_genotype) - process_cdna_change(genotype_dup, raw_genotype) - process_protein_impact(genotype_dup, raw_genotype) - genotype_dup.add_status(2) - else - genotype_dup.add_status(1) - end - genotypes.append(genotype_dup) + next if raw_genotype.scan(BRCA_REGEX).empty? + + genotype_dup = genotype.dup + genotype_dup.add_gene($LAST_MATCH_INFO[:brca]&.upcase) + if positive_cdna?(raw_genotype) || positive_exonvariant?(raw_genotype) + process_exons(record, genotype_dup, raw_genotype) + process_cdna_change(genotype_dup, raw_genotype, record) + process_protein_impact(record, genotype_dup, raw_genotype) + genotype_dup.add_status(2) + else + genotype_dup.add_status(1) end + genotypes.append(genotype_dup) end genotypes end @@ -398,12 +403,12 @@ def process_fullscreen_records(genotype, record, genotypes) process_failed_full_screen(genotype, record, genotypes) elsif positive_cdna?(genotype_str) || positive_exonvariant?(genotype_str) process_variant_fs_records(genotype, record, genotypes) - elsif only_protein_impact?(record) ||genotype_str.scan(/see\sbelow|comments/ix).size.positive? + elsif only_protein_impact?(record) || genotype_str.scan(/see\sbelow|comments/ix).size.positive? ## TODO should this be process_protein_targeted_instead??? add_other_genes_with_status(@genes_set, genotype, genotypes, 4) else - #TODO should those with unknown status be given a status of 4???? - add_other_genes_with_status(@genes_set,genotype, genotypes, 4) + # TODO: should those with unknown status be given a status of 4???? + add_other_genes_with_status(@genes_set, genotype, genotypes, 4) end genotypes end @@ -422,7 +427,7 @@ def process_multiple_variant_fs_record(genotype, record, genotypes) if positive_genes.blank? add_other_genes_with_status(@genes_set, genotype, genotypes, 4) elsif positive_genes.size > 1 - genotypes=process_multi_genes(genotype, record, genotypes) + genotypes = process_multi_genes(genotype, record, genotypes) else process_positive_record(genotype, record, genotypes, positive_genes) end @@ -447,7 +452,6 @@ def process_single_variant_fs_record(genotype, record, genotypes) end def process_positive_record(genotype, record, genotypes, positive_gene) - genotype_str = record.raw_fields['genotype'].to_s mutation = get_cdna_mutation(genotype_str) protein = get_protein_impact(genotype_str) @@ -455,7 +459,7 @@ def process_positive_record(genotype, record, genotypes, positive_gene) genotype_pos.add_gene_location(mutation) genotype_pos.add_protein_impact(protein) genotype_pos.add_gene(positive_gene[0]&.upcase) - process_exons(genotype_pos, genotype_str) + process_exons(record, genotype_pos, genotype_str) genotypes.append(genotype_pos) end @@ -564,7 +568,7 @@ def stated_detected_only?(record) 'Familial pathogenic mutation detected'].include? variant end - def process_cdna_change(genotype, genotype_str) + def process_cdna_change(genotype, genotype_str, record) case genotype_str when CDNA_REGEX genotype.add_gene_location($LAST_MATCH_INFO[:cdna]) @@ -575,7 +579,7 @@ def process_cdna_change(genotype, genotype_str) end end - def process_protein_impact(genotype, genotype_str) + def process_protein_impact(record, genotype, genotype_str) case genotype_str when PROTEIN_REGEX genotype.add_protein_impact($LAST_MATCH_INFO[:impact]) @@ -586,7 +590,7 @@ def process_protein_impact(genotype, genotype_str) end end - def process_exons(genotype, genotype_str) + def process_exons(record, genotype, genotype_str) exon_matches = EXON_VARIANT_REGEX.match(genotype_str) return if exon_matches.nil? diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index f4a7ffb1..387d083c 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -31,25 +31,41 @@ module RcuConstants 'R444 :: NICE approved PARP inhibitor treatment'=> :process_scope_r444 }.freeze - BRCA_FAMILIAL_GENE_MAPPING = { - 'BRCA1 gene MLPA' => %w[BRCA1], - 'BRCA1 gene sequencing' => %w[BRCA1], - 'BRCA2 gene MLPA' => %w[BRCA2], - 'BRCA2 gene sequencing' => %w[BRCA2] - }.freeze + GENES_LIST = %w[BRCA1, BRCA2] #TODO - include all genes here + + #BRCA_FAMILIAL_GENE_MAPPING = { + # 'BRCA1 gene MLPA' => %w[BRCA1], + # 'BRCA1 gene sequencing' => %w[BRCA1], + # 'BRCA2 gene MLPA' => %w[BRCA2], + # 'BRCA2 gene sequencing' => %w[BRCA2] + #}.freeze + + BRCA_FAMILIAL_GENE_MAPPING = [ + 'BRCA1 gene MLPA', + 'BRCA1 gene sequencing', + 'BRCA2 gene MLPA', + 'BRCA2 gene sequencing'] BRCA_ANALYSIS_GENE_MAPPING_FS = { 'BRCA1 and 2 gene sequencing' => %w[BRCA1 BRCA2], 'Full Screen' => %w[BRCA1 BRCA2] }.freeze - BRCA_ANALYSIS_GENE_MAPPING_TAR = { - 'BRCA cDNA analysis' => %w[BRCA1 BRCA2], - 'BRCA1 gene MLPA' => %w[BRCA1], - 'BRCA1 gene sequencing' => %w[BRCA1], - 'BRCA2 gene MLPA' => %w[BRCA2], - 'BRCA2 gene sequencing' => %w[BRCA2] - }.freeze + #BRCA_ANALYSIS_GENE_MAPPING_TAR = { + # 'BRCA cDNA analysis' => %w[BRCA1 BRCA2], + # 'BRCA1 gene MLPA' => %w[BRCA1], + # 'BRCA1 gene sequencing' => %w[BRCA1], + # 'BRCA2 gene MLPA' => %w[BRCA2], + # 'BRCA2 gene sequencing' => %w[BRCA2] + #}.freeze + + BRCA_ANALYSIS_GENE_MAPPING_TAR = [ + 'BRCA cDNA analysis', + 'BRCA1 gene MLPA' , + 'BRCA1 gene sequencing', + 'BRCA2 gene MLPA', + 'BRCA2 gene sequencing'] + OVRN_CNCR_PNL_GENE_MAPPING = { 'BRCA1 BRCA2 & TP53' => %w[BRCA1 BRCA2 TP53], @@ -87,11 +103,15 @@ module RcuConstants STK11 TP53] }.freeze - R205_GENE_MAPPING_TAR = { - 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CDH1 CHEK2 PALB2 PTEN STK11 - TP53], - 'R242.1 :: Predictive - MLPA' => %w[BRCA1 BRCA2 TP53] - }.freeze + #R205_GENE_MAPPING_TAR = { + # 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CDH1 CHEK2 PALB2 PTEN STK11 + # TP53], + # 'R242.1 :: Predictive - MLPA' => %w[ATM BRCA1 BRCA2 CDH1 CHEK2 PALB2 PTEN STK11 TP53] + #}.freeze + + R205_GENE_MAPPING_TAR = [ + 'R242.1 :: Predictive testing', + 'R242.1 :: Predictive - MLPA'] R206_GENE_MAPPING = { 'R206.1 :: Unknown mutation(s) by Small panel' => %w[ATM BRCA1 BRCA2 BRIP1 CDH1 @@ -119,15 +139,31 @@ module RcuConstants 'R387.1 :: NGS analysis only' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], 'R207.1 :: NGS in Leeds' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 MSH2 + MSH6 PALB2 RAD51C RAD51D PMS2], + 'R207.1 :: NGS in Leeds - Send DNA to Leeds' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2] }.freeze - R207_GENE_MAPPING_TAR = { - 'R240.1 :: Diagnostic familial' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 - MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], - 'R242.1 :: Predictive testing' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 - MSH2 MSH6 PALB2 RAD51C RAD51D PMS2] - }.freeze + #R207_GENE_MAPPING_TAR = { + # 'R240.1 :: Diagnostic familial' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 + # MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], + # 'R242.1 :: Predictive testing' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 + # MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], + # 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[BRCA1 + # BRCA2 BRIP1 EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], + # 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA' => %w[BRCA1 BRCA2 BRIP1 + # EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], + # 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' => %w[BRCA1, BRCA2, BRIP1, + # EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2] + #}.freeze + + R207_GENE_MAPPING_TAR = [ + 'R240.1 :: Diagnostic familial', + 'R242.1 :: Predictive testing', + 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood', + 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA', + 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' + ] R208_GENE_MAPPING_FS = { 'R208.1 :: Unknown mutation(s) by Single gene sequencing' => %w[BRCA1 BRCA2 PALB2], @@ -137,13 +173,21 @@ module RcuConstants 'R208.1 :: PALB2 - NGS in Leeds - Analysis only' => %w[PALB2] }.freeze - R208_GENE_MAPPING_TAR = { - 'R242.1 :: Predictive testing' => %w[BRCA1 BRCA2 PALB2], - 'R242.1 :: Predictive testing MLPA' => %w[BRCA1 BRCA2], - 'R240.1 :: Diagnostic familial' => %w[BRCA1 BRCA2 PALB2], - 'R240.1 :: Diagnostic Familial BRCA1 MLPA' => %w[BRCA1], - 'R370.1 :: Confirmation of research result' => %w[BRCA1 BRCA2 PALB2] - }.freeze + #R208_GENE_MAPPING_TAR = { + # 'R242.1 :: Predictive testing' => %w[BRCA1 BRCA2 PALB2], + # 'R242.1 :: Predictive testing MLPA' => %w[BRCA1 BRCA2], + # 'R240.1 :: Diagnostic familial' => %w[BRCA1 BRCA2 PALB2], + # 'R240.1 :: Diagnostic Familial BRCA1 MLPA' => %w[BRCA1], + # 'R370.1 :: Confirmation of research result' => %w[BRCA1 BRCA2 PALB2] + #}.freeze + + R208_GENE_MAPPING_TAR = [ + 'R242.1 :: Predictive testing', + 'R242.1 :: Predictive testing MLPA', + 'R240.1 :: Diagnostic familial', + 'R240.1 :: Diagnostic Familial BRCA1 MLPA', + 'R370.1 :: Confirmation of research result' + ] R208_GENE_MAPPING_FS_NEW = { 'R208.1 :: NGS in Leeds' => %w[ATM, BRCA1, BRCA2, CHEK2, PALB2], @@ -152,24 +196,40 @@ module RcuConstants 'R387.1 :: BRCA1 BRCA2 PALB2 analysis only' => %w[BRCA1 BRCA2 PALB2] }.freeze - R208_GENE_MAPPING_TAR_NEW = { - 'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing - Seq in Sheffield' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - 'R242.1 :: Predictive testing MLPA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6] - }.freeze + #R208_GENE_MAPPING_TAR_NEW = { + # 'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing - Seq in Sheffield' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], + # 'R242.1 :: Predictive testing MLPA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6] + #}.freeze - R240_GENE_MAPPING_TAR = { - 'R242.1 :: Familial diagnostic testing - ATM gene' => %w[ATM] - }.freeze + R208_GENE_MAPPING_TAR_NEW = [ + 'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood', + 'R242.1 :: Predictive testing', + 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood', + 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only', + 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood', + 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA', + 'R242.1 :: Predictive testing - Seq in Sheffield', + 'R242.1 :: Predictive testing MLPA'] - R242_GENE_MAPPING_TAR = { - 'R242.1 :: Predictive testing - ATM gene' => %w[ATM] - }.freeze + #R240_GENE_MAPPING_TAR = { + # 'R242.1 :: Familial diagnostic testing - ATM gene' => %w[ATM] + #}.freeze + + R240_GENE_MAPPING_TAR = [ + 'R242.1 :: Familial diagnostic testing - ATM gene' ] + + #R242_GENE_MAPPING_TAR = { + # 'R242.1 :: Predictive testing - ATM gene' => %w[ATM] + #}.freeze + + R242_GENE_MAPPING_TAR = [ + 'R242.1 :: Predictive testing - ATM gene'] R430_GENE_MAPPING = { From bf7b9d5c25d6bd6a2e739391c2dd19968f13468c Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Thu, 13 Feb 2025 13:32:10 +0000 Subject: [PATCH 04/11] tidy code --- .../providers/sheffield/sheffield_handler.rb | 39 +++--- .../brca/providers/rcu/rcu_constants.rb | 116 +++++------------- 2 files changed, 48 insertions(+), 107 deletions(-) diff --git a/lib/import/brca/providers/sheffield/sheffield_handler.rb b/lib/import/brca/providers/sheffield/sheffield_handler.rb index 92f6a4a4..4a19fd92 100644 --- a/lib/import/brca/providers/sheffield/sheffield_handler.rb +++ b/lib/import/brca/providers/sheffield/sheffield_handler.rb @@ -67,12 +67,12 @@ def process_scope_gene_analysis(karyo, genotype, record) def get_genes_set_targeted(record) karyo_column = record.raw_fields['karyotypingmethod'].strip - geno_column = record.raw_fields['geno'].strip - @genes_set=[] + genotype_column= record.raw_fields['genotype'].strip + @genes_set = [] GENES_LIST.each do |gene| @genes_set.append(karyo_column.scan(gene)) + @genes_set.append(genotype_column.scan(gene)) end - end def process_scope_ovarian_panel(karyo, genotype, record) @@ -159,10 +159,10 @@ def process_scope_r208_new(karyo, genotype, record) genotype.add_test_scope(:full_screen) @genes_set = R208_GENE_MAPPING_FS_NEW[karyo].dup # add genes from genotype column - @genes_set = @genes_set.concat(genotype_genes) + @genes_set.concat(genotype_genes) if karyo.match(/R208\.1\s::\sNGS\sin\sLeeds/) date = DateTime.parse(record.raw_fields['authoriseddate']) - @genes_set = @genes_set.concat(%w[RAD51C RAD51D]) if date >= DateTime.parse('01/02/2023') + @genes_set.concat(%w[RAD51C RAD51D]) if date >= DateTime.parse('01/02/2023') end elsif R208_GENE_MAPPING_TAR_NEW.include? karyo @logger.debug "ADDED TARGETED TEST for: #{karyo}" @@ -174,7 +174,7 @@ def process_scope_r208_new(karyo, genotype, record) @genes_set = @genes_set.uniq end - def process_scope_r430(karyo, genotype, record) + def process_scope_r430(karyo, genotype, _record) # TODO: update this mapping to FS if R430_GENE_MAPPING.keys.include? karyo @genes_set = R430_GENE_MAPPING[karyo] @@ -295,7 +295,7 @@ def process_protein_targeted(genotype, record, genotypes) process_single_gene(genotype, record) genotype.add_status(2) genotype.add_gene_location('') - process_protein_impact(record, genotype, genotype_str) + process_protein_impact(genotype, genotype_str) genotypes.append(genotype) genotypes end @@ -322,9 +322,9 @@ def process_positive_targeted(genotype, record, genotypes) process_multi_genes(genotype, record, genotypes) else process_single_gene(genotype, record) - process_protein_impact(record, genotype, genotype_str) + process_protein_impact(genotype, genotype_str) process_cdna_change(genotype, genotype_str, record) - process_exons(record, genotype, genotype_str) + process_exons(genotype, genotype_str) genotypes.append(genotype) end genotypes @@ -347,22 +347,19 @@ def add_other_genes_with_status(other_genes, genotype, genotypes, status) genotype_other.add_protein_impact(nil) genotype_other.add_gene_location(nil) genotypes.append(genotype_other) - end genotypes end def process_multi_genes(genotype, record, genotypes) positive_genes = record.raw_fields['genotype'].scan(BRCA_REGEX).flatten - positive_genes.length - positive_genes = positive_genes.join('|') raw_genotypes = record.raw_fields['genotype'].split(/(?=#{positive_genes})/) - process_raw_genotypes(raw_genotypes, genotype, genotypes, record) + process_raw_genotypes(raw_genotypes, genotype, genotypes) end - def process_raw_genotypes(raw_genotypes, genotype, genotypes, record) + def process_raw_genotypes(raw_genotypes, genotype, genotypes) raw_genotypes.each do |raw_genotype| raw_genotype.scan(BRCA_REGEX) next if raw_genotype.scan(BRCA_REGEX).empty? @@ -370,9 +367,9 @@ def process_raw_genotypes(raw_genotypes, genotype, genotypes, record) genotype_dup = genotype.dup genotype_dup.add_gene($LAST_MATCH_INFO[:brca]&.upcase) if positive_cdna?(raw_genotype) || positive_exonvariant?(raw_genotype) - process_exons(record, genotype_dup, raw_genotype) - process_cdna_change(genotype_dup, raw_genotype, record) - process_protein_impact(record, genotype_dup, raw_genotype) + process_exons(genotype_dup, raw_genotype) + process_cdna_change(genotype_dup, raw_genotype) + process_protein_impact(genotype_dup, raw_genotype) genotype_dup.add_status(2) else genotype_dup.add_status(1) @@ -459,7 +456,7 @@ def process_positive_record(genotype, record, genotypes, positive_gene) genotype_pos.add_gene_location(mutation) genotype_pos.add_protein_impact(protein) genotype_pos.add_gene(positive_gene[0]&.upcase) - process_exons(record, genotype_pos, genotype_str) + process_exons(genotype_pos, genotype_str) genotypes.append(genotype_pos) end @@ -568,7 +565,7 @@ def stated_detected_only?(record) 'Familial pathogenic mutation detected'].include? variant end - def process_cdna_change(genotype, genotype_str, record) + def process_cdna_change(genotype, genotype_str) case genotype_str when CDNA_REGEX genotype.add_gene_location($LAST_MATCH_INFO[:cdna]) @@ -579,7 +576,7 @@ def process_cdna_change(genotype, genotype_str, record) end end - def process_protein_impact(record, genotype, genotype_str) + def process_protein_impact(genotype, genotype_str) case genotype_str when PROTEIN_REGEX genotype.add_protein_impact($LAST_MATCH_INFO[:impact]) @@ -590,7 +587,7 @@ def process_protein_impact(record, genotype, genotype_str) end end - def process_exons(record, genotype, genotype_str) + def process_exons(genotype, genotype_str) exon_matches = EXON_VARIANT_REGEX.match(genotype_str) return if exon_matches.nil? diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 387d083c..8b12952a 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -27,45 +27,34 @@ module RcuConstants 'R208 :: Inherited breast cancer and ovarian cancer' => :process_scope_r208_new, 'R240 - Familial Diagnostic testing - Hered Cancers' => :process_scope_r240, 'R242 - Predictive testing - Hered Cancers' => :process_scope_r242, - 'R430 :: Inherited Prostate Cancer'=> :process_scope_r430, - 'R444 :: NICE approved PARP inhibitor treatment'=> :process_scope_r444 + 'R430 :: Inherited Prostate Cancer' => :process_scope_r430, + 'R444 :: NICE approved PARP inhibitor treatment' => :process_scope_r444 }.freeze - GENES_LIST = %w[BRCA1, BRCA2] #TODO - include all genes here - - #BRCA_FAMILIAL_GENE_MAPPING = { - # 'BRCA1 gene MLPA' => %w[BRCA1], - # 'BRCA1 gene sequencing' => %w[BRCA1], - # 'BRCA2 gene MLPA' => %w[BRCA2], - # 'BRCA2 gene sequencing' => %w[BRCA2] - #}.freeze + GENES_LIST = %w[ATM BRCA1 BRCA2 BRIP1 CDH1 CHEK2 EPCAM + MLH1 MSH2 MSH6 PALB2 PTEN RAD51C RAD51D + STK11 TP53 PMS2 ].freeze + # TODO: - include all genes here BRCA_FAMILIAL_GENE_MAPPING = [ - 'BRCA1 gene MLPA', - 'BRCA1 gene sequencing', - 'BRCA2 gene MLPA', - 'BRCA2 gene sequencing'] + 'BRCA1 gene MLPA', + 'BRCA1 gene sequencing', + 'BRCA2 gene MLPA', + 'BRCA2 gene sequencing' + ].freeze BRCA_ANALYSIS_GENE_MAPPING_FS = { 'BRCA1 and 2 gene sequencing' => %w[BRCA1 BRCA2], 'Full Screen' => %w[BRCA1 BRCA2] }.freeze - #BRCA_ANALYSIS_GENE_MAPPING_TAR = { - # 'BRCA cDNA analysis' => %w[BRCA1 BRCA2], - # 'BRCA1 gene MLPA' => %w[BRCA1], - # 'BRCA1 gene sequencing' => %w[BRCA1], - # 'BRCA2 gene MLPA' => %w[BRCA2], - # 'BRCA2 gene sequencing' => %w[BRCA2] - #}.freeze - BRCA_ANALYSIS_GENE_MAPPING_TAR = [ 'BRCA cDNA analysis', - 'BRCA1 gene MLPA' , + 'BRCA1 gene MLPA', 'BRCA1 gene sequencing', 'BRCA2 gene MLPA', - 'BRCA2 gene sequencing'] - + 'BRCA2 gene sequencing' + ].freeze OVRN_CNCR_PNL_GENE_MAPPING = { 'BRCA1 BRCA2 & TP53' => %w[BRCA1 BRCA2 TP53], @@ -103,15 +92,10 @@ module RcuConstants STK11 TP53] }.freeze - #R205_GENE_MAPPING_TAR = { - # 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CDH1 CHEK2 PALB2 PTEN STK11 - # TP53], - # 'R242.1 :: Predictive - MLPA' => %w[ATM BRCA1 BRCA2 CDH1 CHEK2 PALB2 PTEN STK11 TP53] - #}.freeze - R205_GENE_MAPPING_TAR = [ 'R242.1 :: Predictive testing', - 'R242.1 :: Predictive - MLPA'] + 'R242.1 :: Predictive - MLPA' + ].freeze R206_GENE_MAPPING = { 'R206.1 :: Unknown mutation(s) by Small panel' => %w[ATM BRCA1 BRCA2 BRIP1 CDH1 @@ -141,29 +125,16 @@ module RcuConstants 'R207.1 :: NGS in Leeds' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], 'R207.1 :: NGS in Leeds - Send DNA to Leeds' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 MSH2 - MSH6 PALB2 RAD51C RAD51D PMS2] + MSH6 PALB2 RAD51C RAD51D PMS2] }.freeze - #R207_GENE_MAPPING_TAR = { - # 'R240.1 :: Diagnostic familial' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 - # MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], - # 'R242.1 :: Predictive testing' => %w[BRCA1 BRCA2 BRIP1 EPCAM MLH1 - # MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], - # 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[BRCA1 - # BRCA2 BRIP1 EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], - # 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA' => %w[BRCA1 BRCA2 BRIP1 - # EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2], - # 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' => %w[BRCA1, BRCA2, BRIP1, - # EPCAM MLH1 MSH2 MSH6 PALB2 RAD51C RAD51D PMS2] - #}.freeze - R207_GENE_MAPPING_TAR = [ 'R240.1 :: Diagnostic familial', 'R242.1 :: Predictive testing', 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood', 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA', 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' - ] + ].freeze R208_GENE_MAPPING_FS = { 'R208.1 :: Unknown mutation(s) by Single gene sequencing' => %w[BRCA1 BRCA2 PALB2], @@ -173,64 +144,39 @@ module RcuConstants 'R208.1 :: PALB2 - NGS in Leeds - Analysis only' => %w[PALB2] }.freeze - #R208_GENE_MAPPING_TAR = { - # 'R242.1 :: Predictive testing' => %w[BRCA1 BRCA2 PALB2], - # 'R242.1 :: Predictive testing MLPA' => %w[BRCA1 BRCA2], - # 'R240.1 :: Diagnostic familial' => %w[BRCA1 BRCA2 PALB2], - # 'R240.1 :: Diagnostic Familial BRCA1 MLPA' => %w[BRCA1], - # 'R370.1 :: Confirmation of research result' => %w[BRCA1 BRCA2 PALB2] - #}.freeze - R208_GENE_MAPPING_TAR = [ 'R242.1 :: Predictive testing', 'R242.1 :: Predictive testing MLPA', 'R240.1 :: Diagnostic familial', 'R240.1 :: Diagnostic Familial BRCA1 MLPA', 'R370.1 :: Confirmation of research result' - ] + ].freeze R208_GENE_MAPPING_FS_NEW = { - 'R208.1 :: NGS in Leeds' => %w[ATM, BRCA1, BRCA2, CHEK2, PALB2], + 'R208.1 :: NGS in Leeds' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2], 'R208.1 :: NGS in Leeds - Send DNA to Leeds' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2], 'R208.1 :: PALB2 - NGS in Leeds - Analysis only' => %w[PALB2], 'R387.1 :: BRCA1 BRCA2 PALB2 analysis only' => %w[BRCA1 BRCA2 PALB2] - }.freeze - - #R208_GENE_MAPPING_TAR_NEW = { - # 'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing - Seq in Sheffield' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6], - # 'R242.1 :: Predictive testing MLPA' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D BRIP1 MSH6] - #}.freeze + }.freeze R208_GENE_MAPPING_TAR_NEW = [ 'R240.1 :: Diagnostic familial - Seq in Leeds - Send Blood', - 'R242.1 :: Predictive testing', + 'R242.1 :: Predictive testing', 'R242.1 :: Predictive testing - MLPA in Leeds - Send Blood', - 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only', + 'R242.1 :: Predictive testing - Seq in Leeds - Analysis only', 'R242.1 :: Predictive testing - Seq in Leeds - Send Blood', 'R242.1 :: Predictive testing - Seq in Leeds - Send DNA', 'R242.1 :: Predictive testing - Seq in Sheffield', - 'R242.1 :: Predictive testing MLPA'] - - #R240_GENE_MAPPING_TAR = { - # 'R242.1 :: Familial diagnostic testing - ATM gene' => %w[ATM] - #}.freeze + 'R242.1 :: Predictive testing MLPA' + ].freeze R240_GENE_MAPPING_TAR = [ - 'R242.1 :: Familial diagnostic testing - ATM gene' ] - - #R242_GENE_MAPPING_TAR = { - # 'R242.1 :: Predictive testing - ATM gene' => %w[ATM] - #}.freeze + 'R242.1 :: Familial diagnostic testing - ATM gene' + ].freeze R242_GENE_MAPPING_TAR = [ - 'R242.1 :: Predictive testing - ATM gene'] - + 'R242.1 :: Predictive testing - ATM gene' + ].freeze R430_GENE_MAPPING = { 'R420.1 :: NGS in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 MLH1 MSH2 MSH6 PALB2] @@ -238,10 +184,9 @@ module RcuConstants R444_GENE_MAPPING = { 'R444.1 :: PARPi for Breast cancer - NGS in Leeds' => %w[ATM BRCA1 BRCA2 CHEK2 PALB2 RAD51C RAD51D], - 'R444.2 :: PARPi for Prostate Cancer - NGS in Leeds send DNA to Leeds' => %w[BRCA1, BRCA2] + 'R444.2 :: PARPi for Prostate Cancer - NGS in Leeds send DNA to Leeds' => %w[BRCA1 BRCA2] }.freeze - PASS_THROUGH_FIELDS = %w[consultantcode providercode collecteddate @@ -301,4 +246,3 @@ module RcuConstants end end end - From 270a1dcb8d880967c2afa8dea0be1e2a156bb5b4 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Thu, 13 Feb 2025 16:43:54 +0000 Subject: [PATCH 05/11] tidy code --- .../providers/sheffield/sheffield_handler.rb | 26 ++++++++----------- .../brca/providers/rcu/rcu_constants.rb | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/import/brca/providers/sheffield/sheffield_handler.rb b/lib/import/brca/providers/sheffield/sheffield_handler.rb index 4a19fd92..556661a8 100644 --- a/lib/import/brca/providers/sheffield/sheffield_handler.rb +++ b/lib/import/brca/providers/sheffield/sheffield_handler.rb @@ -67,7 +67,7 @@ def process_scope_gene_analysis(karyo, genotype, record) def get_genes_set_targeted(record) karyo_column = record.raw_fields['karyotypingmethod'].strip - genotype_column= record.raw_fields['genotype'].strip + genotype_column = record.raw_fields['genotype'].strip @genes_set = [] GENES_LIST.each do |gene| @genes_set.append(karyo_column.scan(gene)) @@ -75,7 +75,7 @@ def get_genes_set_targeted(record) end end - def process_scope_ovarian_panel(karyo, genotype, record) + def process_scope_ovarian_panel(karyo, genotype, _record) if OVRN_CNCR_PNL_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED FULL_SCREEN for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -85,7 +85,7 @@ def process_scope_ovarian_panel(karyo, genotype, record) end end - def process_scope_colo_ovarian_panel(karyo, genotype, record) + def process_scope_colo_ovarian_panel(karyo, genotype, _record) if OVRN_COLO_PNL_GENE_MAPPING.keys.include? karyo @logger.debug "ADDED FULL_SCREEN for: #{karyo}" genotype.add_test_scope(:full_screen) @@ -175,16 +175,15 @@ def process_scope_r208_new(karyo, genotype, record) end def process_scope_r430(karyo, genotype, _record) - # TODO: update this mapping to FS - if R430_GENE_MAPPING.keys.include? karyo - @genes_set = R430_GENE_MAPPING[karyo] + if R430_GENE_MAPPING_FS.keys.include? karyo + @genes_set = R430_GENE_MAPPING_FS[karyo] genotype.add_test_scope(:full_screen) else genotype.add_test_scope(:no_genetictestscope) end end - def process_scope_r444(karyo, genotype, record) + def process_scope_r444(karyo, genotype, _record) if karyo.match(/R444\.1\s::\sPARPi\sfor\sBreast\scancer.*NGS\sin\sLeeds/) karyo = 'R444.1 :: PARPi for Breast cancer - NGS in Leeds' end @@ -323,7 +322,7 @@ def process_positive_targeted(genotype, record, genotypes) else process_single_gene(genotype, record) process_protein_impact(genotype, genotype_str) - process_cdna_change(genotype, genotype_str, record) + process_cdna_change(genotype, genotype_str) process_exons(genotype, genotype_str) genotypes.append(genotype) end @@ -400,9 +399,6 @@ def process_fullscreen_records(genotype, record, genotypes) process_failed_full_screen(genotype, record, genotypes) elsif positive_cdna?(genotype_str) || positive_exonvariant?(genotype_str) process_variant_fs_records(genotype, record, genotypes) - elsif only_protein_impact?(record) || genotype_str.scan(/see\sbelow|comments/ix).size.positive? - ## TODO should this be process_protein_targeted_instead??? - add_other_genes_with_status(@genes_set, genotype, genotypes, 4) else # TODO: should those with unknown status be given a status of 4???? add_other_genes_with_status(@genes_set, genotype, genotypes, 4) @@ -412,7 +408,7 @@ def process_fullscreen_records(genotype, record, genotypes) def process_variant_fs_records(genotype, record, genotypes) if (record.raw_fields['genotype'].scan(CDNA_REGEX).size + - record.raw_fields['genotype'].scan(EXON_VARIANT_REGEX).size) > 1 + record.raw_fields['genotype'].scan(EXON_VARIANT_REGEX).size) > 1 process_multiple_variant_fs_record(genotype, record, genotypes) else process_single_variant_fs_record(genotype, record, genotypes) @@ -546,7 +542,7 @@ def get_cdna_mutation(raw_genotype) def get_gene(record) genotype_str = record.raw_fields['genotype'].to_s positive_genes = genotype_str.scan(BRCA_REGEX).flatten.uniq - if positive_genes.size.zero? + if positive_genes.empty? positive_genes = record.raw_fields['karyotypingmethod'].scan(BRCA_REGEX).flatten.uniq end positive_genes @@ -554,8 +550,8 @@ def get_gene(record) def only_protein_impact?(record) variant = record.raw_fields['genotype'] - variant.scan(CDNA_REGEX).size.zero? && - variant.scan(EXON_VARIANT_REGEX).size.zero? && + variant.scan(CDNA_REGEX).empty? && + variant.scan(EXON_VARIANT_REGEX).empty? && variant.scan(PROTEIN_REGEX).size.positive? end diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 8b12952a..e6df0615 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -178,7 +178,7 @@ module RcuConstants 'R242.1 :: Predictive testing - ATM gene' ].freeze - R430_GENE_MAPPING = { + R430_GENE_MAPPING_FS = { 'R420.1 :: NGS in Leeds - Send Blood' => %w[ATM BRCA1 BRCA2 CHEK2 MLH1 MSH2 MSH6 PALB2] }.freeze From b42a1b6cd13e68e5ce60f93f42f7d7db8755710e Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Wed, 19 Feb 2025 11:06:39 +0000 Subject: [PATCH 06/11] update to gene list and tidying --- .../brca/providers/sheffield/sheffield_handler.rb | 4 ++-- .../helpers/brca/providers/rcu/rcu_constants.rb | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/import/brca/providers/sheffield/sheffield_handler.rb b/lib/import/brca/providers/sheffield/sheffield_handler.rb index 556661a8..561aca00 100644 --- a/lib/import/brca/providers/sheffield/sheffield_handler.rb +++ b/lib/import/brca/providers/sheffield/sheffield_handler.rb @@ -400,7 +400,7 @@ def process_fullscreen_records(genotype, record, genotypes) elsif positive_cdna?(genotype_str) || positive_exonvariant?(genotype_str) process_variant_fs_records(genotype, record, genotypes) else - # TODO: should those with unknown status be given a status of 4???? + # else give a test status of 4 (unknown) add_other_genes_with_status(@genes_set, genotype, genotypes, 4) end genotypes @@ -408,7 +408,7 @@ def process_fullscreen_records(genotype, record, genotypes) def process_variant_fs_records(genotype, record, genotypes) if (record.raw_fields['genotype'].scan(CDNA_REGEX).size + - record.raw_fields['genotype'].scan(EXON_VARIANT_REGEX).size) > 1 + record.raw_fields['genotype'].scan(EXON_VARIANT_REGEX).size) > 1 process_multiple_variant_fs_record(genotype, record, genotypes) else process_single_variant_fs_record(genotype, record, genotypes) diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index e6df0615..58a5eb70 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -31,11 +31,6 @@ module RcuConstants 'R444 :: NICE approved PARP inhibitor treatment' => :process_scope_r444 }.freeze - GENES_LIST = %w[ATM BRCA1 BRCA2 BRIP1 CDH1 CHEK2 EPCAM - MLH1 MSH2 MSH6 PALB2 PTEN RAD51C RAD51D - STK11 TP53 PMS2 ].freeze - # TODO: - include all genes here - BRCA_FAMILIAL_GENE_MAPPING = [ 'BRCA1 gene MLPA', 'BRCA1 gene sequencing', @@ -209,8 +204,12 @@ module RcuConstants 'R224 :: Inherited renal cancer', 'R365 :: Fumarate hydratase-related tumour syndromes'].freeze + GENES_LIST = %w[ATM BRCA1 BRCA2 BRIP1 CDH1 CHEK2 EPCAM + MLH1 MSH2 MSH6 NBN PALB2 PTEN RAD51C RAD51D + STK11 TP53 PMS2 ].freeze + BRCA_REGEX = /(?BRCA1|BRCA2|PALB2|ATM|CHEK2|TP53|MLH1|CDH1| - MSH2|MSH6|PMS2|STK11|PTEN|BRIP1|NBN|RAD51C|RAD51D)/ix + MSH2|MSH6|PMS2|STK11|PTEN|BRIP1|NBN|RAD51C|RAD51D|EPCAM)/ix # rubocop:disable Lint/MixedRegexpCaptureTypes CDNA_REGEX = /c(\.|\[)-?\*?\[?(? From 1339e15c0da11097d652420d9a2671f09b5593c6 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Wed, 19 Feb 2025 15:56:06 +0000 Subject: [PATCH 07/11] update cdna and protein regex --- .../brca/providers/rcu/rcu_constants.rb | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 58a5eb70..153d2e11 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -212,21 +212,33 @@ module RcuConstants MSH2|MSH6|PMS2|STK11|PTEN|BRIP1|NBN|RAD51C|RAD51D|EPCAM)/ix # rubocop:disable Lint/MixedRegexpCaptureTypes - CDNA_REGEX = /c(\.|\[)-?\*?\[?(? - ([0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+)| - ([0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| - ([0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGTdelinsup])| - ([0-9]+[ACGTdelinsup]+[+>_-][ACGTdelinsup])| - ([0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| - ([0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+)| - ([0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGTdelinsup]+)| - ([0-9]+[ACGTdelinsup]+) - )\]?/ix + CDNA_REGEX = /((c(\.)?-?\*?(? + (\[[0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+\])| + ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| + ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGTdelinsup]\])| + ((\[)?[0-9]+[ACGTdelinsup]+[+>_-][ACGTdelinsup]\])| + ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| + ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| + ((\[)?[0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGTdelinsup]+\])| + ((\[)?[0-9]+[ACGTdelinsup]+\]))) | + (c\.-?\*?(? + ((\[)?[0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+(\])?)| + ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| + ((\[)?0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGTdelinsup](\])?)| + ((\[)?[0-9]+[ACGTdelinsup]+[+>_-][ACGTdelinsup](\])?)| + ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| + ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| + ((\[)?[0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGTdelinsup]+(\])?)| + ((\[)?[0-9]+[ACGTdelinsup]+(\])?))) + )/ix MLPA_FAIL_REGEX = /#{BRCA_REGEX}\s(?MLPA?\sfail)+/ix - PROTEIN_REGEX = /p(\.|\[)(\[\()?(?.([a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?)| - ([a-z]+[0-9]+[^[:alnum:]]))(\)\])?/ix + + PROTEIN_REGEX = /((p(\.)?(?(\[(\()?[a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?(\))?\])| + (\[(\()?[a-z]+[0-9]+[^[:alnum:]](\))?\])))| # in the case that p. is optional must have p[] + (p\.(?((\[)?(\()?[a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?(\))?(\])?)| + ((\[)?(\()?[a-z]+[0-9]+[^[:alnum:]](\))?(\])?))))/ix # p. is mandatory so [] are optional EXON_VARIANT_REGEX = /((?het|homo)[a-z ]+)? (?deletion|duplication|duplicated)\s? From 36327df781b7a8920831cd1345dae8f68acca178 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Thu, 20 Feb 2025 13:04:22 +0000 Subject: [PATCH 08/11] update cdna regex and unittests --- .../brca/providers/rcu/rcu_constants.rb | 30 +++++++++---------- .../sheffield/sheffield_handler_test.rb | 22 +++++++------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 153d2e11..8f9e57ed 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -212,33 +212,33 @@ module RcuConstants MSH2|MSH6|PMS2|STK11|PTEN|BRIP1|NBN|RAD51C|RAD51D|EPCAM)/ix # rubocop:disable Lint/MixedRegexpCaptureTypes - CDNA_REGEX = /((c(\.)?-?\*?(? + CDNA_REGEX = /((c(\.)?-?\*?(? (\[[0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+\])| - ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| - ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGTdelinsup]\])| - ((\[)?[0-9]+[ACGTdelinsup]+[+>_-][ACGTdelinsup]\])| - ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| - ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| - ((\[)?[0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGTdelinsup]+\])| - ((\[)?[0-9]+[ACGTdelinsup]+\]))) | - (c\.-?\*?(? + (\[[0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| + (\[[0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGT]+\])| + (\[[0-9]+[ACGTdelinsup]+[+>_-][ACGT]+\])| + (\[[0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| + (\[[0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+\])| + (\[[0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGT]+\])| + (\[[0-9]+[ACGTdelinsup]+\]))) | + (c\.-?\*?(? ((\[)?[0-9]+[+>_-][0-9][+>_-][0-9]+[+>_-][0-9][ACGTdelinsup]+(\])?)| ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| - ((\[)?0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGTdelinsup](\])?)| - ((\[)?[0-9]+[ACGTdelinsup]+[+>_-][ACGTdelinsup](\])?)| + ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup][+>_-][ACGT]+(\])?)| + ((\[)?[0-9]+[ACGTdelinsup]+[+>_-][ACGT]+(\])?)| ((\[)?[0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| ((\[)?[0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+(\])?)| - ((\[)?[0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGTdelinsup]+(\])?)| + ((\[)?[0-9]+[?+>_-]+[0-9]+[?+>_-]+[ACGT]+(\])?)| ((\[)?[0-9]+[ACGTdelinsup]+(\])?))) )/ix MLPA_FAIL_REGEX = /#{BRCA_REGEX}\s(?MLPA?\sfail)+/ix - + # in the case that '.' is optional must have [], if '.' is needed [] are optional PROTEIN_REGEX = /((p(\.)?(?(\[(\()?[a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?(\))?\])| - (\[(\()?[a-z]+[0-9]+[^[:alnum:]](\))?\])))| # in the case that p. is optional must have p[] + (\[(\()?[a-z]+[0-9]+[^[:alnum:]]([a-z]+[0-9]+[delinsup]+)?(\))?\])))| (p\.(?((\[)?(\()?[a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?(\))?(\])?)| - ((\[)?(\()?[a-z]+[0-9]+[^[:alnum:]](\))?(\])?))))/ix # p. is mandatory so [] are optional + ((\[)?(\()?[a-z]+[0-9]+[^[:alnum:]]([a-z]+[0-9]+[delinsup]+)?(\))?(\])?))))/ix EXON_VARIANT_REGEX = /((?het|homo)[a-z ]+)? (?deletion|duplication|duplicated)\s? diff --git a/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb b/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb index 6643ee34..905321c5 100644 --- a/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb +++ b/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb @@ -39,7 +39,7 @@ def setup genotypes = @handler.process_variants_from_record(@genotype, @record) assert_equal 1, genotypes.size assert_equal 2, genotypes[0].attribute_map['teststatus'] - assert_equal 'c.520C>T', genotypes[0].attribute_map['codingdnasequencechange'] + assert_equal 'c.[520C>T]', genotypes[0].attribute_map['codingdnasequencechange'] assert_nil genotypes[0].attribute_map['proteinimpact'] assert_equal 8, genotypes[0].attribute_map['gene'] end @@ -134,7 +134,7 @@ def setup # positive genes assert_equal 2, genotypes[0].attribute_map['teststatus'] assert_nil genotypes[0].attribute_map['proteinimpact'] - assert_equal 'c.4986+4_4986+13del', genotypes[0].attribute_map['codingdnasequencechange'] + assert_equal 'c.[4986+4_4986+13del]', genotypes[0].attribute_map['codingdnasequencechange'] assert_equal 7, genotypes[0].attribute_map['gene'] # negative gene @@ -177,8 +177,8 @@ def setup assert_equal 2, genotypes[1].attribute_map['teststatus'] assert_equal 8, genotypes[1].attribute_map['gene'] - assert_equal 'c.7069_7070del', genotypes[1].attribute_map['codingdnasequencechange'] - assert_equal 'p.Leu2357fs', genotypes[1].attribute_map['proteinimpact'] + assert_equal 'c.[7069_7070del]', genotypes[1].attribute_map['codingdnasequencechange'] + assert_equal 'p.[Leu2357fs]', genotypes[1].attribute_map['proteinimpact'] end test 'normal_targeted' do @@ -222,7 +222,7 @@ def setup assert_equal 2, genotypes[0].attribute_map['teststatus'] assert_equal 7, genotypes[0].attribute_map['gene'] assert_nil genotypes[0].attribute_map['exonintroncodonnumber'] - assert_equal 'p.Leu392fs', genotypes[0].attribute_map['proteinimpact'] + assert_equal 'p.[Leu392fs]', genotypes[0].attribute_map['proteinimpact'] assert_equal 'c.', genotypes[0].attribute_map['codingdnasequencechange'] assert_equal 'Targeted BRCA mutation test', genotypes[0].attribute_map['genetictestscope'] end @@ -251,13 +251,13 @@ def setup @handler.add_test_scope_from_geno_karyo(@genotype, malformed_mutation_fs_record) genotypes = @handler.process_variants_from_record(@genotype, malformed_mutation_fs_record) assert_equal 2, genotypes.size - assert_equal 4, genotypes[0].attribute_map['teststatus'] - assert_equal 4, genotypes[1].attribute_map['teststatus'] - assert_equal 7, genotypes[0].attribute_map['gene'] - assert_equal 8, genotypes[1].attribute_map['gene'] + assert_equal 2, genotypes[0].attribute_map['teststatus'] + assert_equal 1, genotypes[1].attribute_map['teststatus'] + assert_equal 8, genotypes[0].attribute_map['gene'] + assert_equal 7, genotypes[1].attribute_map['gene'] assert_nil genotypes[0].attribute_map['exonintroncodonnumber'] - assert_nil genotypes[0].attribute_map['proteinimpact'] - assert_nil genotypes[0].attribute_map['codingdnasequencechange'] + assert_equal 'p.[Gln2859fs]', genotypes[0].attribute_map['proteinimpact'] + assert_equal 'c.[8575del]', genotypes[0].attribute_map['codingdnasequencechange'] assert_equal 'Full screen BRCA1 and BRCA2', genotypes[0].attribute_map['genetictestscope'] assert_equal 'Full screen BRCA1 and BRCA2', genotypes[1].attribute_map['genetictestscope'] end From 6e74a9b2476580cc36bddb51eb701b967e666e80 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Fri, 7 Mar 2025 09:32:55 +0000 Subject: [PATCH 09/11] updates from code review --- .../brca/providers/sheffield/sheffield_handler.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/import/brca/providers/sheffield/sheffield_handler.rb b/lib/import/brca/providers/sheffield/sheffield_handler.rb index 561aca00..b408f748 100644 --- a/lib/import/brca/providers/sheffield/sheffield_handler.rb +++ b/lib/import/brca/providers/sheffield/sheffield_handler.rb @@ -69,10 +69,8 @@ def get_genes_set_targeted(record) karyo_column = record.raw_fields['karyotypingmethod'].strip genotype_column = record.raw_fields['genotype'].strip @genes_set = [] - GENES_LIST.each do |gene| - @genes_set.append(karyo_column.scan(gene)) - @genes_set.append(genotype_column.scan(gene)) - end + @genes_set.append(karyo_column.scan(BRCA_REGEX)) + @genes_set.append(genotype_column.scan(BRCA_REGEX)) end def process_scope_ovarian_panel(karyo, genotype, _record) @@ -227,7 +225,7 @@ def add_test_type(genotype, record) def process_variants_from_record(genotype, record) genotypes = [] if full_screen?(genotype) - genotypes = process_fullscreen_records(genotype, record, genotypes) + process_fullscreen_records(genotype, record, genotypes) elsif targeted?(genotype) || no_scope?(genotype) process_targeted_no_scope_records(genotype, record, genotypes) end @@ -340,7 +338,7 @@ def process_single_gene(genotype, record) def add_other_genes_with_status(other_genes, genotype, genotypes, status) other_genes.each do |gene| genotype_other = genotype.dup - @logger.debug "SUCxCESSFUL gene parse for #{status} status for: #{gene}" + @logger.debug "SUCCESSFUL gene parse for #{status} status for: #{gene}" genotype_other.add_status(status) genotype_other.add_gene(gene) genotype_other.add_protein_impact(nil) From f983c74a534a5c7c45804fb8440d32f920cabb97 Mon Sep 17 00:00:00 2001 From: lauramccluskey Date: Fri, 7 Mar 2025 09:51:53 +0000 Subject: [PATCH 10/11] updates from code review --- .../helpers/brca/providers/rcu/rcu_constants.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb index 8f9e57ed..25c69325 100644 --- a/lib/import/helpers/brca/providers/rcu/rcu_constants.rb +++ b/lib/import/helpers/brca/providers/rcu/rcu_constants.rb @@ -234,19 +234,16 @@ module RcuConstants MLPA_FAIL_REGEX = /#{BRCA_REGEX}\s(?MLPA?\sfail)+/ix - # in the case that '.' is optional must have [], if '.' is needed [] are optional - PROTEIN_REGEX = /((p(\.)?(?(\[(\()?[a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?(\))?\])| - (\[(\()?[a-z]+[0-9]+[^[:alnum:]]([a-z]+[0-9]+[delinsup]+)?(\))?\])))| - (p\.(?((\[)?(\()?[a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?(\))?(\])?)| - ((\[)?(\()?[a-z]+[0-9]+[^[:alnum:]]([a-z]+[0-9]+[delinsup]+)?(\))?(\])?))))/ix + PROTEIN_REGEX = /(p(\.|\[)(\[)?(\()?(?([a-z]+[0-9]+[a-z]+([^[:alnum:]][0-9]+)?)| + ([a-z]+[0-9]+[^[:alnum:]]([a-z]+[0-9]+[delinsup]+)?)))/ix EXON_VARIANT_REGEX = /((?het|homo)[a-z ]+)? (?deletion|duplication|duplicated)\s? ([a-z 0-9]+(?exon|exons)\s - (?[0-9]+((to|and|-|\s)+[0-9]+)?))| + (?[0-9]+((to|_|and|&|-|\s)+[0-9]+)?))| ((?het|homo)[a-z ]+)? - (?exon|exons|ex)\s?(?[0-9]+((to|and|-|\s)+[0-9]+)?) - ([a-z\s]+(?deletion|duplication|duplicated|del))?/ix + (?exon|exons|ex)\s?(?[0-9]+((to|_|and|&|-|\s)+[0-9]+)?) + ([a-z\s]+(?del(etion)?|duplicati?on|dup(licated)?))?/ix NORMAL_VAR_REGEX = %r{(?no|not)[a-z /]+ (?detect|report|detet|mutation)+}ix From 65c94c79f0132c43240c9540fe91f83780b15a29 Mon Sep 17 00:00:00 2001 From: shilpigoel Date: Tue, 18 Mar 2025 16:07:23 +0000 Subject: [PATCH 11/11] Removed brackets from protein capture in tests --- .../brca/providers/sheffield/sheffield_handler_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb b/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb index 905321c5..3b554f81 100644 --- a/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb +++ b/test/lib/import/brca/providers/sheffield/sheffield_handler_test.rb @@ -178,7 +178,7 @@ def setup assert_equal 2, genotypes[1].attribute_map['teststatus'] assert_equal 8, genotypes[1].attribute_map['gene'] assert_equal 'c.[7069_7070del]', genotypes[1].attribute_map['codingdnasequencechange'] - assert_equal 'p.[Leu2357fs]', genotypes[1].attribute_map['proteinimpact'] + assert_equal 'p.Leu2357fs', genotypes[1].attribute_map['proteinimpact'] end test 'normal_targeted' do @@ -222,7 +222,7 @@ def setup assert_equal 2, genotypes[0].attribute_map['teststatus'] assert_equal 7, genotypes[0].attribute_map['gene'] assert_nil genotypes[0].attribute_map['exonintroncodonnumber'] - assert_equal 'p.[Leu392fs]', genotypes[0].attribute_map['proteinimpact'] + assert_equal 'p.Leu392fs', genotypes[0].attribute_map['proteinimpact'] assert_equal 'c.', genotypes[0].attribute_map['codingdnasequencechange'] assert_equal 'Targeted BRCA mutation test', genotypes[0].attribute_map['genetictestscope'] end @@ -256,7 +256,7 @@ def setup assert_equal 8, genotypes[0].attribute_map['gene'] assert_equal 7, genotypes[1].attribute_map['gene'] assert_nil genotypes[0].attribute_map['exonintroncodonnumber'] - assert_equal 'p.[Gln2859fs]', genotypes[0].attribute_map['proteinimpact'] + assert_equal 'p.Gln2859fs', genotypes[0].attribute_map['proteinimpact'] assert_equal 'c.[8575del]', genotypes[0].attribute_map['codingdnasequencechange'] assert_equal 'Full screen BRCA1 and BRCA2', genotypes[0].attribute_map['genetictestscope'] assert_equal 'Full screen BRCA1 and BRCA2', genotypes[1].attribute_map['genetictestscope']