def main(argv): parser = argparse.ArgumentParser() parser.add_argument(dest="bamfile") parser.add_argument('-o', dest='outfile') parser.add_argument('-w', dest='window') parser.add_argument('-e', dest="extend", default=0) parser.add_argument('--paired-end', dest="pe", action="store_true") args = parser.parse_args() # Split BAM by strand split_bam = splitByStrand(args.bamfile, args.pe) # Split BAM to Wig for bam in split_bam: print "BAM to WIG..." print bam w = b2w.windower(bam, bam.split(".bam")[0] + ".wig", args.window, args.extend, args.pe, "", "", "", "") w.window() #Wig to Track for bam in split_bam: print "WIG to Track..." print bam wig2Track(bam.split(".bam")[0] + ".wig", args.outfile, args.window)
def wig(self): window_size = str(200) bamname = "/".join([self.output, "accepted_hits_sort.bam"]) wigdir = "/".join([wig_dir, self.input_prefix]) if not os.path.exists(wigdir): os.makedirs(wigdir) wigfile = "/".join([wigdir, "_".join([self.input_prefix, window_size]) + ".wig"]) extend = self.mean pe = not self.single_end wi = BAMtoWIG.windower(bamname, wigfile, window_size, extend, pe) print "Writing WIG..." wi.window() wi.wigfile.close() wi.tdf()
def wig(self): #pdb.set_trace() window_size = str(25) bamname = "/".join([self.output, "accepted_hits.bam"]) wigdir = "/".join([wig_dir, self.sample]) if not os.path.exists(wigdir): os.makedirs(wigdir) wigfile = "/".join([wigdir, "_".join([self.sample, window_size]) + ".wig"]) extend = self.mean pe = not self.single_end wi = BAMtoWIG.windower(bamname, wigfile, window_size, extend, pe, False, False) print "Writing WIG..." wi.window() wi.wigfile.close() wi.tdf()