Skip to content

Commit

Permalink
Merge pull request #155 from pinin4fjords/parameterise_coverage
Browse files Browse the repository at this point in the history
Add new meta_min_reads CLI param
  • Loading branch information
saketkc committed Mar 22, 2024
2 parents 34bcf7f + ea0e4d2 commit 23d6188
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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

0 comments on commit 23d6188

Please sign in to comment.