From d933f122f433228a9639b276b7cf171ae3bbb0e9 Mon Sep 17 00:00:00 2001 From: Nichola Imeson Date: Mon, 30 Sep 2024 13:31:21 +0100 Subject: [PATCH 1/5] added in teststatus 10 logic --- .../royal_marsden/royal_marsden_handler_colorectal.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb index 79a9fd41..d45b1193 100644 --- a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb +++ b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb @@ -103,9 +103,10 @@ def process_varpathclass(genocolorectal, record) def process_teststatus(genocolorectal, record) teststatus = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? if /NO PATHOGENIC (VARIANT|DEL\/DUP) IDENTIFIED/.match(teststatus) || - /non-pathogenic variant detected/.match(teststatus) || /No mutation detected/.match(teststatus) genocolorectal.add_status(1) + elsif /non-pathogenic variant detected/.match(teststatus) + genocolorectal.add_status(10) elsif /Fail/i.match(teststatus) genocolorectal.add_status(9) elsif /c\..+/.match(teststatus) || From 3397182c51b0de6d1bc23f1f94ebc7d330952296 Mon Sep 17 00:00:00 2001 From: Nichola Imeson Date: Mon, 30 Sep 2024 14:51:07 +0100 Subject: [PATCH 2/5] refactored method into case-when statement --- .../royal_marsden_handler_colorectal.rb | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb index d45b1193..0f334edb 100644 --- a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb +++ b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb @@ -100,24 +100,43 @@ def process_varpathclass(genocolorectal, record) end end + # def process_teststatus(genocolorectal, record) + # teststatus = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? + # if /NO PATHOGENIC (VARIANT|DEL\/DUP) IDENTIFIED/.match(teststatus) || + # /No mutation detected/.match(teststatus) + # genocolorectal.add_status(1) + # elsif /non-pathogenic variant detected/.match(teststatus) + # genocolorectal.add_status(10) + # genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. + # elsif /Fail/i.match(teststatus) + # genocolorectal.add_status(9) + # elsif /c\..+/.match(teststatus) || + # /Deletion*/.match(teststatus) || + # /Duplication*/.match(teststatus) || + # /Exon*/i.match(teststatus) + # genocolorectal.add_status(2) + # else + # @logger.debug 'UNABLE TO DETERMINE TESTSTATUS' + # end + # end + def process_teststatus(genocolorectal, record) teststatus = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? - if /NO PATHOGENIC (VARIANT|DEL\/DUP) IDENTIFIED/.match(teststatus) || - /No mutation detected/.match(teststatus) + case teststatus + when /NO PATHOGENIC (VARIANT|DEL\/DUP) IDENTIFIED/ || /No mutation detected/ genocolorectal.add_status(1) - elsif /non-pathogenic variant detected/.match(teststatus) + when /non-pathogenic variant detected/ genocolorectal.add_status(10) - elsif /Fail/i.match(teststatus) + genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. + when /Fail/i genocolorectal.add_status(9) - elsif /c\..+/.match(teststatus) || - /Deletion*/.match(teststatus) || - /Duplication*/.match(teststatus) || - /Exon*/i.match(teststatus) - genocolorectal.add_status(2) - else + when /c\..+/ || /Deletion*/ || /Duplication*/ || /Exon*/i + genocolorectal.add_status(2) + else @logger.debug 'UNABLE TO DETERMINE TESTSTATUS' end - end + end + def process_variant(genocolorectal, record) variant = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? From 66a4674e0ed6490ad5d18f91206f87fd63579b1d Mon Sep 17 00:00:00 2001 From: Nichola Imeson Date: Mon, 30 Sep 2024 15:29:45 +0100 Subject: [PATCH 3/5] removed old method - commented out --- .../royal_marsden_handler_colorectal.rb | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb index 0f334edb..bdcab2a3 100644 --- a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb +++ b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb @@ -100,26 +100,6 @@ def process_varpathclass(genocolorectal, record) end end - # def process_teststatus(genocolorectal, record) - # teststatus = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? - # if /NO PATHOGENIC (VARIANT|DEL\/DUP) IDENTIFIED/.match(teststatus) || - # /No mutation detected/.match(teststatus) - # genocolorectal.add_status(1) - # elsif /non-pathogenic variant detected/.match(teststatus) - # genocolorectal.add_status(10) - # genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. - # elsif /Fail/i.match(teststatus) - # genocolorectal.add_status(9) - # elsif /c\..+/.match(teststatus) || - # /Deletion*/.match(teststatus) || - # /Duplication*/.match(teststatus) || - # /Exon*/i.match(teststatus) - # genocolorectal.add_status(2) - # else - # @logger.debug 'UNABLE TO DETERMINE TESTSTATUS' - # end - # end - def process_teststatus(genocolorectal, record) teststatus = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? case teststatus From 3fbe98b745d8989222cd3f79552c242d44629dbe Mon Sep 17 00:00:00 2001 From: Nichola Imeson Date: Mon, 4 Nov 2024 15:18:13 +0000 Subject: [PATCH 4/5] moved varpathclass 6 assignment into process_varpathclass method --- .../royal_marsden/royal_marsden_handler_colorectal.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb index bdcab2a3..fa175961 100644 --- a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb +++ b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb @@ -95,6 +95,9 @@ def process_varpathclass(genocolorectal, record) if !varpathclass.nil? && !varpathclass.empty? && VARIANT_PATH_CLASS_COLO[varpathclass] genocolorectal.add_variant_class(VARIANT_PATH_CLASS_COLO[varpathclass.downcase]) + elsif varpathclass.nil? && varpathclass.empty? + && record.raw_fields['teststatus'].match(/non-pathogenic variant detected/) + genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. else @logger.debug 'NO VARIANTPATHCLASS DETECTED' end @@ -107,7 +110,6 @@ def process_teststatus(genocolorectal, record) genocolorectal.add_status(1) when /non-pathogenic variant detected/ genocolorectal.add_status(10) - genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. when /Fail/i genocolorectal.add_status(9) when /c\..+/ || /Deletion*/ || /Duplication*/ || /Exon*/i From f44d805978ba61661f907ab1d8614566b3cc290d Mon Sep 17 00:00:00 2001 From: Nichola Imeson Date: Thu, 7 Nov 2024 16:11:01 +0000 Subject: [PATCH 5/5] Separated varpath class and test sttaus 10 assignment --- .../royal_marsden_handler_colorectal.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb index fa175961..0cf0406b 100644 --- a/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb +++ b/lib/import/colorectal/providers/royal_marsden/royal_marsden_handler_colorectal.rb @@ -95,20 +95,24 @@ def process_varpathclass(genocolorectal, record) if !varpathclass.nil? && !varpathclass.empty? && VARIANT_PATH_CLASS_COLO[varpathclass] genocolorectal.add_variant_class(VARIANT_PATH_CLASS_COLO[varpathclass.downcase]) - elsif varpathclass.nil? && varpathclass.empty? - && record.raw_fields['teststatus'].match(/non-pathogenic variant detected/) - genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. else @logger.debug 'NO VARIANTPATHCLASS DETECTED' + check_for_non_path_variant(genocolorectal, record) end end + def check_for_non_path_variant(genocolorectal, record) + if /non-pathogenic\svariant\sdetected/i.match(record.raw_fields['teststatus']) + genocolorectal.add_variant_class(6) #Ad-hoc variant path class for when we know it is class1/2 but can't distinguish. + end + end + def process_teststatus(genocolorectal, record) teststatus = record.raw_fields['teststatus'] unless record.raw_fields['teststatus'].nil? case teststatus when /NO PATHOGENIC (VARIANT|DEL\/DUP) IDENTIFIED/ || /No mutation detected/ genocolorectal.add_status(1) - when /non-pathogenic variant detected/ + when /non-pathogenic\svariant\sdetected/i genocolorectal.add_status(10) when /Fail/i genocolorectal.add_status(9)