def main(): logging.basicConfig(format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO) description = "Add estimated start and stop codons to a GTF file." parser = ArgumentParser(description = description) parser.add_argument("fasta_file", metavar="seq_file", type=str, help="sequence of transcripts in fasta format") parser.add_argument("gtf_file", metavar="gtf_file", type=str, help="gtf file") samtools = which("samtools") if samtools is None: print "samtools must be executable, add it to your path or " \ "download it from http://samtools.sourceforge.net/" exit(-1) args = parser.parse_args() if not os.path.exists(args.gtf_file): parser.help() exit(-1) if not os.path.exists(args.fasta_file): parser.help() exit(-1) gtflines = GTFtoDict(args.gtf_file) x = aggregateFeaturesByTranscript(gtflines) x = addFeatureCoordinatesToTranscripts(x) for transcript in x: seq = get_sequence_of_transcript(samtools, args.fasta_file, x[transcript]) orf = find_longest_orf(seq) z = add_start_and_stop_codons(orf, x[transcript]) outputGTFout(z)
def __init__(self, parser: ArgumentParser): self.log = logging.getLogger( "{}.{}".format(self.__module__, self.__class__.__name__), ) if self.help: parser.help = self.help if self.description: parser.description = self.description
def main(): logging.basicConfig(format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO) description = "Add estimated start and stop codons to a GTF file." parser = ArgumentParser(description=description) parser.add_argument("fasta_file", metavar="seq_file", type=str, help="sequence of transcripts in fasta format") parser.add_argument("gtf_file", metavar="gtf_file", type=str, help="gtf file") samtools = which("samtools") if samtools is None: print "samtools must be executable, add it to your path or " \ "download it from http://samtools.sourceforge.net/" exit(-1) args = parser.parse_args() if not os.path.exists(args.gtf_file): parser.help() exit(-1) if not os.path.exists(args.fasta_file): parser.help() exit(-1) gtflines = GTFtoDict(args.gtf_file) x = aggregateFeaturesByTranscript(gtflines) x = addFeatureCoordinatesToTranscripts(x) for transcript in x: seq = get_sequence_of_transcript(samtools, args.fasta_file, x[transcript]) orf = find_longest_orf(seq) z = add_start_and_stop_codons(orf, x[transcript]) outputGTFout(z)
if __name__ == "__main__": basicConfig(level=DEBUG) debug("Staring up") parser = ArgumentParser( description='Program to search and display ical files') parser.add_argument('-y', '--year', help='year to search') parser.add_argument('-f', '--faculty', help='faculty to search') parser.add_argument('-s', '--subject', help='subject to search') parser.add_argument('-n', '--number', help='course number to search') parser.add_argument('-c', '--code', help='course code to parse') args = parser.parse_args() debug("Args: %s" % args) if args.year or args.faculty or args.subject: errs = [] if not args.year: errs.append("A year is requried") if not args.faculty: errs.append("A faculty is requried") if not args.subject: errs.append("A subject is requried") if errs: print "Error: %s" % ','.join(errs) parser.help() exit(1) else: search(args) if args.code: display(args.code)