Mercurial > repos > nilesh > rseqc
comparison samtoolshelper.py @ 1:f92b87abef3d
just xmls
| author | nilesh |
|---|---|
| date | Thu, 18 Jul 2013 10:54:06 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:924eea225dd6 | 1:f92b87abef3d |
|---|---|
| 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:]) |
