comparison gops_join.py @ 3:860e7e4899b1 draft

planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
author devteam
date Tue, 13 Oct 2015 12:50:54 -0400
parents cb9ed67cb329
children ddf5484243d2
comparison
equal deleted inserted replaced
2:83c18f310619 3:860e7e4899b1
6 -1, --cols1=N,N,N,N: Columns for start, end, strand in first file 6 -1, --cols1=N,N,N,N: Columns for start, end, strand in first file
7 -2, --cols2=N,N,N,N: Columns for start, end, strand in second file 7 -2, --cols2=N,N,N,N: Columns for start, end, strand in second file
8 -m, --mincols=N: Require this much overlap (default 1bp) 8 -m, --mincols=N: Require this much overlap (default 1bp)
9 -f, --fill=N: none, right, left, both 9 -f, --fill=N: none, right, left, both
10 """ 10 """
11 import sys, traceback, fileinput 11 import fileinput
12 from warnings import warn 12 import sys
13 from bx.intervals import * 13 from bx.intervals.io import NiceReaderWrapper
14 from bx.intervals.io import * 14 from bx.intervals.operations.join import join
15 from bx.intervals.operations.join import *
16 from bx.cookbook import doc_optparse 15 from bx.cookbook import doc_optparse
17 from galaxy.tools.util.galaxyops import * 16 from bx.tabular.io import ParseError
17 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped
18 18
19 assert sys.version_info[:2] >= ( 2, 4 ) 19 assert sys.version_info[:2] >= ( 2, 4 )
20 20
21
21 def main(): 22 def main():
22 mincols = 1 23 mincols = 1
23 upstream_pad = 0
24 downstream_pad = 0
25 leftfill = False 24 leftfill = False
26 rightfill = False 25 rightfill = False
27 26
28 options, args = doc_optparse.parse( __doc__ ) 27 options, args = doc_optparse.parse( __doc__ )
29 try: 28 try:
30 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 ) 29 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 )
31 chr_col_2, start_col_2, end_col_2, strand_col_2 = parse_cols_arg( options.cols2 ) 30 chr_col_2, start_col_2, end_col_2, strand_col_2 = parse_cols_arg( options.cols2 )
32 if options.mincols: mincols = int( options.mincols ) 31 if options.mincols:
32 mincols = int( options.mincols )
33 if options.fill: 33 if options.fill:
34 if options.fill == "both": 34 if options.fill == "both":
35 rightfill = leftfill = True 35 rightfill = leftfill = True
36 else: 36 else:
37 rightfill = options.fill == "right" 37 rightfill = options.fill == "right"