Mercurial > repos > yufei-luo > s_mart
comparison SMART/Java/Python/removeEmptySequences.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | 769e306b7933 |
children | 0ab839023fe4 |
comparison
equal
deleted
inserted
replaced
17:b0e8584489e6 | 18:94ab73e8a190 |
---|---|
64 sys.exit("Do not understand '%s' file format." % (self.format)) | 64 sys.exit("Do not understand '%s' file format." % (self.format)) |
65 | 65 |
66 | 66 |
67 def setOutputFileName(self, fileName): | 67 def setOutputFileName(self, fileName): |
68 if options.format == "fasta": | 68 if options.format == "fasta": |
69 self.writer = FastaWriter("%s.mfa" % (fileName), self.verbosity) | 69 self.writer = FastaWriter(fileName, self.verbosity) |
70 elif options.format == "fastq": | 70 elif options.format == "fastq": |
71 self.writer = FastqWriter("%s.mfq" % (fileName), self.verbosity) | 71 self.writer = FastqWriter(fileName, self.verbosity) |
72 | 72 |
73 | 73 |
74 def parse(self): | 74 def parse(self): |
75 progress = Progress(self.parser.getNbSequences(), "Reading sequences in %s" % (options.inputFileName), options.verbosity) | 75 progress = Progress(self.parser.getNbSequences(), "Reading sequences in %s" % (options.inputFileName), options.verbosity) |
76 for sequence in self.parser.getIterator(): | 76 for sequence in self.parser.getIterator(): |
89 | 89 |
90 # parse command line | 90 # parse command line |
91 description = "Remove Empty Sequences v1.0.2: Remove all the empty sequences in a list. [Category: Personal]" | 91 description = "Remove Empty Sequences v1.0.2: Remove all the empty sequences in a list. [Category: Personal]" |
92 | 92 |
93 parser = OptionParser(description = description) | 93 parser = OptionParser(description = description) |
94 parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in sequence format given by -f]") | 94 parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in sequence format given by -f]") |
95 parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the input file [compulsory] [format: sequence file format]") | 95 parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the input file [compulsory] [format: sequence file format]") |
96 parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 (in case of pair end reads) [format: file in sequence format given by -f] [default: None]") | 96 parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 (in case of pair end reads) [format: file in sequence format given by -f] [default: None]") |
97 parser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file [compulsory] [format: output file in format given by -f]") | 97 parser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file [compulsory] [format: output file in format given by -f]") |
98 parser.add_option("-p", "--output2", dest="outputFileName2", action="store", default=None, type="string", help="output file 2 (in case of pair end reads) [format: output file in sequence format given by -f] [default: None]") | 98 parser.add_option("-p", "--output2", dest="outputFileName2", action="store", default=None, type="string", help="output file 2 (in case of pair end reads) [format: output file in sequence format given by -f] [default: None]") |
99 parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]") | 99 parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]") |
100 parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") | 100 parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") |
101 (options, args) = parser.parse_args() | 101 (options, args) = parser.parse_args() |
102 | 102 |
103 if options.log: | 103 if options.log: |
104 logHandle = open("%s.log" % options.outputFileName, "w") | 104 logHandle = open("%s.log" % options.outputFileName, "w") |
105 | 105 |