comparison samtoolshelper.py @ 2:4d701c67592a

Uploaded
author nilesh
date Mon, 08 Jul 2013 22:03:50 -0400
parents
children
comparison
equal deleted inserted replaced
1:d9ac0d9cb48e 2:4d701c67592a
1 import sys
2 import subprocess as sp
3 import os
4
5 # Creates the sorted and indexed bam/bai files that are requried for both bam2wig and RSEQC_count
6 def samtools_sorted(bam):
7 sortedbam = bam + ".sorted"
8 indexedbam = ".".join([sortedbam,"bam.bai"])
9 sp.call(['samtools', 'sort', '-m 1000000000', bam, sortedbam])
10 sortedbam = sortedbam + '.bam'
11 sp.call(['samtools', 'index', sortedbam, indexedbam])
12 return sortedbam
13
14 def main(args):
15 args[2] = samtools_sorted(args[2])
16 sp.call(args)
17
18
19 if __name__ == "__main__":
20 main(sys.argv[1:])