diff utils.py @ 5:e7c80e9b70ae draft

planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit f18ea51d27ec7addfa6413716391cfefebc8acbc-dirty
author yating-l
date Tue, 14 Mar 2017 12:24:37 -0400
parents e4f3f2ed4fa5
children a4a54b925c73
line wrap: on
line diff
--- a/utils.py	Fri Mar 10 14:57:36 2017 -0500
+++ b/utils.py	Tue Mar 14 12:24:37 2017 -0400
@@ -26,6 +26,7 @@
     gff3.write('\n')
 
 def getChromSizes(reference, tool_dir):
+    #TODO: find a better way instead of shipping the two exec files with the tool
     faToTwoBit = os.path.join(tool_dir, 'faToTwoBit')
     twoBitInfo = os.path.join(tool_dir, 'twoBitInfo')
     try:
@@ -34,12 +35,12 @@
     except IOError as err:
         print "Cannot create tempfile err({0}): {1}".format(err.errno, err.strerror)
     try:
-        p = subprocess.Popen([faToTwoBit, reference, twoBitFile.name])
+        p = subprocess.Popen(['faToTwoBit', reference, twoBitFile.name])
         p.communicate()
     except OSError as err:
         print "Cannot generate twoBitFile from faToTwoBit err({0}): {1}".format(err.errno, err.strerror)
     try:
-        p = subprocess.Popen([twoBitInfo, twoBitFile.name, chrom_sizes.name])
+        p = subprocess.Popen(['twoBitInfo', twoBitFile.name, chrom_sizes.name])
         p.communicate()
     except OSError as err:
         print "Cannot generate chrom_sizes from twoBitInfo err({0}): {1}".format(err.errno, err.strerror)
@@ -142,3 +143,10 @@
                 attribute['coverage'] = attr_li[3].split()[1].strip('"')
             write_features(field, attribute, gff3)
     gff3.close()
+
+def sanitize_name_path(input_path):
+    '''
+    Galaxy will name all the files and dirs as *.dat, 
+    the function is simply replacing '.' to '_' for the dirs
+    '''
+    return input_path.replace('.', '_')