Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions lib/import/brca/providers/newcastle/newcastle_handler.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'possibly'
# require 'import/brca/providers/newcastle/newcastle_storage_manager'

module Import
module Brca
Expand Down Expand Up @@ -208,14 +207,6 @@ def no_scope?(genotype)
genotype.attribute_map['genetictestscope'].scan(/Unable/i).size.positive?
end

def positive_cdna?(variant)
variant.scan(CDNA_REGEX).size.positive?
end

def positive_exonvariant?(variant)
variant.scan(EXON_VARIANT_REGEX).size.positive?
end

def pathogenic?(record)
varpathclass = record.raw_fields['variantpathclass']&.downcase
if (NON_PATHEGENIC_CODES.exclude? varpathclass) \
Expand Down
12 changes: 6 additions & 6 deletions lib/import/helpers/brca/providers/rtd/rtd_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ module RtdConstants
[0-9]+[+>_-][0-9]+[+>_-][0-9]+[ACGTdelinsup]+|
[0-9]+.[0-9]+[a-z]+>[a-z]+)\s?/ix

EXON_VARIANT_REGEX = /(?<variant>del|dup|ins).+ex(on)?s?\s?
(?<exons>[0-9]+((to|and|-|\s)+[0-9]+)?)|
ex(on)?s?\s?(?<exons>[0-9]+((to|and|-|\s)+[0-9]+)?)\s?
(?<variant>del|dup|ins)?|
x(?<exons>[0-9+-? ]+)+(?<variant>del|dup|ins)|
^(?<variant>del|dup|ins)\s?(?<exons>[0-9]+((to|and|-|\s)+[0-9]+)?)
EXON_VARIANT_REGEX = /(?<variant>del|dup|ins).+ex(on)?s?\s?(?<exons>[0-9ACGT]+((to|and|-|\s)+[0-9ACGT]+)?)|
(?<exons>ex(on)?s?\s?[0-9ACGT]+(to|and|-|\s)?ex(on)?s?[0-9ACGT]+)\s*(?<variant>del|dup|ins)|
ex(on)?s?\s?(?<exons>[0-9ACGT]+((to|and|-|\s)+[0-9ACGT]+)?)\s?(?<variant>del|dup|ins)?|
(?<exons>x(on)?s?\s?[0-9ACGT]+(to|and|-|\s)?x(on)?s?[0-9ACGT]+)\s*(?<variant>del|dup|ins)|
x(?<exons>[0-9+-? ACGT]+)+(?<variant>del|dup|ins)|
^(?<variant>del|dup|ins)\s?(?<exons>[0-9]+((to|and|-|\s)+[0-9ACGT]+)?)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, i'm just wondering whether it is worth expanding to account for the potential of there being a ' ' before the del/dup when it is in the x1-x2.. / ex1-ex2... format? Currently it would only match the full variant(both if e.g. 'x14-x20del' rather than "x14-x20 del"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NImeson , have adjusted the regex to handle if there is space or no space. Added test too to show its working. All under commit [6f01e8c]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, all looks good to me then :)

/ix
# rubocop:enable Lint/MixedRegexpCaptureTypes
end
Expand Down
14 changes: 14 additions & 0 deletions test/lib/import/brca/providers/newcastle/newcastle_handler_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,20 @@ def setup
assert_equal '2-24', genotypes[0].attribute_map['exonintroncodonnumber']
assert_equal 1, genotypes[0].attribute_map['variantlocation']
assert_equal 7, genotypes[0].attribute_map['gene']
exonic_var_rec.raw_fields['genotype'] = 'exon13A-13C dup'
genotypes = @handler.process_variant_records(@genotype, exonic_var_rec)
assert_equal '13a-13c', genotypes[0].attribute_map['exonintroncodonnumber']
exonic_var_rec.raw_fields['genotype'] = 'x14-x20del'
genotypes = @handler.process_variant_records(@genotype, exonic_var_rec)
assert_equal 'x14-x20', genotypes[0].attribute_map['exonintroncodonnumber']
exonic_var_rec.raw_fields['genotype'] = 'ex14-ex20del'
genotypes = @handler.process_variant_records(@genotype, exonic_var_rec)
assert_equal 'ex14-ex20', genotypes[0].attribute_map['exonintroncodonnumber']
assert_equal 3, genotypes[0].attribute_map['sequencevarianttype']
exonic_var_rec.raw_fields['genotype'] = 'ex14-ex20 dup'
genotypes = @handler.process_variant_records(@genotype, exonic_var_rec)
assert_equal 'ex14-ex20', genotypes[0].attribute_map['exonintroncodonnumber']
assert_equal 4, genotypes[0].attribute_map['sequencevarianttype']
end

private
Expand Down
Loading