-
Notifications
You must be signed in to change notification settings - Fork 2
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
Expose generate_alignment + generate_hgvs_variants_from_alignment functions #18
Conversation
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo, provides → provide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean flags for strategies are not my favorite, could a separate method make a better API? Or perhaps allow the strategy to be passed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is existing functionality that is just getting moved so it would be a breaking change to get rid of the flag. Don't think it's worth doing right now, but I am open to a change in a follow up PR if you feel its important. Personally I find the ergonomics of passing a boolean to be a bit better then some string that represents the "method" you want (we'd likely want some kind of constant / enum, etc). If there were a bunch of methods it would make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few notes on doc-strings and tests that should not have been moved. If you could also get tests added for the new generate_hgvs_variants_from_alignment
and populate the PR description with a bit more info, that would be great. Thanks for this!
palamedes/__init__.py
Outdated
""" | ||
Given a pairwise alignment object and a molecule type, generate a list of HGVS SequenceVariants. | ||
|
||
- Alignment: Generated via BioPython.PairwiseAligner - (`generate_alignment` for more information) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"See generate_alignemt
for more information"
palamedes/__init__.py
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you trim this excess white space?
def generate_hgvs_variants_from_alignment( | ||
alignment: Alignment, use_non_standard_substitution_rules: bool = False, molecule_type: str = MOLECULE_TYPE_PROTEIN | ||
) -> list[SequenceVariant]: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding some examples here using the follow format might be nice for the API docs:
.. code-block:: python
>>> from palamedes import generate_hgvs_variants
>>> generate_hgvs_variants("PFKISIHL", "TPFKISIH")
[
SequenceVariant(ac=ref, type=p, posedit=Pro1extThr-1, gene=None),
SequenceVariant(ac=ref, type=p, posedit=Leu8del, gene=None),
]
This is from the doc string for generate_hgvs_variants
molecule_type: str = MOLECULE_TYPE_PROTEIN, | ||
aligner: PairwiseAligner | None = None, | ||
) -> Alignment: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is public now, can you add some code example to the doc string, using the same block as above?
raise NotImplementedError( | ||
f"Type {molecule_type} unsupported or unrecognized! Current supported types: {','.join(BUILDER_CONFIG.keys())}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making this error message better!
palamedes/test_palamedes.py
Outdated
@@ -0,0 +1,216 @@ | |||
from palamedes import generate_variant_blocks, generate_alignment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate_variant_blocks
is still defined in align.py
, so the tests for it should stay in there. Only generate_alignment
was moved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Description
As part of the alignment work, we are exposing some additional functions that can be used externally.
Also, as part of this PR
Relevant Links
N/A
Screenshots & Media
N/A
Testing
Code Flow
N/A
Edge cases / Breaking Changes / Known Issues
N/A