diff util/subtools.py @ 21:884ee2a71680 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 6ac76e7da539ca1773fb809054679f0bf8a06972-dirty
author yating-l
date Wed, 12 Apr 2017 15:05:33 -0400
parents 3233451a3bd6
children fcc1021bd496
line wrap: on
line diff
--- a/util/subtools.py	Fri Jan 20 17:12:03 2017 -0500
+++ b/util/subtools.py	Wed Apr 12 15:05:33 2017 -0400
@@ -10,6 +10,7 @@
 import os
 import subprocess
 import sys
+import string
 
 class PopenError(Exception):
     def __init__(self, cmd, error, return_code):
@@ -243,3 +244,13 @@
 
     p = _handleExceptionAndCheckCall(array_call)
     return p
+
+#santitize trackName. Because track name must begin with a letter and
+# contain only the following chars: [a-zA-Z0-9_].
+# See the "track" Common settings at:
+#https://genome.ucsc.edu/goldenpath/help/trackDb/trackDbHub.html#bigPsl_-_Pairwise_Alignments
+def fixName(filename):
+    valid_chars = "_%s%s" % (string.ascii_letters, string.digits)
+    sanitize_name = ''.join([c if c in valid_chars else '_' for c in filename])
+    sanitize_name = "gonramp_" + sanitize_name
+    return sanitize_name