-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Migrate to Typer for CLI (#22)
* feat: integrate typer * tests
- Loading branch information
Showing
21 changed files
with
194 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""Entry point for the command line interface.""" | ||
|
||
import typer | ||
from typing_extensions import Annotated | ||
|
||
from src.autoPVS1 import AutoPVS1 | ||
from src.genome_builds import GenomeRelease | ||
|
||
app = typer.Typer() | ||
|
||
#: Allowed genome releases | ||
ALLOWED_GENOME_RELEASES = ["GRCh37", "GRCh38", "hg19", "hg38", "grch37", "grch38"] | ||
#: Allowed sequence variant formats | ||
ALLOWED_SEQVAR_FORMATS = ["Canonical SPDI", "gnomAD", "relaxed SPDI", "dbSNP", "ClinVar"] | ||
|
||
|
||
@app.command() | ||
def classify( | ||
variant: Annotated[ | ||
str, | ||
typer.Argument( | ||
help=f"Variant to be classified, e.g., 'NM_000038.3:c.797G>A'. Accepted formats: {', '.join(ALLOWED_SEQVAR_FORMATS)}" | ||
), | ||
], | ||
genome_release: Annotated[ | ||
str, | ||
typer.Option( | ||
"--genome-release", | ||
"-g", | ||
help=f"Accepted genome Releases: {', '.join(ALLOWED_GENOME_RELEASES)}", | ||
), | ||
] = "GRCh38", | ||
): | ||
""" | ||
Classify a variant using the specified genome release. | ||
""" | ||
try: | ||
genome_release_enum = GenomeRelease.from_string(genome_release) | ||
if not genome_release_enum: | ||
raise ValueError( | ||
f"Invalid genome release: {genome_release}. Please use one of {', '.join(ALLOWED_GENOME_RELEASES)}." | ||
) | ||
|
||
auto_pvs1 = AutoPVS1(variant, genome_release_enum) | ||
auto_pvs1.predict() | ||
except Exception as e: | ||
typer.secho(f"Error: {e}", err=True, fg=typer.colors.RED) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.