Mercurial > repos > nilesh > rseqc
comparison samtoolshelper.py @ 29:907d4b021ff6
Uploaded
author | nilesh |
---|---|
date | Thu, 11 Jul 2013 12:31:33 -0400 |
parents | 4d701c67592a |
children |
comparison
equal
deleted
inserted
replaced
28:6e438a559a10 | 29:907d4b021ff6 |
---|---|
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:]) |