Mercurial > repos > rmarenco > hubarchivecreator
comparison 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 |
comparison
equal
deleted
inserted
replaced
20:40469b265ddb | 21:884ee2a71680 |
---|---|
8 | 8 |
9 import logging | 9 import logging |
10 import os | 10 import os |
11 import subprocess | 11 import subprocess |
12 import sys | 12 import sys |
13 import string | |
13 | 14 |
14 class PopenError(Exception): | 15 class PopenError(Exception): |
15 def __init__(self, cmd, error, return_code): | 16 def __init__(self, cmd, error, return_code): |
16 self.cmd = cmd | 17 self.cmd = cmd |
17 self.error = error | 18 self.error = error |
241 # The command to send | 242 # The command to send |
242 array_call = ['pslToBigPsl', input_psl_file_name, output_bed12_file_name] | 243 array_call = ['pslToBigPsl', input_psl_file_name, output_bed12_file_name] |
243 | 244 |
244 p = _handleExceptionAndCheckCall(array_call) | 245 p = _handleExceptionAndCheckCall(array_call) |
245 return p | 246 return p |
247 | |
248 #santitize trackName. Because track name must begin with a letter and | |
249 # contain only the following chars: [a-zA-Z0-9_]. | |
250 # See the "track" Common settings at: | |
251 #https://genome.ucsc.edu/goldenpath/help/trackDb/trackDbHub.html#bigPsl_-_Pairwise_Alignments | |
252 def fixName(filename): | |
253 valid_chars = "_%s%s" % (string.ascii_letters, string.digits) | |
254 sanitize_name = ''.join([c if c in valid_chars else '_' for c in filename]) | |
255 sanitize_name = "gonramp_" + sanitize_name | |
256 return sanitize_name |