annotate get_flanks.py @ 5:dd9315a56c09 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author devteam
date Thu, 22 Jun 2017 18:39:52 -0400
parents 2fdec558c935
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
1 #!/usr/bin/env python
5
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
2 # Done by: Guru
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
3 """
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
4 Get Flanking regions.
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
5
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
6 usage: %prog input out_file size direction region
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
7 -l, --cols=N,N,N,N: Columns for chrom, start, end, strand in file
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
8 -o, --off=N: Offset
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
9 """
5
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
10 from __future__ import print_function
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
11
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
12 import sys
5
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
13
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
14 from bx.cookbook import doc_optparse
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
15 from galaxy.tools.util.galaxyops import parse_cols_arg
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
16
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
17
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
18 def stop_err( msg ):
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
19 sys.stderr.write( msg )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
20 sys.exit()
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
21
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
22
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
23 def main():
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
24 try:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
25 if int( sys.argv[3] ) < 0:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
26 raise Exception
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
27 except:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
28 stop_err( "Length of flanking region(s) must be a non-negative integer." )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
29
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
30 # Parsing Command Line here
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
31 options, args = doc_optparse.parse( __doc__ )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
32 try:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
33 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
34 inp_file, out_file, size, direction, region = args
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
35 if strand_col_1 <= 0:
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
36 strand = "+" # if strand is not defined, default it to +
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
37 except:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
38 stop_err( "Metadata issue, correct the metadata attributes by clicking on the pencil icon in the history item." )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
39 try:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
40 offset = int(options.off)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
41 size = int(size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
42 except:
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
43 stop_err( "Invalid offset or length entered. Try again by entering valid integer values." )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
44
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
45 fo = open(out_file, 'w')
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
46
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
47 skipped_lines = 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
48 first_invalid_line = 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
49 invalid_line = None
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
50 elems = []
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
51 j = 0
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
52 for i, line in enumerate( file( inp_file ) ):
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
53 line = line.strip()
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
54 if line and (not line.startswith( '#' )) and line != '':
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
55 j += 1
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
56 try:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
57 elems = line.split('\t')
5
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
58 # if the start and/or end columns are not numbers, skip that line.
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
59 assert int(elems[start_col_1])
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
60 assert int(elems[end_col_1])
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
61 if strand_col_1 != -1:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
62 strand = elems[strand_col_1]
5
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
63 # if the stand value is not + or -, skip that line.
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
64 assert strand in ['+', '-']
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
65 if direction == 'Upstream':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
66 if strand == '+':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
67 if region == 'end':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
68 elems[end_col_1] = str(int(elems[end_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
69 elems[start_col_1] = str( int(elems[end_col_1]) - size )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
70 else:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
71 elems[end_col_1] = str(int(elems[start_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
72 elems[start_col_1] = str( int(elems[end_col_1]) - size )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
73 elif strand == '-':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
74 if region == 'end':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
75 elems[start_col_1] = str(int(elems[start_col_1]) - offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
76 elems[end_col_1] = str(int(elems[start_col_1]) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
77 else:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
78 elems[start_col_1] = str(int(elems[end_col_1]) - offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
79 elems[end_col_1] = str(int(elems[start_col_1]) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
80 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
81 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
82
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
83 elif direction == 'Downstream':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
84 if strand == '-':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
85 if region == 'start':
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
86 elems[end_col_1] = str(int(elems[end_col_1]) - offset)
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
87 elems[start_col_1] = str( int(elems[end_col_1]) - size )
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
88 else:
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
89 elems[end_col_1] = str(int(elems[start_col_1]) - offset)
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
90 elems[start_col_1] = str( int(elems[end_col_1]) - size )
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
91 elif strand == '+':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
92 if region == 'start':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
93 elems[start_col_1] = str(int(elems[start_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
94 elems[end_col_1] = str(int(elems[start_col_1]) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
95 else:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
96 elems[start_col_1] = str(int(elems[end_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
97 elems[end_col_1] = str(int(elems[start_col_1]) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
98 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
99 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
100
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
101 elif direction == 'Both':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
102 if strand == '-':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
103 if region == 'start':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
104 start = str(int(elems[end_col_1]) - offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
105 end1 = str(int(start) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
106 end2 = str(int(start) - size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
107 elems[start_col_1] = start
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
108 elems[end_col_1] = end1
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
109 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
110 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
111 elems[start_col_1] = end2
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
112 elems[end_col_1] = start
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
113 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
114 fo.write( "%s\n" % '\t'.join( elems ) )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
115 elif region == 'end':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
116 start = str(int(elems[start_col_1]) - offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
117 end1 = str(int(start) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
118 end2 = str(int(start) - size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
119 elems[start_col_1] = start
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
120 elems[end_col_1] = end1
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
121 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
122 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
123 elems[start_col_1] = end2
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
124 elems[end_col_1] = start
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
125 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
126 fo.write( "%s\n" % '\t'.join( elems ) )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
127 else:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
128 start1 = str(int(elems[end_col_1]) - offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
129 end1 = str(int(start1) + size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
130 start2 = str(int(elems[start_col_1]) - offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
131 end2 = str(int(start2) - size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
132 elems[start_col_1] = start1
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
133 elems[end_col_1] = end1
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
134 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
135 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
136 elems[start_col_1] = end2
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
137 elems[end_col_1] = start2
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
138 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
139 fo.write( "%s\n" % '\t'.join( elems ) )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
140 elif strand == '+':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
141 if region == 'start':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
142 start = str(int(elems[start_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
143 end1 = str(int(start) - size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
144 end2 = str(int(start) + size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
145 elems[start_col_1] = end1
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
146 elems[end_col_1] = start
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
147 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
148 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
149 elems[start_col_1] = start
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
150 elems[end_col_1] = end2
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
151 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
152 fo.write( "%s\n" % '\t'.join( elems ) )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
153 elif region == 'end':
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
154 start = str(int(elems[end_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
155 end1 = str(int(start) - size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
156 end2 = str(int(start) + size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
157 elems[start_col_1] = end1
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
158 elems[end_col_1] = start
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
159 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
160 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
161 elems[start_col_1] = start
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
162 elems[end_col_1] = end2
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
163 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
164 fo.write( "%s\n" % '\t'.join( elems ) )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
165 else:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
166 start1 = str(int(elems[start_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
167 end1 = str(int(start1) - size)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
168 start2 = str(int(elems[end_col_1]) + offset)
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
169 end2 = str(int(start2) + size)
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
170 elems[start_col_1] = end1
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
171 elems[end_col_1] = start1
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
172 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
173 fo.write( "%s\n" % '\t'.join( elems ) )
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
174 elems[start_col_1] = start2
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
175 elems[end_col_1] = end2
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
176 assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
177 fo.write( "%s\n" % '\t'.join( elems ) )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
178 except:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
179 skipped_lines += 1
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
180 if not invalid_line:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
181 first_invalid_line = i + 1
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
182 invalid_line = line
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
183 fo.close()
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
184
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
185 if skipped_lines == j:
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
186 stop_err( "Data issue: click the pencil icon in the history item to correct the metadata attributes." )
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
187 if skipped_lines > 0:
5
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
188 print('Skipped %d invalid lines starting with #%dL "%s"' % ( skipped_lines, first_invalid_line, invalid_line ))
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
189 print('Location: %s, Region: %s, Flank-length: %d, Offset: %d ' % ( direction, region, size, offset ))
dd9315a56c09 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents: 3
diff changeset
190
3
2fdec558c935 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
191
0
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
192 if __name__ == "__main__":
0c66884f0cac Imported from capsule None
devteam
parents:
diff changeset
193 main()