Skip to content

Allow pre-map variant only#17

Closed
sallybg wants to merge 4 commits intodevfrom
allow-pre-map-only
Closed

Allow pre-map variant only#17
sallybg wants to merge 4 commits intodevfrom
allow-pre-map-only

Conversation

@sallybg
Copy link
Copy Markdown
Collaborator

@sallybg sallybg commented Aug 7, 2024

Allow pre-map genomic variant without corresponding post-map genomic variant.

Currently, the only case where this will occur is when the variant falls
outside of the region of the target sequence that aligns to the genomic
reference sequence. Post-map protein variants are still required to
output the corresponding pre-map protein variant, because we don't
expect a protein variant to fall outside the region of the target
sequence that aligns to the reference transcript, although
this assumption should be evaluated as a separate issue.

sallybg added 4 commits August 1, 2024 14:26
Remove cli boolean flag that allowed for inclusion of v2 in addition to v1.3
…variant

Currently, the only case where this will occur is when the variant falls
outside of the region of the target sequence that aligns to the genomic
reference sequence. Post-map protein variants are still required to
output the corresponding pre-map protein variant, because we don't
expect a protein variant to fall outside the region of the target
sequence that aligns to the reference transcript, although
this assumption should be evaluated as a separate issue.
@sallybg
Copy link
Copy Markdown
Collaborator Author

sallybg commented Aug 7, 2024

Marking this as draft because this branch is based on the previous PR #15, which I'll want to merge into dev before this one.

@sallybg sallybg requested review from bencap and jstone-dev August 7, 2024 22:20
@sallybg sallybg changed the base branch from dev to improve-vrs-2-output August 9, 2024 17:14
Comment on lines +261 to +262
if accession is None:
raise ValueError
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we add a message to these raised ValueErrors? Even if we don't expect them to occur the message offers the same thing as a comment but with useful output if it does ever end up popping up for a user.

Comment on lines +266 to +267
if tx_results is None:
raise ValueError # impossible by definition
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we add a message to these raised ValueErrors? Even if we don't expect them to occur the message offers the same thing as a comment but with useful output if it does ever end up popping up for a user.

Same as above

for allele in post_mapped.members:
loc = allele.location
sequence_id = f"ga4gh:{loc.sequenceReference.refgetAccession}"
ref = sr.get_sequence(sequence_id, loc.start, loc.end) # TODO type issues??
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this TODO still relevant?

False,
)
else:
# TODO add error to MappedScore
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commenting so this TODO isn't lost, but I know this is still a draft PR.

# TODO add error to MappedScore
post_mapped_genomic = None

if pre_mapped_genomic:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similar to a few comments above. We know whether pre_mapped_genomic is defined on line 394, so we should be able to check if it is None and return immediately. Here I'm less inclined to leave as is for readability reasons because of the addition of the if/else block above this one.

So our flow could look something like:

pre_mapped_genomic = _construct_vrs_allele

if pre_mapped_genomic is None:
      return None

try to do post mapped genomic
return the mapped score

)

if pre_mapped_protein and post_mapped_protein:
if pre_mapped_protein:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We know this on 344, so we could just check pre_mapped_protein right after constructing it and return None without attempting to build the post mapped protein that we won't need. (I'm sort of sympathetic to the argument the code looks nicer the way it is though).

pre_mapped_protein = _construct_vrs_allele

if pre_mapped_protein is None:
      return None

post_mapped_protein = _construct_vrs_allele
return mapped score

@sallybg sallybg force-pushed the improve-vrs-2-output branch from 6a499fc to 8b2b75e Compare August 14, 2024 18:32
Base automatically changed from improve-vrs-2-output to dev August 14, 2024 18:35
@bencap bencap linked an issue Aug 19, 2024 that may be closed by this pull request
@bencap
Copy link
Copy Markdown
Collaborator

bencap commented Sep 13, 2024

Closing in favor of #20.

@bencap bencap closed this Sep 13, 2024
@bencap bencap deleted the allow-pre-map-only branch September 13, 2024 22:21
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.

2 participants