comparison bed_to_protein_map.py @ 1:a7c58b43cbaa draft default tip

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2a470e2c775a7427aa530e058510e4dc7b6d8e80"
author galaxyp
date Tue, 07 Apr 2020 11:33:11 -0400
parents 024ed7b0ad93
children
comparison
equal deleted inserted replaced
0:024ed7b0ad93 1:a7c58b43cbaa
32 output_wtr = open(args.output, 'w') if args.output != '-' else sys.stdout 32 output_wtr = open(args.output, 'w') if args.output != '-' else sys.stdout
33 33
34 try: 34 try:
35 for linenum, line in enumerate(input_rdr): 35 for linenum, line in enumerate(input_rdr):
36 if args.debug: 36 if args.debug:
37 print >> sys.stderr, "%d: %s\n" % (linenum, line) 37 sys.stderr.write("%d: %s\n" % (linenum, line))
38 if line.startswith('#'): 38 if line.startswith('#'):
39 continue 39 continue
40 if line.strip() == '': 40 if line.strip() == '':
41 continue 41 continue
42 fields = line.rstrip('\r\n').split('\t') 42 fields = line.rstrip('\r\n').split('\t')
43 if len(fields) < 12: 43 if len(fields) < 12:
44 print >> sys.stderr, "%d: %s\n" % (linenum, line) 44 sys.stderr.write("%d: %s\n" % (linenum, line))
45 continue 45 continue
46 (chrom, _chromStart, _chromEnd, name, score, strand, 46 (chrom, _chromStart, _chromEnd, name, score, strand,
47 _thickStart, _thickEnd, itemRgb, 47 _thickStart, _thickEnd, itemRgb,
48 _blockCount, blockSizes, blockStarts) = fields[0:12] 48 _blockCount, blockSizes, blockStarts) = fields[0:12]
49 chromStart = int(_chromStart) 49 chromStart = int(_chromStart)
89 output_wtr.write('%s\t%s\t%d\t%d\t%s\t%d\t%d\n' 89 output_wtr.write('%s\t%s\t%d\t%d\t%s\t%d\t%d\n'
90 % (name, chrom, start, end, 90 % (name, chrom, start, end,
91 strand, cds_start, cds_end)) 91 strand, cds_start, cds_end))
92 cds_start = cds_end 92 cds_start = cds_end
93 pass 93 pass
94 except Exception, e: 94 except Exception as e:
95 print >> sys.stderr, "failed: %s" % e 95 sys.stderr.write("failed: %s\n" % e)
96 exit(1) 96 exit(1)
97 97
98 98
99 if __name__ == "__main__": 99 if __name__ == "__main__":
100 __main__() 100 __main__()