Skip to content

Commit

Permalink
Merge pull request #223 from andersen-lab/variant_threshold
Browse files Browse the repository at this point in the history
Variant threshold
  • Loading branch information
mariaelf97 authored Mar 18, 2024
2 parents 382931f + bedb5bb commit 2339e51
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions freyja/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,10 @@ def barcode_build(pb, outdir, noncl):
default='')
@click.option('--minq', help='Minimum base quality score',
default=20)
@click.option('--annot', help='AA annotation output', default='')
def variants(bamfile, ref, variants, depths, refname, minq, annot):
@click.option('--annot', help='provide an annotation file in gff3 format',
default='')
@click.option('--varthresh', help='Variant frequency threshold', default=0.0)
def variants(bamfile, ref, variants, depths, refname, minq, annot, varthresh):
"""
Perform variant calling using samtools and ivar
Expand All @@ -348,11 +350,13 @@ def variants(bamfile, ref, variants, depths, refname, minq, annot):
if len(refname) == 0:
bashCmd = f"samtools mpileup -aa -A -d 600000 -Q {minq} -q 0 -B -f "\
f"{ref} {bamfile} | tee >(cut -f1-4 > {depths}) |"\
f" ivar variants -p {variants} -q {minq} -t 0.0 -r {ref}"
f" ivar variants -p {variants} -q {minq} -t {varthresh}"\
f" -r {ref}"
else:
bashCmd = f"samtools mpileup -aa -A -d 600000 -Q {minq} -q 0 -B -f "\
f"{ref} {bamfile} -r {refname} | tee >(cut -f1-4 > {depths}"\
f") | ivar variants -p {variants} -q {minq} -t 0.0 -r {ref}"
f") | ivar variants -p {variants} -q {minq} -t {varthresh}"\
f" -r {ref}"
if len(annot) > 0:
print('Including annotation')
bashCmd = bashCmd + f" -g {annot}"
Expand Down

0 comments on commit 2339e51

Please sign in to comment.