Skip to content
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

Add new meta_min_reads CLI param #155

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ribotricer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ def prepare_orfs_cmd(
help=("Whether output all ORFs including those " "non-translating ones"),
is_flag=True,
)
@click.option(
"--meta-min-reads",
type=int,
default=META_MIN_READS,
show_default=True,
help="Minimum number of reads for a read length to be considered",
)
def detect_orfs_cmd(
bam,
ribotricer_index,
Expand All @@ -210,6 +217,7 @@ def detect_orfs_cmd(
min_valid_codons_ratio,
min_read_density,
report_all,
meta_min_reads,
):
if not os.path.isfile(bam):
sys.exit("Error: BAM file not found")
Expand Down
2 changes: 2 additions & 0 deletions ribotricer/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
# Minimum read density over ORF
# defined as the number of reads per unit length of the ORF
MINIMUM_DENSITY_OVER_ORF = 0.0
# Minimum number of reads for a read length to be considered
META_MIN_READS=100000
5 changes: 4 additions & 1 deletion ribotricer/detect_orfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ def detect_orfs(
min_valid_codons_ratio,
min_density_over_orf,
report_all,
meta_min_reads=100000,
):
"""
Parameters
Expand Down Expand Up @@ -371,6 +372,8 @@ def detect_orfs(
report_all: bool
Whether to output all ORFs' scores regardless of translation
status
meta_min_reads: int
minimum number of reads for a read length to be considered. Passed to metagene_coverage().
"""
now = datetime.datetime.now()
print(now.strftime("%b %d %H:%M:%S ..... started ribotricer detect-orfs"))
Expand Down Expand Up @@ -416,7 +419,7 @@ def detect_orfs(
"started calculating metagene profiles. This may take a long time...",
)
)
metagenes = metagene_coverage(annotated, alignments, read_length_counts, prefix)
metagenes = metagene_coverage(annotated, alignments, read_length_counts, prefix, meta_min_reads = meta_min_reads)

# plot metagene profiles
now = datetime.datetime.now()
Expand Down