Mercurial > repos > devteam > merge
diff gops_merge.py @ 3:b9c97d3233bb draft
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
author | devteam |
---|---|
date | Tue, 13 Oct 2015 12:51:07 -0400 |
parents | 10ac6097acdb |
children | dfbbc0291b36 |
line wrap: on
line diff
--- a/gops_merge.py Mon Apr 14 09:24:27 2014 -0400 +++ b/gops_merge.py Tue Oct 13 12:51:07 2015 -0400 @@ -7,25 +7,25 @@ -m, --mincols=N: Require this much overlap (default 1bp) -3, --threecol: Output 3 column bed """ -import sys, traceback, fileinput -from warnings import warn -from bx.intervals import * -from bx.intervals.io import * -from bx.intervals.operations.merge import * +import fileinput +import sys +from bx.intervals.io import GenomicInterval, NiceReaderWrapper +from bx.intervals.operations.merge import merge from bx.cookbook import doc_optparse -from galaxy.tools.util.galaxyops import * +from bx.tabular.io import ParseError +from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped assert sys.version_info[:2] >= ( 2, 4 ) + def main(): mincols = 1 - upstream_pad = 0 - downstream_pad = 0 options, args = doc_optparse.parse( __doc__ ) try: chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 ) - if options.mincols: mincols = int( options.mincols ) + if options.mincols: + mincols = int( options.mincols ) in_fname, out_fname = args except: doc_optparse.exception() @@ -34,13 +34,13 @@ chrom_col=chr_col_1, start_col=start_col_1, end_col=end_col_1, - strand_col = strand_col_1, + strand_col=strand_col_1, fix_strand=True ) out_file = open( out_fname, "w" ) try: - for line in merge(g1,mincols=mincols): + for line in merge(g1, mincols=mincols): if options.threecol: if type( line ) is GenomicInterval: out_file.write( "%s\t%s\t%s\n" % ( line.chrom, str( line.startCol ), str( line.endCol ) ) )