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