comparison gops_concat.py @ 2:23abefbed3dd draft

planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
author devteam
date Tue, 13 Oct 2015 12:49:47 -0400
parents f256537913a1
children 9a8f22b1a3ed
comparison
equal deleted inserted replaced
1:14cbada56cc0 2:23abefbed3dd
11 -1, --cols1=N,N,N,N: Columns for chrom, start, end, strand in first file 11 -1, --cols1=N,N,N,N: Columns for chrom, start, end, strand in first file
12 -2, --cols2=N,N,N,N: Columns for chrom, start, end, strand in second file 12 -2, --cols2=N,N,N,N: Columns for chrom, start, end, strand in second file
13 -s, --sameformat: All files are precisely the same format. 13 -s, --sameformat: All files are precisely the same format.
14 """ 14 """
15 15
16 import sys, traceback, fileinput 16 import fileinput
17 from warnings import warn 17 import sys
18 from bx.intervals import * 18 from bx.intervals.io import GenomicInterval, NiceReaderWrapper
19 from bx.intervals.io import * 19 from bx.intervals.operations.concat import concat
20 from bx.intervals.operations.concat import *
21 from bx.cookbook import doc_optparse 20 from bx.cookbook import doc_optparse
22 from galaxy.tools.util.galaxyops import * 21 from bx.tabular.io import ParseError
22 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped
23 23
24 assert sys.version_info[:2] >= ( 2, 4 ) 24 assert sys.version_info[:2] >= ( 2, 4 )
25 25
26
26 def main(): 27 def main():
27 sameformat=False 28 sameformat = False
28 upstream_pad = 0
29 downstream_pad = 0
30 29
31 options, args = doc_optparse.parse( __doc__ ) 30 options, args = doc_optparse.parse( __doc__ )
32 try: 31 try:
33 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 ) 32 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 )
34 chr_col_2, start_col_2, end_col_2, strand_col_2 = parse_cols_arg( options.cols2 ) 33 chr_col_2, start_col_2, end_col_2, strand_col_2 = parse_cols_arg( options.cols2 )
35 if options.sameformat: sameformat = True 34 if options.sameformat:
35 sameformat = True
36 in_file_1, in_file_2, out_fname = args 36 in_file_1, in_file_2, out_fname = args
37 except: 37 except:
38 doc_optparse.exception() 38 doc_optparse.exception()
39 39
40 g1 = NiceReaderWrapper( fileinput.FileInput( in_file_1 ), 40 g1 = NiceReaderWrapper( fileinput.FileInput( in_file_1 ),
67 67
68 if g1.skipped > 0: 68 if g1.skipped > 0:
69 print skipped( g1, filedesc=" of 1st dataset" ) 69 print skipped( g1, filedesc=" of 1st dataset" )
70 if g2.skipped > 0: 70 if g2.skipped > 0:
71 print skipped( g2, filedesc=" of 2nd dataset" ) 71 print skipped( g2, filedesc=" of 2nd dataset" )
72 72
73 if __name__ == "__main__": 73 if __name__ == "__main__":
74 main() 74 main()