diff --git a/bcbio/structural/delly.py b/bcbio/structural/delly.py index ef8006e55..ceceff54e 100644 --- a/bcbio/structural/delly.py +++ b/bcbio/structural/delly.py @@ -16,8 +16,8 @@ from bcbio.structural import shared as sshared from bcbio.variation import vcfutils -def _get_full_exclude_file(items, work_dir): - base_file = os.path.join(work_dir, "%s-svs" % (os.path.splitext(os.path.basename(items[0]["work_bam"]))[0])) +def _get_full_exclude_file(items, work_bams, work_dir): + base_file = os.path.join(work_dir, "%s-svs" % (os.path.splitext(os.path.basename(work_bams[0]))[0])) return sshared.prepare_exclude_file(items, base_file) def _delly_exclude_file(items, base_file, chrom): @@ -149,7 +149,7 @@ def run(items): high quality reference pairs (DR). """ work_dir = utils.safe_makedir(os.path.join(items[0]["dirs"]["work"], "structural", - items[0]["name"][-1], "delly")) + dd.get_sample_name(items[0]), "delly")) # Add core request for delly config = copy.deepcopy(items[0]["config"]) delly_config = utils.get_in(config, ("resources", "delly"), {}) @@ -159,7 +159,7 @@ def run(items): "progs": ["delly"]} work_bams = [dd.get_align_bam(d) for d in items] ref_file = dd.get_ref_file(items[0]) - exclude_file = _get_full_exclude_file(items, work_dir) + exclude_file = _get_full_exclude_file(items, work_bams, work_dir) bytype_vcfs = run_multicore(_run_delly, [(work_bams, chrom, ref_file, work_dir, items) for chrom in sshared.get_sv_chroms(items, exclude_file)], diff --git a/bcbio/structural/shared.py b/bcbio/structural/shared.py index a46e694e9..216c67cc2 100644 --- a/bcbio/structural/shared.py +++ b/bcbio/structural/shared.py @@ -184,7 +184,7 @@ def get_sv_chroms(items, exclude_file): if int(region.start) == 0: exclude_regions[region.chrom] = int(region.end) out = [] - with pysam.Samfile(items[0]["work_bam"], "rb") as pysam_work_bam: + with pysam.Samfile(dd.get_align_bam(items[0]) or dd.get_work_bam(items[0]))as pysam_work_bam: for chrom, length in zip(pysam_work_bam.references, pysam_work_bam.lengths): exclude_length = exclude_regions.get(chrom, 0) if exclude_length < length: