Skip to content

Commit 4bb30d8

Browse files
committed
more rubocop fixes
1 parent 800cdc6 commit 4bb30d8

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

lib/import/colorectal/providers/leeds/leeds_handler_new_colorectal.rb

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ def process_result_variant_rec(genocolorectal, record, genotypes)
206206
end
207207
return if @pos_gene.blank?
208208

209-
@cdna_mutations = @result&.match(CDNA_REGEX)
210-
@exonic_mutations = @result&.match(EXON_VARIANT_REGEX)
211-
@protein_impact = @result&.match(PROTEIN_REGEX)
212-
209+
extract_mutations_from_src(@result)
213210
process_variant_rec(genocolorectal, teststatus, record, genotypes)
214211
end
215212

@@ -221,20 +218,22 @@ def process_protein_impact_variant_rec(genocolorectal, record, genotypes)
221218
gene = @value1&.scan(COLORECTAL_GENES_REGEX)
222219
@pos_gene = gene.flatten.uniq
223220
@pos_gene = ['PMS2'] if @value1 =~ /NM_000535.5/
224-
teststatus = case @value1
225-
when /C1/, /C2/
226-
10
227-
else
228-
2
229-
end
230221
return if @pos_gene.blank?
231222

232-
@cdna_mutations = @value1&.match(CDNA_REGEX)
233-
@exonic_mutations = @value1&.match(EXON_VARIANT_REGEX)
234-
@protein_impact = @value1&.match(PROTEIN_REGEX)
223+
teststatus = determine_protein_impact_test_status
224+
extract_mutations_from_src(@value1)
235225
process_variant_rec(genocolorectal, teststatus, record, genotypes)
236226
end
237227

228+
def determine_protein_impact_test_status
229+
case @value1
230+
when /C1/, /C2/
231+
10
232+
else
233+
2
234+
end
235+
end
236+
238237
def gene_variant_rec?(genocolorectal, record, genotypes)
239238
return false if @value2.nil?
240239

@@ -269,9 +268,7 @@ def first_of_report_variant_rec?(genocolorectal, record, genotypes)
269268

270269
@pos_gene = [$LAST_MATCH_INFO[:colorectal]]
271270
if @pos_gene.present?
272-
@cdna_mutations = @report&.match(CDNA_REGEX)
273-
@exonic_mutations = @report&.match(EXON_VARIANT_REGEX)
274-
@protein_impact = @report&.match(PROTEIN_REGEX)
271+
extract_mutations_from_src(@report)
275272
process_variant_rec(genocolorectal, 2, record, genotypes)
276273
negative_genes = @genes_panel - @pos_gene
277274
process_status_genes(1, negative_genes, genocolorectal, genotypes)
@@ -405,6 +402,12 @@ def result_variant_absent_targ_rec?(genotype, genotypes)
405402
true
406403
end
407404

405+
def extract_mutations_from_src(src)
406+
@cdna_mutations = src&.match(CDNA_REGEX)
407+
@exonic_mutations = src&.match(EXON_VARIANT_REGEX)
408+
@protein_impact = src&.match(PROTEIN_REGEX)
409+
end
410+
408411
def add_geneticinheritance(genocolorectal)
409412
geneticinheritance = if @value12 =~ /mosaic/i ||
410413
@result =~ /VAF/ || @result =~ /dosage ~0\./

0 commit comments

Comments
 (0)