Skip to content

Commit

Permalink
introduced -q arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-fuchs committed Dec 1, 2023
1 parent 46155fa commit 3c430df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion bamdash/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def get_args(sysargs):
metavar=" ",
help="seq reference id"
)
parser.add_argument(
"-q",
"--quality-threshold",
type=int,
default=15,
metavar="15",
help="qaulity threshold for reads"
)
parser.add_argument(
"-bs",
"--binsize",
Expand Down Expand Up @@ -121,7 +129,7 @@ def main(sysargs=sys.argv[1:]):
args = get_args(sysargs)

# define subplot number, track heights and parse data
coverage_df, title = data.bam_to_coverage_df(args.bam, args.reference, args.coverage)
coverage_df, title = data.bam_to_coverage_df(args.bam, args.reference, args.coverage, args.quality_threshold)
track_heights = [1]
track_data = []
# extract data and check if ref was found
Expand Down
4 changes: 2 additions & 2 deletions bamdash/scripts/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def make_title_string(parsed_bam, coverage_df, reference, min_cov):
return stat_string


def bam_to_coverage_df(bam_file, ref, min_cov):
def bam_to_coverage_df(bam_file, ref, min_cov, quality_thres):
"""
:param bam_file: bam location
:param ref: chrom identifier
Expand All @@ -75,7 +75,7 @@ def bam_to_coverage_df(bam_file, ref, min_cov):

coverage, position = [], []
# count coverage at each pos
coverage_base = bam.count_coverage(ref)
coverage_base = bam.count_coverage(ref, quality_threshold=quality_thres)
# extract overall coverage and pos
for index, [A_count, C_count, G_count, T_count] in enumerate(
zip(coverage_base[0], coverage_base[1], coverage_base[2], coverage_base[3])):
Expand Down

0 comments on commit 3c430df

Please sign in to comment.