Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/36796/salisbury new rules #127

Merged
merged 8 commits into from
Nov 27, 2024

Conversation

shilpigoeldev
Copy link
Contributor

What?

Need to update the Salisbury importer code to reflect the new rules to resolve JIRA-2029

Why?

Salisbury has got new gene panels for rules have been added and updated. We also have to accommodate old row level data so whole importer has to be written new way.

How?

We have grouped the Salisbury records for same SRI and treated them row level, panel level or hybrid level as per the rules.

Testing?

Tests have been added and Nichola has signed off QA as the counts match.

process_variants(genotype, variant) if positive_record?(genotype) && variant.present?
genotypes.append(genotype) unless test_string.scan(CONFIRM_SEQ_NGS).size.positive? && gene.blank?
def extract_gene_row(genotype, record)
gene = extract_genes(%w[test genotype moleculartestingtype], record)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is moleculartestingtype being used as well here? I can't see it in the rules but please show it to me if I have missed something!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is to capture those recordsin the 'PALB2 data only' and equivalent testing type, Shilpi found they don't always specify PALB2 in the two other fields.

if [2, 10].include? status
assign_variantpathclass_record(genotype_new)
variant = record['genotype']
process_variants(genotype_new, variant) if positive_record?(genotype_new) && variant.present?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need "if positive_record?" if its in the loop only including statuses 2 and 10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No you're right..not needed..removed in latest commit

if [2, 10].include? status
assign_variantpathclass_record(genotype_new)
variant = record['genotype']
process_variants(genotype_new, variant) if positive_record?(genotype_new) && variant.present?
Copy link
Collaborator

@NImeson NImeson Nov 13, 2024

Choose a reason for hiding this comment

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

Do we need to use 'if positive_record' here? Does that mean we are missing out on capturing variants with test status of 10?

Copy link
Collaborator

@lauramccluskey1 lauramccluskey1 Nov 13, 2024

Choose a reason for hiding this comment

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

If you look at "positive record?" (line 263) it includes those with test status 10 - so maybe the name just needs to be changed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I accidentally looked at the method removed instead of the new one. Same comment as Laura's then :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the method in latest commit.

if [2, 10].include? status
assign_variantpathclass_record(genotype_new)
variant = record['genotype']
process_variants(genotype_new, variant) if positive_record?(genotype_new) && variant.present?
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you know you are matching the variant with the correct gene here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its now fixed in latest commit.

genotype_dup = genotype_new.dup
gene = var&.scan(BRCA_REGEX)&.flatten&.uniq
if gene.present?
genotype_dup.add_gene(gene[0])
Copy link
Collaborator

@NImeson NImeson Nov 20, 2024

Choose a reason for hiding this comment

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

Do we need to try and ensure we keep the structure of the database if there happened to be two variants in the same gene written e.g. "BRCA1 c123A>C; BRCA1 c456G>A"? - this would ideally need to create one record in genetic_test_results which two child records in genetic_sequence_variants, rather than two BRCA1 records

As discussed, this might be a wider problem in the importers?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Happy with this after investigations into persister functioning

NImeson
NImeson previously approved these changes Nov 20, 2024
Copy link
Collaborator

@NImeson NImeson left a comment

Choose a reason for hiding this comment

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

Looks good :-)

@shilpigoeldev
Copy link
Contributor Author

shilpigoeldev commented Nov 21, 2024 via email

assign_variantpathclass_record(genotype_new)
variant = record['genotype']
if variant.present?
if variant.scan(CDNA_REGEX).size > 1 ||
Copy link
Collaborator

@lauramccluskey1 lauramccluskey1 Nov 21, 2024

Choose a reason for hiding this comment

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

does this need to be if (variant.scan(CDNA_REGEX).size + variant.scan(EXON_VARIANT_REGEX).size) >1

Copy link
Contributor Author

@shilpigoeldev shilpigoeldev Nov 21, 2024

Choose a reason for hiding this comment

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

Yes @lauramccluskey1 good point, have now fixed it in 9f1ea0e

end

def handle_variant_record(genotype_new, record, genotypes)
assign_variantpathclass_record(genotype_new)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How can the variantpathclass be handled before assigning the variant? What happens in the case of multiple variants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @lauramccluskey1 , As per rules variantpathclass is assigned based on 'status' of record and not variant. For multivariants we will be duplicating genotype object and each having variantpathclass depending on status of raw_record and then capturing the variant present in it. Also to note this method gets called only for teststatus 2 and 10 records.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lauramccluskey1 @NImeson committed updated rule as discussed in d5f8aa5, Thanks ☺️

Copy link
Collaborator

@NImeson NImeson Nov 25, 2024

Choose a reason for hiding this comment

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

Fix looks fine :-)

Copy link
Collaborator

@NImeson NImeson left a comment

Choose a reason for hiding this comment

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

Happy with recent changes

@lauramccluskey1
Copy link
Collaborator

Thanks for making the changes- all looks good to me now

@shilpigoeldev shilpigoeldev merged commit 193d41d into develop Nov 27, 2024
11 of 13 checks passed
@shilpigoeldev shilpigoeldev deleted the feature/36796/Salisbury_new_rules branch November 27, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants