comparison rseqc/samtoolshelper.py @ 27:5dbd20d3d623

Uploaded
author nilesh
date Thu, 11 Jul 2013 12:28:04 -0400
parents
children
comparison
equal deleted inserted replaced
26:9a33e347a3de 27:5dbd20d3d623
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:])