comparison samtoolshelper.py @ 1:dc3b3b88fbab

first commit
author nilesh
date Thu, 18 Jul 2013 11:27:43 -0500
parents
children
comparison
equal deleted inserted replaced
0:0d133c7c387e 1:dc3b3b88fbab
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:])