# HG changeset patch # User devteam # Date 1444754960 14400 # Node ID 1e895b74f29ff15886a4b9c4dd35fca48b32b065 # Parent e84cc9cf3ba1b1472ac5b04abcf13c5a50a0e94c planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734 diff -r e84cc9cf3ba1 -r 1e895b74f29f cluster.xml --- a/cluster.xml Mon Apr 14 09:05:51 2014 -0400 +++ b/cluster.xml Tue Oct 13 12:49:20 2015 -0400 @@ -10,10 +10,10 @@ - + - + diff -r e84cc9cf3ba1 -r 1e895b74f29f gops_cluster.py --- a/gops_cluster.py Mon Apr 14 09:05:51 2014 -0400 +++ b/gops_cluster.py Tue Oct 13 12:49:20 2015 -0400 @@ -9,30 +9,33 @@ -m, --minregions=N: Minimum regions per cluster -o, --output=N: 1)merged 2)filtered 3)clustered 4) minimum 5) maximum """ -import sys, traceback, fileinput -from warnings import warn -from bx.intervals import * -from bx.intervals.io import * -from bx.intervals.operations.find_clusters import * +import fileinput +import sys +from bx.intervals.io import GenomicInterval, NiceReaderWrapper +from bx.intervals.operations.find_clusters import find_clusters 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(): distance = 0 minregions = 2 output = 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.distance: distance = int( options.distance ) - if options.overlap: distance = -1 * int( options.overlap ) - if options.output: output = int( options.output ) - if options.minregions: minregions = int( options.minregions ) + if options.distance: + distance = int( options.distance ) + if options.overlap: + distance = -1 * int( options.overlap ) + if options.output: + output = int( options.output ) + if options.minregions: + minregions = int( options.minregions ) in_fname, out_fname = args except: doc_optparse.exception() @@ -52,10 +55,10 @@ f1 = open( in_fname, "r" ) out_file = open( out_fname, "w" ) - + # If "merge" if output == 1: - fields = ["." for x in range(max(g1.chrom_col, g1.start_col, g1.end_col)+1)] + fields = ["." for x in range(max(g1.chrom_col, g1.start_col, g1.end_col) + 1)] for chrom, tree in clusters.items(): for start, end, lines in tree.getregions(): fields[g1.chrom_col] = chrom @@ -91,7 +94,6 @@ f1.seek(0) fileLines = f1.readlines() for chrom, tree in clusters.items(): - regions = tree.getregions() for start, end, lines in tree.getregions(): outsize = -1 outinterval = None @@ -100,11 +102,11 @@ # should only execute this code once per line fileline = fileLines[line].rstrip("\n\r") try: - cluster_interval = GenomicInterval( g1, fileline.split("\t"), - g1.chrom_col, + cluster_interval = GenomicInterval( g1, fileline.split("\t"), + g1.chrom_col, g1.start_col, - g1.end_col, - g1.strand_col, + g1.end_col, + g1.strand_col, g1.default_strand, g1.fix_strand ) except Exception, exc: @@ -114,14 +116,14 @@ interval_size = cluster_interval.end - cluster_interval.start if outsize == -1 or \ ( outsize > interval_size and output == 4 ) or \ - ( outsize < interval_size and output == 5 ) : + ( outsize < interval_size and output == 5 ): outinterval = cluster_interval outsize = interval_size out_file.write( "%s\n" % outinterval ) f1.close() out_file.close() - + if g1.skipped > 0: print skipped( g1, filedesc="" ) diff -r e84cc9cf3ba1 -r 1e895b74f29f operation_filter.py --- a/operation_filter.py Mon Apr 14 09:05:51 2014 -0400 +++ b/operation_filter.py Tue Oct 13 12:49:20 2015 -0400 @@ -1,7 +1,4 @@ # runs after the job (and after the default post-filter) -import os -from galaxy import eggs -from galaxy import jobs from galaxy.tools.parameters import DataToolParameter from galaxy.jobs.handler import JOB_ERROR @@ -12,11 +9,6 @@ except: from sets import Set as set -#def exec_before_process(app, inp_data, out_data, param_dict, tool=None): -# """Sets the name of the data""" -# dbkeys = sets.Set( [data.dbkey for data in inp_data.values() ] ) -# if len(dbkeys) != 1: -# raise Exception, '
Both Queries must be from the same genome build
' def validate_input( trans, error_map, param_values, page_param_map ): dbkeys = set() @@ -25,7 +17,7 @@ for name, param in page_param_map.iteritems(): if isinstance( param, DataToolParameter ): # for each dataset parameter - if param_values.get(name, None) != None: + if param_values.get(name, None) is not None: dbkeys.add( param_values[name].dbkey ) data_params += 1 # check meta data @@ -34,17 +26,15 @@ if isinstance( param.datatype, trans.app.datatypes_registry.get_datatype_by_extension( 'gff' ).__class__ ): # TODO: currently cannot validate GFF inputs b/c they are not derived from interval. pass - else: # Validate interval datatype. - startCol = int( param.metadata.startCol ) - endCol = int( param.metadata.endCol ) - chromCol = int( param.metadata.chromCol ) + else: # Validate interval datatype. + int( param.metadata.startCol ) + int( param.metadata.endCol ) + int( param.metadata.chromCol ) if param.metadata.strandCol is not None: - strandCol = int ( param.metadata.strandCol ) - else: - strandCol = 0 + int( param.metadata.strandCol ) except: error_msg = "The attributes of this dataset are not properly set. " + \ - "Click the pencil icon in the history item to set the chrom, start, end and strand columns." + "Click the pencil icon in the history item to set the chrom, start, end and strand columns." error_map[name] = error_msg data_param_names.add( name ) if len( dbkeys ) > 1: @@ -55,38 +45,33 @@ for name in data_param_names: error_map[name] = "A dataset of the appropriate type is required" + # Commented out by INS, 5/30/2007. What is the PURPOSE of this? def exec_after_process(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): """Verify the output data after each run""" - items = out_data.items() - - for name, data in items: + for data in out_data.values(): try: if stderr and len( stderr ) > 0: raise Exception( stderr ) - except Exception, exc: + except Exception: data.blurb = JOB_ERROR data.state = JOB_ERROR -## def exec_after_process(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): -## pass - def exec_after_merge(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): exec_after_process( app, inp_data, out_data, param_dict, tool=tool, stdout=stdout, stderr=stderr) # strip strand column if clusters were merged - items = out_data.items() - for name, data in items: - if param_dict['returntype'] == True: + for data in out_data.values(): + if param_dict['returntype'] is True: data.metadata.chromCol = 1 data.metadata.startCol = 2 data.metadata.endCol = 3 # merge always clobbers strand data.metadata.strandCol = None - + def exec_after_cluster(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): exec_after_process( @@ -94,6 +79,5 @@ # strip strand column if clusters were merged if param_dict["returntype"] == '1': - items = out_data.items() - for name, data in items: + for data in out_data.values(): data.metadata.strandCol = None diff -r e84cc9cf3ba1 -r 1e895b74f29f tool_dependencies.xml --- a/tool_dependencies.xml Mon Apr 14 09:05:51 2014 -0400 +++ b/tool_dependencies.xml Tue Oct 13 12:49:20 2015 -0400 @@ -1,9 +1,9 @@