Repository 'rseqc'
hg clone https://toolshed.g2.bx.psu.edu/repos/nilesh/rseqc

Changeset 2:4d701c67592a (2013-07-08)
Previous changeset 1:d9ac0d9cb48e (2013-07-08) Next changeset 3:203bda4cf122 (2013-07-08)
Commit message:
Uploaded
added:
samtoolshelper.py
b
diff -r d9ac0d9cb48e -r 4d701c67592a samtoolshelper.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/samtoolshelper.py Mon Jul 08 22:03:50 2013 -0400
[
@@ -0,0 +1,20 @@
+import sys
+import subprocess as sp
+import os
+
+# Creates the sorted and indexed bam/bai files that are requried for both bam2wig and RSEQC_count
+def samtools_sorted(bam):
+ sortedbam = bam + ".sorted"
+ indexedbam = ".".join([sortedbam,"bam.bai"])
+ sp.call(['samtools', 'sort', '-m 1000000000', bam, sortedbam])
+ sortedbam = sortedbam + '.bam'
+ sp.call(['samtools', 'index', sortedbam, indexedbam])
+ return sortedbam
+
+def main(args):
+ args[2] = samtools_sorted(args[2])
+ sp.call(args)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
\ No newline at end of file