Skip to content

Commit

Permalink
fix for no bam
Browse files Browse the repository at this point in the history
  • Loading branch information
jodyphelan committed Apr 15, 2024
1 parent 55d416b commit 92a12bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tbprofiler/phylo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ def prepare_sample_consensus(sample: str,input_vcf: str,args: argparse.Namespace
mask_bed = f"{args.files_prefix}.{s}.mask.bed"
if hasattr(args,'supplementary_bam') and args.supplementary_bam:
args.bam = args.supplementary_bam
generate_low_dp_mask(f"{args.bam}",args.conf['ref'],mask_bed)
run_cmd(f"bcftools consensus --sample {s} -m {mask_bed} -M N -f {args.conf['ref']} {tmp_vcf} | sed 's/>/>{s} /' > {args.files_prefix}.{s}.consensus.fa")
if args.bam:
generate_low_dp_mask(f"{args.bam}",args.conf['ref'],mask_bed)
mask_cmd = f"-m {mask_bed} -M N"
else:
mask_cmd = ""
run_cmd(f"bcftools consensus --sample {s} {mask_cmd} -f {args.conf['ref']} {tmp_vcf} | sed 's/>/>{s} /' > {args.files_prefix}.{s}.consensus.fa")
return f"{args.files_prefix}.{s}.consensus.fa"

def get_consensus_vcf(sample: str,input_vcf: str,args: argparse.Namespace) -> str:
Expand Down

0 comments on commit 92a12bb

Please sign in to comment.