Addition of indel retrieval#289
Conversation
| def __init__(self, *args, **kwargs): | ||
| super(StaticSource, self).__init__(*args, **kwargs) | ||
|
|
||
| def _protein_variant_parser(mutation, sequence, source): |
There was a problem hiding this comment.
I'm not sure I love having this function floating around - it breaks the consistency of the API for how we've developed it so far
so I propose this: we can have a DynamicMutationSource class that inherits from DynamicSource and defines this function as a class member, and then classes that need to use it have DynamicMutationSource as a base class
| super(StaticSource, self).__init__(*args, **kwargs) | ||
|
|
||
| def _protein_variant_parser(mutation, sequence, source): | ||
|
|
There was a problem hiding this comment.
given these definitions, would it possible for a variant to match more than one case for the same variant?
I was wondering if the order in which the variants are checked have any influence on their final classification
one idea could be to match all of them first and check if 2+ of them match. But then this is only necessary if we think it is possible that 2 or more can match
There was a problem hiding this comment.
In theory, with the current fullmatch-based patterns, the variant classes should be mutually exclusive.
|
|
||
| raise ValueError(f"Unsupported protein mutation format: {mutation}") | ||
|
|
||
| def _normalise_variant_types(variant_types): |
There was a problem hiding this comment.
same as previous re the location of this function
|
|
||
| raise ValueError(f"Unsupported protein mutation format: {mutation}") | ||
|
|
||
| def _normalise_variant_types(variant_types): |
There was a problem hiding this comment.
can we change the name?
I don't think this function normalizes things - it just removes duplicates
| if invalid_variant_types: | ||
| raise ValueError(f"Invalid variant type(s): {invalid_variant_types}") | ||
|
|
||
| return variant_types |
There was a problem hiding this comment.
is returning a set here intentional?
| supported_genomic_annotation = (gm.is_snv | ||
| or gm.is_insdel | ||
| or gm.is_inversion | ||
| or gm.is_deletion | ||
| or gm.is_insertion | ||
| or gm.is_duplication | ||
| or gm.is_repeat) |
There was a problem hiding this comment.
a reason more we should think about a refactoring of metadata.GenomicMutation - it was ok when we were supporting 1/2 types but it's not very robust as it is
| or gm.is_duplication | ||
| or gm.is_repeat) | ||
|
|
||
| if gm.chr is None or not supported_genomic_annotation: |
There was a problem hiding this comment.
do we really get a None chromosome?
| out_metadata["genomic_coordinates"].append([[gm.genome_build, | ||
| gm.chr, | ||
| gm.coord if gm.is_snv else gm.coord_start, | ||
| gm.coord if gm.is_snv else gm.coord_end, | ||
| gm.ref if gm.is_snv else None] | ||
| for gm in valid_gms]) |
| this_df = data[data['edited_variant_id'] == v_str] | ||
|
|
||
| elif variant.is_insertion: | ||
| v_str = variant.definition |
There was a problem hiding this comment.
should we not specialize GenomicVariant.get_value_str() to return a format that makes sense to use for gnomad instead of doing all of the following?
| def __hash__(self): | ||
| return hash((self.source, self.chr, self.coord_start, self.coord_end, self.ref, self.genome_build)) | ||
|
|
||
| class GenomicMutation(Metadata): |
There was a problem hiding this comment.
again - this is a bit convoluted as it is; let's give a thought if a refactoring would be better
|
This PR addresses #280, adding support for retrieving and annotating in-frame indels in cancermuts.
Main changes
variant_typesargument so users can request"missense","deletion","insertion"and/or"delins"variants.tutorial_indels.pyusing RAD51C as an example.Notes
aa_position,ref_aaandalt_aacan be harder to interpret