Mercurial > repos > iuc > resize_coordinate_window
annotate resize_coordinate_window.py @ 2:541f300f322d draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
| author | iuc |
|---|---|
| date | Mon, 14 Nov 2016 14:04:00 -0500 |
| parents | 0164d2edba9f |
| children | 9ba78e8985dc |
| rev | line source |
|---|---|
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
1 import argparse |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
2 import fileinput |
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
3 import sys |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
4 |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
5 # Maximum value of a signed 32 bit integer (2**31 - 1). |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
6 MAX_CHROM_LEN = 2147483647 |
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
7 |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
8 |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
9 def stop_err(msg): |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
10 sys.stderr.write(msg) |
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
11 sys.exit(1) |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
12 |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
13 parser = argparse.ArgumentParser() |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
14 parser.add_argument('--input', dest='input', help="Input dataset") |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
15 parser.add_argument('--start_coordinate', dest='start_coordinate', type=int, help='Chromosome start coordinate, either 0 or 1.') |
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
16 parser.add_argument('--subtract_from_start', dest='subtract_from_start', type=int, help='Distance to subtract from start.') |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
17 parser.add_argument('--add_to_end', dest='add_to_end', type=int, help='Distance to add to end.') |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
18 parser.add_argument('--extend_existing', dest='extend_existing', help='Extend existing start/end instead of from computed midpoint.') |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
19 parser.add_argument('--chrom_len_file', dest='chrom_len_file', help="File names of .len files for chromosome lengths") |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
20 parser.add_argument('--region_boundaries', dest='region_boundaries', help="Option for handling region boundaries") |
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
21 parser.add_argument('--output', dest='output', help="Output dataset") |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
22 args = parser.parse_args() |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
23 |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
24 extend_existing = args.extend_existing == 'existing' |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
25 out = open(args.output, 'wb') |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
26 |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
27 chrom_start = int(args.start_coordinate) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
28 chrom_lens = dict() |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
29 # Determine the length of each chromosome and add it to the chrom_lens dictionary. |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
30 len_file_missing = False |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
31 len_file_error = None |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
32 len_file = fileinput.FileInput(args.chrom_len_file) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
33 try: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
34 for line in len_file: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
35 fields = line.split("\t") |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
36 chrom_lens[fields[0]] = int(fields[1]) |
|
2
541f300f322d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
iuc
parents:
1
diff
changeset
|
37 except Exception as e: |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
38 len_file_error = str(e) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
39 |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
40 with open(args.input) as fhi: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
41 for line in fhi: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
42 if line.startswith('#'): |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
43 # Skip comments. |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
44 continue |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
45 items = line.split('\t') |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
46 if len(items) != 9: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
47 # Skip invalid gff data. |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
48 continue |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
49 chrom = items[0] |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
50 start = int(items[3]) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
51 end = int(items[4]) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
52 if extend_existing: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
53 new_start = start - args.subtract_from_start |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
54 new_end = end + args.add_to_end |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
55 else: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
56 midpoint = (start + end) // 2 |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
57 new_start = midpoint - args.subtract_from_start |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
58 new_end = midpoint + args.add_to_end |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
59 # Check start boundary. |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
60 if new_start < chrom_start: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
61 if args.region_boundaries == 'discard': |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
62 continue |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
63 elif args.region_boundaries == 'limit': |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
64 new_start = chrom_start |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
65 elif args.region_boundaries == 'error': |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
66 out.close() |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
67 stop_err('Requested expansion places region beyond chromosome start boundary of %d.' % chrom_start) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
68 # Check end boundary. |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
69 chrom_len = chrom_lens.get(chrom, None) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
70 if chrom_len is None: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
71 len_file_missing = True |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
72 chrom_len = MAX_CHROM_LEN |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
73 if new_end > chrom_len: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
74 if args.region_boundaries == 'discard': |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
75 continue |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
76 elif args.region_boundaries == 'limit': |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
77 new_end = chrom_len |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
78 elif args.region_boundaries == 'error': |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
79 out.close() |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
80 stop_err('Requested expansion places region beyond chromosome end boundary of %d.' % chrom_len) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
81 new_line = '\t'.join([chrom, items[1], items[2], str(new_start), str(new_end), items[5], items[6], items[7], items[8]]) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
82 out.write(new_line) |
|
0
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
83 out.close() |
|
08b6255afde7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit b'67cff25a50ba173b0468819204d0999496f68ea9'
iuc
parents:
diff
changeset
|
84 |
|
1
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
85 if len_file_error is not None: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
86 print "All chrom lengths set to %d, error in chrom len file: %s" % (MAX_CHROM_LEN, len_file_error) |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
87 if len_file_missing: |
|
0164d2edba9f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/resize_coordinate_window commit 7aa2429d3f53a14be7e44dc6021ed3e11dc2f080
iuc
parents:
0
diff
changeset
|
88 print "All chrom lengths set to %d, chrom len files are not installed." % MAX_CHROM_LEN |
