def run_haplotyper(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Call variants with Sentieon's haplotyper (GATK HaplotypeCaller like). """ if out_file is None: out_file = "%s-variants.vcf.gz" % utils.splitext_plus(align_bams[0])[0] if not utils.file_exists(out_file): variant_regions = bedutils.merge_overlaps( dd.get_variant_regions(items[0]), items[0]) interval = _get_interval(variant_regions, region, out_file, items) with file_transaction(items[0], out_file) as tx_out_file: dbsnp = "--dbsnp %s" % ( assoc_files.get("dbsnp")) if "dbsnp" in assoc_files else "" bams = " ".join(["-i %s" % x for x in align_bams]) license = license_export(items[0]) cores = dd.get_num_cores(items[0]) out_mode = "--emit_mode gvcf" if joint.want_gvcf(items) else "" cmd = ( "{license}sentieon driver -t {cores} -r {ref_file} " "{bams} {interval} --algo Haplotyper {out_mode} {dbsnp} {tx_out_file}" ) do.run(cmd.format(**locals()), "Sentieon Haplotyper") return out_file
def _run_germline(align_bams, items, ref_file, assoc_files, region, out_file): if not utils.file_exists(out_file): work_dir = "%s-work" % utils.splitext_plus(out_file)[0] with file_transaction(items[0], work_dir) as tx_work_dir: workflow_file = _configure_germline(align_bams, items, ref_file, region, out_file, tx_work_dir) _run_workflow(items[0], workflow_file, tx_work_dir) raw_file = os.path.join(work_dir, "results", "variants", "genome.vcf.gz" if joint.want_gvcf(items) else "variants.vcf.gz") utils.symlink_plus(raw_file, out_file) return vcfutils.bgzip_and_index(out_file, items[0]["config"])
def _run_germline(align_bams, items, ref_file, assoc_files, region, out_file, work_dir): if not utils.file_exists(out_file): with file_transaction(items[0], work_dir) as tx_work_dir: workflow_file = _configure_germline(align_bams, items, ref_file, region, out_file, tx_work_dir) _run_workflow(items[0], workflow_file, tx_work_dir) raw_file = os.path.join(work_dir, "results", "variants", "genome.vcf.gz" if joint.want_gvcf(items) else "variants.vcf.gz") utils.copy_plus(raw_file, out_file) # Remove files with relative symlinks utils.remove_plus(os.path.join(work_dir, "results", "variants", "genome.vcf.gz")) return vcfutils.bgzip_and_index(out_file, items[0]["config"])
def _run_germline(align_bams, items, ref_file, assoc_files, region, out_file): if not utils.file_exists(out_file): work_dir = "%s-work" % utils.splitext_plus(out_file)[0] with file_transaction(items[0], work_dir) as tx_work_dir: workflow_file = _configure_germline(align_bams, items, ref_file, region, out_file, tx_work_dir) _run_workflow(items[0], workflow_file, tx_work_dir) raw_file = os.path.join(work_dir, "results", "variants", "genome.vcf.gz" if joint.want_gvcf(items) else "variants.vcf.gz") out_file = annotation.annotate_nongatk_vcf(raw_file, align_bams, assoc_files.get("dbsnp"), ref_file, items[0], out_file) return vcfutils.bgzip_and_index(out_file, items[0]["config"])
def run_haplotyper(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Call variants with Sentieon's haplotyper (GATK HaplotypeCaller like). """ if out_file is None: out_file = "%s-variants.vcf.gz" % utils.splitext_plus(align_bams[0])[0] if not utils.file_exists(out_file): variant_regions = bedutils.merge_overlaps(dd.get_variant_regions(items[0]), items[0]) interval = _get_interval(variant_regions, region, out_file, items) with file_transaction(items[0], out_file) as tx_out_file: dbsnp = "--dbsnp %s" % (assoc_files.get("dbsnp")) if "dbsnp" in assoc_files else "" bams = " ".join(["-i %s" % x for x in align_bams]) license = license_export(items[0]) cores = dd.get_num_cores(items[0]) out_mode = "--emit_mode gvcf" if joint.want_gvcf(items) else "" cmd = ("{license}sentieon driver -t {cores} -r {ref_file} " "{bams} {interval} --algo Haplotyper {out_mode} {dbsnp} {tx_out_file}") do.run(cmd.format(**locals()), "Sentieon Haplotyper") return out_file
def _run_germline(align_bams, items, ref_file, assoc_files, region, out_file, work_dir): if not utils.file_exists(out_file): with file_transaction(items[0], work_dir) as tx_work_dir: workflow_file = _configure_germline(align_bams, items, ref_file, region, out_file, tx_work_dir) if workflow_file: has_variants = True _run_workflow(items[0], workflow_file, tx_work_dir) else: has_variants = False vcfutils.write_empty_vcf( out_file, items[0]["config"], [dd.get_sample_name(d) for d in items]) if has_variants: raw_file = os.path.join( work_dir, "results", "variants", "genome.vcf.gz" if joint.want_gvcf(items) else "variants.vcf.gz") utils.copy_plus(raw_file, out_file) # Remove files with relative symlinks utils.remove_plus( os.path.join(work_dir, "results", "variants", "genome.vcf.gz")) return vcfutils.bgzip_and_index(out_file, items[0]["config"])