annotate bed_to_protein_map.py @ 1:f270ac79c0a1 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 15:30:33 +0000
parents 7b2642f6c004
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
1 #!/usr/bin/env python
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
2 """
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
3 #
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
4 #------------------------------------------------------------------------------
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
5 # University of Minnesota
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
6 # Copyright 2017, Regents of the University of Minnesota
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
7 #------------------------------------------------------------------------------
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
8 # Author:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
9 #
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
10 # James E Johnson
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
11 #
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
12 #------------------------------------------------------------------------------
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
13 """
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
14
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
15 import argparse
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
16 import sys
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
17
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
18
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
19 def __main__():
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
20 parser = argparse.ArgumentParser(
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
21 description='Convert BED file to protein mapping')
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
22 parser.add_argument(
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
23 'input',
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
24 help='A BED file (12 column)')
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
25 parser.add_argument(
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
26 'output',
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
27 help='Output file (-) for stdout')
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
28 parser.add_argument('-d', '--debug', action='store_true', help='Debug')
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
29 args = parser.parse_args()
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
30
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
31 input_rdr = open(args.input, 'r') if args.input != '-' else sys.stdin
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
32 output_wtr = open(args.output, 'w') if args.output != '-' else sys.stdout
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
33
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
34 try:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
35 for linenum, line in enumerate(input_rdr):
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
36 if args.debug:
1
f270ac79c0a1 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2a470e2c775a7427aa530e058510e4dc7b6d8e80"
galaxyp
parents: 0
diff changeset
37 sys.stderr.write("%d: %s\n" % (linenum, line))
0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
38 if line.startswith('#'):
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
39 continue
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
40 if line.strip() == '':
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
41 continue
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
42 fields = line.rstrip('\r\n').split('\t')
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
43 if len(fields) < 12:
1
f270ac79c0a1 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2a470e2c775a7427aa530e058510e4dc7b6d8e80"
galaxyp
parents: 0
diff changeset
44 sys.stderr.write("%d: %s\n" % (linenum, line))
0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
45 continue
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
46 (chrom, _chromStart, _chromEnd, name, score, strand,
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
47 _thickStart, _thickEnd, itemRgb,
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
48 _blockCount, blockSizes, blockStarts) = fields[0:12]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
49 chromStart = int(_chromStart)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
50 thickStart = int(_thickStart)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
51 thickEnd = int(_thickEnd)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
52 blockCount = int(_blockCount)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
53 blockSizes = [int(x) for x in blockSizes.split(',')]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
54 blockStarts = [int(x) for x in blockStarts.split(',')]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
55 if strand == '+':
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
56 cds_start = 0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
57 cds_end = 0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
58 for i in range(blockCount):
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
59 start = chromStart + blockStarts[i]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
60 end = start + blockSizes[i]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
61 if end < thickStart:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
62 continue
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
63 if start > thickEnd:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
64 break
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
65 if start < thickStart:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
66 start = thickStart
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
67 if end > thickEnd:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
68 end = thickEnd
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
69 cds_end = cds_start + (end - start)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
70 output_wtr.write('%s\t%s\t%d\t%d\t%s\t%d\t%d\n'
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
71 % (name, chrom, start, end,
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
72 strand, cds_start, cds_end))
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
73 cds_start = cds_end
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
74 elif strand == '-':
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
75 cds_start = 0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
76 cds_end = 0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
77 for i in reversed(range(blockCount)):
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
78 start = chromStart + blockStarts[i]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
79 end = start + blockSizes[i]
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
80 if end < thickStart:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
81 break
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
82 if start > thickEnd:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
83 continue
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
84 if start < thickStart:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
85 start = thickStart
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
86 if end > thickEnd:
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
87 end = thickEnd
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
88 cds_end = cds_start + (end - start)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
89 output_wtr.write('%s\t%s\t%d\t%d\t%s\t%d\t%d\n'
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
90 % (name, chrom, start, end,
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
91 strand, cds_start, cds_end))
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
92 cds_start = cds_end
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
93 pass
1
f270ac79c0a1 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2a470e2c775a7427aa530e058510e4dc7b6d8e80"
galaxyp
parents: 0
diff changeset
94 except Exception as e:
f270ac79c0a1 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2a470e2c775a7427aa530e058510e4dc7b6d8e80"
galaxyp
parents: 0
diff changeset
95 sys.stderr.write("failed: %s\n" % e)
0
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
96 exit(1)
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
97
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
98
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
99 if __name__ == "__main__":
7b2642f6c004 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/bed_to_protein_map commit 2d39f681f77eedc840c17aebe4ddc8f66c8a7c62
galaxyp
parents:
diff changeset
100 __main__()