diff utils.py @ 26:a4a54b925c73 draft

planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit e81fecac281f299db00cfc88a068e056b031ae9d-dirty
author yating-l
date Wed, 15 Mar 2017 10:51:23 -0400
parents e7c80e9b70ae
children d8049deb0c97
line wrap: on
line diff
--- a/utils.py	Tue Mar 14 17:41:29 2017 -0400
+++ b/utils.py	Wed Mar 15 10:51:23 2017 -0400
@@ -150,3 +150,12 @@
     the function is simply replacing '.' to '_' for the dirs
     '''
     return input_path.replace('.', '_')
+
+def createBamIndex(bamfile):
+    p = subprocess.Popen(['samtools', 'index', bamfile])
+    p.communicate()
+    filename = bamfile + '.bai'
+    if os.path.exists(filename):
+        return filename
+    else:
+        raise ValueError('Did not find bai file')