Mercurial > repos > urgi-team > teiso
comparison TEiso/ClosestToStartSite_Wrapper.py @ 1:15d6811e6bf5 draft
Uploaded
author | urgi-team |
---|---|
date | Tue, 24 May 2016 08:59:28 -0400 |
parents | 3d22562b4489 |
children |
comparison
equal
deleted
inserted
replaced
0:3d22562b4489 | 1:15d6811e6bf5 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 | 3 |
4 import subprocess, tempfile, sys, os, glob, shutil, time | 4 import subprocess, tempfile, sys, os, glob, shutil, time |
5 from optparse import OptionParser | 5 from optparse import OptionParser |
6 from commons.core.utils.RepetOptionParser import RepetOptionParser | |
7 | 6 |
8 | 7 |
9 class ClosestToStartSiteWrapper(object): | 8 class ClosestToStartSiteWrapper(object): |
10 | 9 |
11 def __init__(self): | 10 def __init__(self): |
16 sys.stderr.write( "%s\n" % msg ) | 15 sys.stderr.write( "%s\n" % msg ) |
17 sys.exit() | 16 sys.exit() |
18 | 17 |
19 | 18 |
20 def setAttributesFromCmdLine(self): | 19 def setAttributesFromCmdLine(self): |
21 self._toolVersion = "1.0" | 20 description = "ClosestToStartSite" |
22 description = "ClosestToStartSite version %s" % self._toolVersion | 21 epilog = "\nParser a bed file and create a bed file to create a report about positions of features A to features B. \n" |
23 epilog = "\n parses a bed file and create a bed file to create a report about positions of features A to features B. \n" | 22 epilog +="it can also add the class code of features A. \n" |
24 epilog += "example: ClosestToStartSite.py -i <inputFile> -o <outputFile>\n" | 23 epilog += "example: ClosestToStartSite.py -i <inputFile> -c <cuff_in.tmap> -o <outputFile>\n" |
25 parser = RepetOptionParser(description = description, epilog = epilog, version = self._toolVersion) | 24 parser = OptionParser(description = description, version = "1.0") |
26 parser.add_option("-i", "--inputFile", dest = "inputFile", action = "store", type = "string", help = "Input GTF File name(transcript.gtf of Cufflinks).", default = "") | 25 parser.add_option("-i", "--inputFile", dest = "inputFile", action = "store", type = "string", help = "input bed file", default = "") |
26 parser.add_option("-c", "--cuffcom_tmap", dest = "cuffcom_tmap", action = "store", type = "string", help = "input gtf file", default = "") | |
27 parser.add_option("-o", "--outputFile", dest = "outputFile", action = "store", type = "string", help = "output Bed File name", default = "") | 27 parser.add_option("-o", "--outputFile", dest = "outputFile", action = "store", type = "string", help = "output Bed File name", default = "") |
28 parser.add_option("-v", "--verbosity", dest = "verbosity", action = "store", type = "int", help = "Verbosity [optional] [default: 3]",default = 3) | 28 #parser.add_option("-t", "--outputFileclasscode", dest = "outputFile_classcode", action = "store", type = "string", help = "output Bed File name with class code.", default = "") |
29 parser.add_option("-v", "--verbosity", dest = "verbosity", action = "store", type = "int", help = "verbosity [optional] [default: 3]",default = 3) | |
29 options = parser.parse_args()[0] | 30 options = parser.parse_args()[0] |
30 self._setAttributesFromOptions(options) | 31 self._setAttributesFromOptions(options) |
31 | 32 |
32 def _setAttributesFromOptions(self, options): | 33 def _setAttributesFromOptions(self, options): |
33 self._options = options | 34 self._options = options |
34 | 35 |
35 def run(self): | 36 def run(self): |
36 prg = "ClosestToStartSite.py" | 37 prg = "ClosestToStartSite.py" |
37 args = "" | 38 args = "" |
38 args += "-i %s" % self._options.inputFile | 39 args += "-i %s" % self._options.inputFile |
40 args += " " | |
41 args += "-o %s" % self._options.outputFile | |
42 if self._options.cuffcom_tmap != "": | |
43 args += " " | |
44 args += "-c %s" % self._options.cuffcom_tmap | |
39 cmd = "%s %s" %(prg, args) | 45 cmd = "%s %s" %(prg, args) |
40 print cmd | 46 print cmd |
41 | 47 |
42 try: | 48 try: |
43 tmp_err = tempfile.NamedTemporaryFile().name | 49 tmp_err = tempfile.NamedTemporaryFile().name |