# HG changeset patch # User Brad Chapman # Date 1393254140 18000 # Node ID 52bcd04ee0d69ed09c3f15da2dacda5b635c5ad7 # Parent 14e5258d1b396a029a43c1f00ef34194133742d1 Fix issues with setting up subprocess call. Thanks to David Leader diff -r 14e5258d1b39 -r 52bcd04ee0d6 bam_to_bigwig/bam_to_bigwig.py --- a/bam_to_bigwig/bam_to_bigwig.py Tue Feb 11 15:55:22 2014 -0500 +++ b/bam_to_bigwig/bam_to_bigwig.py Mon Feb 24 10:02:20 2014 -0500 @@ -1,10 +1,11 @@ #!/usr/bin/env python -#Original version copyright Brad Chapman with revisions from Peter Cock -#and ideas from Lance Parsons """Convert BAM files to BigWig file format in a specified region. +Original version copyright Brad Chapman with revisions from Peter Cock +and ideas from Lance Parsons + Usage: - bam_to_wiggle.py [--outfile=] [--split] + bam_to_bigwig.py [--outfile=] [--split] The --split argument is passed to bedtools genomecov @@ -69,7 +70,7 @@ return sizes def convert_to_graph(bam_file, split, config, out_handle): - cl = [config["program"]["bedtools_genomeCoverageBed"]] + ["-ibam", bam_file, "-bg"] + cl = config["program"]["bedtools_genomeCoverageBed"] + ["-ibam", bam_file, "-bg"] if split: cl.append("-split") subprocess.check_call(cl, stdout=out_handle) @@ -81,7 +82,7 @@ for chrom, size in chr_sizes: out_handle.write("%s\t%s\n" % (chrom, size)) try: - cl = [config["program"]["ucsc_bedGraphToBigWig"]] + [bedgraph_file, size_file, bw_file] + cl = config["program"]["ucsc_bedGraphToBigWig"] + [bedgraph_file, size_file, bw_file] subprocess.check_call(cl) finally: os.remove(size_file)