[Patchwork-commits] r183 - in pkg/patchwork/inst: . python

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 27 17:25:53 CEST 2013


Author: sebastian_d
Date: 2013-06-27 17:25:52 +0200 (Thu, 27 Jun 2013)
New Revision: 183

Added:
   pkg/patchwork/inst/python/
   pkg/patchwork/inst/python/Pysamloader.py
Log:
adding pythong again

Added: pkg/patchwork/inst/python/Pysamloader.py
===================================================================
--- pkg/patchwork/inst/python/Pysamloader.py	                        (rev 0)
+++ pkg/patchwork/inst/python/Pysamloader.py	2013-06-27 15:25:52 UTC (rev 183)
@@ -0,0 +1,26 @@
+import sys
+import re
+import os
+
+import pysam
+
+filename = sys.argv[1]
+
+try:
+    infile = pysam.Samfile(sys.argv[1],"rb")
+except IOError,eStr:
+    print "Error:Cannot open ",filename," for reading: ", eStr
+    sys.exit()
+    
+outfile = open(".Tmp_chr_pos","w")
+
+try:
+	for read in infile.fetch(sys.argv[2]):
+		outfile.write(str(read.pos) + "\n")
+except:
+	a = re.split('chr',sys.argv[2])
+	for read in infile.fetch(a[1]):
+		outfile.write(str(read.pos) + "\n")
+	
+infile.close()
+outfile.close()



More information about the Patchwork-commits mailing list