From b4855c4fa499766b2b9e962f0a86377fb170c5f5 Mon Sep 17 00:00:00 2001 From: Jayoung Ryu Date: Wed, 24 Apr 2024 23:39:24 -0400 Subject: [PATCH] separate parser --- bean/annotate/utils.py | 21 +++++++++++++++++++++ bean/cli/execute.py | 2 +- bean/cli/get_splice_sites.py | 21 --------------------- docs/_filter.md | 5 ----- docs/_get_splice_sites.md | 5 +++++ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bean/annotate/utils.py b/bean/annotate/utils.py index ef0f45d..2ece30f 100755 --- a/bean/annotate/utils.py +++ b/bean/annotate/utils.py @@ -248,6 +248,27 @@ def get_splice_positions_from_gene_name( return cds_chrom, np.array(splice_donor_pos), np.array(splice_acceptor_pos) +def get_splice_parser(parser=None): + if parser is None: + parser = argparse.ArgumentParser( + "Get splice site position", + usage="Get splice site position from exon fasta and target editing base.", + ) + + parser.add_argument( + "exon_fa_path", help="File path to fasta file with exon position information." + ) + parser.add_argument( + "--gene-name", + action="store_true", + help="File path to fasta file with exon position information.", + ) + parser.add_argument("edited_base", help="Edited base, either A or C.") + parser.add_argument("output_path", help="output path of the splice site csv file.") + + return parser + + def parse_args(parser=None): if parser is None: parser = argparse.ArgumentParser( diff --git a/bean/cli/execute.py b/bean/cli/execute.py index 491d431..d9288d5 100755 --- a/bean/cli/execute.py +++ b/bean/cli/execute.py @@ -6,7 +6,7 @@ from bean.annotate.utils import parse_args as get_filter_parser from bean.model.parser import parse_args as get_run_parser from bean.framework.parser import get_input_parser as get_create_screen_parser -from bean.cli.get_splice_sites import get_parser as get_splice_site_parser +from bean.annotate.utils import get_splice_parser as get_splice_site_parser from bean.cli.count import main as count from bean.cli.count_samples import main as count_samples from bean.cli.profile import main as profile diff --git a/bean/cli/get_splice_sites.py b/bean/cli/get_splice_sites.py index 701e2fe..5690ac2 100644 --- a/bean/cli/get_splice_sites.py +++ b/bean/cli/get_splice_sites.py @@ -6,27 +6,6 @@ from bean.annotate.utils import get_splice_positions_from_gene_name -def get_parser(parser=None): - if parser is None: - parser = argparse.ArgumentParser( - "Get splice site position", - usage="Get splice site position from exon fasta and target editing base.", - ) - - parser.add_argument( - "exon_fa_path", help="File path to fasta file with exon position information." - ) - parser.add_argument( - "--gene-name", - action="store_true", - help="File path to fasta file with exon position information.", - ) - parser.add_argument("edited_base", help="Edited base, either A or C.") - parser.add_argument("output_path", help="output path of the splice site csv file.") - - return parser - - def get_splice_positions(exon_fa_path) -> Tuple[str, np.ndarray, np.ndarray]: splice_donor_pos = [] splice_acceptor_pos = [] diff --git a/docs/_filter.md b/docs/_filter.md index a11172c..cb4dd36 100755 --- a/docs/_filter.md +++ b/docs/_filter.md @@ -36,8 +36,3 @@ bean filter my_sorting_screen.h5ad \ 2. Feed `--translate-fastas-csv gene_exon_fas.csv` where `gene_exon_fas.csv` is the csv file with lines `gene_id,gene_exon_fasta_path` without header. Each FASTA file in `gene_exon_fasta_path` is formatted [as the single-gene FASTA file](https://github.com/pinellolab/crispr-bean/blob/main/docs/exon_fa_format.md). * Translation will keep the variants outside the coding sequence as nucleotide-level variants, while aggregating variants leading to the same coding sequence variants. -# Getting splice sites -We provide the utility script to obtain the splice sites if you use the MANE transcript with gene symbol (`--translate-gene-name GENE_SYMBOL` or `--translate-genes-list path_to_gene_names_file.txt`). -```bash -bean get-splice-sites LDLR A LDLR_splice_sites.csv --gene-name -``` \ No newline at end of file diff --git a/docs/_get_splice_sites.md b/docs/_get_splice_sites.md index e69de29..fb60239 100644 --- a/docs/_get_splice_sites.md +++ b/docs/_get_splice_sites.md @@ -0,0 +1,5 @@ +# Getting splice sites +We provide the utility script to obtain the splice sites if you use the MANE transcript with gene symbol (`--translate-gene-name GENE_SYMBOL` or `--translate-genes-list path_to_gene_names_file.txt`). +```bash +bean get-splice-sites LDLR A LDLR_splice_sites.csv --gene-name +``` \ No newline at end of file