Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove samtools sort -n which breaking bismark for some samples #3310

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bcbio/bam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ def get_aligned_reads(in_bam, data):
return 1.0 * align / total

def downsample(in_bam, data, target_counts, work_dir=None):
"""Downsample a BAM file to the specified number of target counts.
"""
"""Downsample a BAM file to the specified number of target counts."""
index(in_bam, data["config"], check_timestamp=False)
ds_pct = get_downsample_pct(in_bam, target_counts, data)
if ds_pct:
Expand Down
6 changes: 6 additions & 0 deletions bcbio/pipeline/qcsummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import toolz as tz

from bcbio import bam
from bcbio import utils
from bcbio.cwl import cwlutils
from bcbio.log import logger
Expand Down Expand Up @@ -63,6 +64,11 @@ def pipeline_summary(data):
Handles standard and CWL (single QC output) cases.
"""
data = utils.to_single_data(data)
if data["analysis"].startswith("wgbs-seq"):
bismark_bam = dd.get_align_bam(data)
sorted_bam = bam.sort(bismark_bam, data["config"])
data = dd.set_align_bam(data, sorted_bam)
data = dd.set_work_bam(data, bismark_bam)
work_bam = dd.get_align_bam(data) or dd.get_work_bam(data)
if not work_bam or not work_bam.endswith(".bam"):
work_bam = None
Expand Down
2 changes: 0 additions & 2 deletions bcbio/upload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ def _get_files_chipseq(sample):
def _get_files_wgbsseq(sample):
out = []
algorithm = sample["config"]["algorithm"]
# otherwise deduplicated bam is saved to final
sample["work_bam"] = sample["align_bam"]
out = _maybe_add_alignment(algorithm, sample, out)
bismark_report_dir = sample.get("bismark_report")
if bismark_report_dir:
Expand Down
3 changes: 2 additions & 1 deletion bcbio/wgbsseq/cpg_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def _run_meth_extractor(bam_in, sample, workdir, index_dir, config):
bismark = config_utils.get_program("bismark_methylation_extractor", config)
cores = config["algorithm"].get('cores', 1)
memory = config["algorithm"].get('mem', 5)
bam_in = bam.sort(bam_in, config, order="queryname")
# don't sort even by read name!
# bam_in = bam.sort(bam_in, config, order="queryname")
cmd = "{bismark} --no_overlap --comprehensive --cytosine_report --genome_folder {index_dir} --merge_non_CpG --multicore {cores} --buffer_size {memory}G --bedGraph --gzip {bam_in}"
out_dir = os.path.join(workdir, sample)
mbias_file = os.path.join(out_dir, os.path.basename(splitext_plus(bam_in)[0]) + '.M-bias.txt')
Expand Down
3 changes: 2 additions & 1 deletion bcbio/wgbsseq/deduplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def dedup_bismark(data):
"""
config = data["config"]
input_file = datadict.get_work_bam(data)
input_file = bam.sort(input_file, config, order="queryname")
# don't sort even by read names
# input_file = bam.sort(input_file, config, order="queryname")
sample_name = datadict.get_sample_name(data)
output_dir = os.path.join(datadict.get_work_dir(data), 'dedup',
sample_name)
Expand Down