Mercurial > repos > devteam > join
changeset 4:a10f49d9218a draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/join commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author | devteam |
---|---|
date | Thu, 22 Jun 2017 18:52:36 -0400 |
parents | ffbd1de29c28 |
children | 718d04143c31 |
files | gops_join.py join.xml macros.xml operation_filter.py tool_dependencies.xml |
diffstat | 5 files changed, 111 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/gops_join.py Wed Nov 11 12:48:58 2015 -0500 +++ b/gops_join.py Thu Jun 22 18:52:36 2017 -0400 @@ -8,11 +8,14 @@ -m, --mincols=N: Require this much overlap (default 1bp) -f, --fill=N: none, right, left, both """ +from __future__ import print_function + import fileinput import sys + +from bx.cookbook import doc_optparse from bx.intervals.io import NiceReaderWrapper from bx.intervals.operations.join import join -from bx.cookbook import doc_optparse from bx.tabular.io import ParseError from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped @@ -61,7 +64,7 @@ out_file.write( "%s\n" % "\t".join( outfields ) ) else: out_file.write( "%s\n" % outfields ) - except ParseError, exc: + except ParseError as exc: out_file.close() fail( "Invalid file format: %s" % str( exc ) ) except MemoryError: @@ -71,9 +74,10 @@ out_file.close() if g1.skipped > 0: - print skipped( g1, filedesc=" of 1st dataset" ) + print(skipped( g1, filedesc=" of 1st dataset" )) if g2.skipped > 0: - print skipped( g2, filedesc=" of 2nd dataset" ) + print(skipped( g2, filedesc=" of 2nd dataset" )) + if __name__ == "__main__": main()
--- a/join.xml Wed Nov 11 12:48:58 2015 -0500 +++ b/join.xml Thu Jun 22 18:52:36 2017 -0400 @@ -1,98 +1,92 @@ <tool id="gops_join_1" name="Join" version="1.0.0"> - <description>the intervals of two datasets side-by-side</description> - <requirements> - <requirement type="package" version="0.7.1">bx-python</requirement> - <requirement type="package" version="1.0.0">galaxy-ops</requirement> - </requirements> - <command interpreter="python">gops_join.py $input1 $input2 $output -1 ${input1.metadata.chromCol},${input1.metadata.startCol},${input1.metadata.endCol},${input1.metadata.strandCol} -2 ${input2.metadata.chromCol},${input2.metadata.startCol},${input2.metadata.endCol},${input2.metadata.strandCol} -m $min -f $fill</command> - <inputs> - <param format="interval" name="input1" type="data" help="First dataset"> - <label>Join</label> - </param> - <param format="interval" name="input2" type="data" help="Second dataset"> - <label>with</label> - </param> - <param name="min" type="integer" value="1" help="(bp)"> - <label>with min overlap</label> - </param> - <param name="fill" type="select" label="Return"> - <option value="none">Only records that are joined (INNER JOIN)</option> - <option value="right">All records of first dataset (fill null with ".")</option> - <option value="left">All records of second dataset (fill null with ".")</option> - <option value="both">All records of both datasets (fill nulls with ".")</option> - </param> - </inputs> - <outputs> - <data format="interval" name="output" metadata_source="input1" /> - </outputs> - <code file="operation_filter.py"/> - <tests> - <test> - <param name="input1" value="1.bed" /> - <param name="input2" value="2.bed" /> - <param name="min" value="1" /> - <param name="fill" value="none" /> - <output name="output" file="gops-join-none.dat" /> - </test> - <test> - <param name="input1" value="1.bed" /> - <param name="input2" value="2.bed" /> - <param name="min" value="1" /> - <param name="fill" value="right" /> - <output name="output" file="gops-join-right.dat" /> - </test> - <test> - <param name="input1" value="1.bed" /> - <param name="input2" value="2.bed" /> - <param name="min" value="1" /> - <param name="fill" value="left" /> - <output name="output" file="gops-join-left.dat" /> - </test> - <test> - <param name="input1" value="1.bed" /> - <param name="input2" value="2.bed" /> - <param name="min" value="1" /> - <param name="fill" value="both" /> - <output name="output" file="gops-join-both.dat" /> - </test> - <test> - <param name="input1" value="1.bed" /> - <param name="input2" value="2.bed" /> - <param name="min" value="500" /> - <param name="fill" value="none" /> - <output name="output" file="gops-join-none-500.dat" /> - </test> - <test> - <param name="input1" value="1.bed" /> - <param name="input2" value="2.bed" /> - <param name="min" value="100" /> - <param name="fill" value="both" /> - <output name="output" file="gops-join-both-100.dat" /> - </test> - </tests> - <help> - + <description>the intervals of two datasets side-by-side</description> + <macros> + <import>macros.xml</import> + </macros> + <expand macro="requirements" /> + <code file="operation_filter.py"/> + <command><![CDATA[ +python '$__tool_directory__/gops_join.py' +'$input1' +'$input2' +'$output' +-1 ${input1.metadata.chromCol},${input1.metadata.startCol},${input1.metadata.endCol},${input1.metadata.strandCol} +-2 ${input2.metadata.chromCol},${input2.metadata.startCol},${input2.metadata.endCol},${input2.metadata.strandCol} +-m $min +-f $fill + ]]></command> + <inputs> + <param name="input1" type="data" format="interval" label="Join" help="First dataset" /> + <param name="input2" type="data" format="interval" label="With" help="Second dataset" /> + <param name="min" type="integer" value="1" label="With min overlap" help="(bp)" /> + <param name="fill" type="select" label="Return"> + <option value="none">Only records that are joined (INNER JOIN)</option> + <option value="right">All records of first dataset (fill null with ".")</option> + <option value="left">All records of second dataset (fill null with ".")</option> + <option value="both">All records of both datasets (fill nulls with ".")</option> + </param> + </inputs> + <outputs> + <data name="output" format_source="input1" metadata_source="input1" /> + </outputs> + <tests> + <test> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /> + <param name="min" value="1" /> + <param name="fill" value="none" /> + <output name="output" file="gops-join-none.dat" /> + </test> + <test> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /> + <param name="min" value="1" /> + <param name="fill" value="right" /> + <output name="output" file="gops-join-right.dat" /> + </test> + <test> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /> + <param name="min" value="1" /> + <param name="fill" value="left" /> + <output name="output" file="gops-join-left.dat" /> + </test> + <test> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /> + <param name="min" value="1" /> + <param name="fill" value="both" /> + <output name="output" file="gops-join-both.dat" /> + </test> + <test> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /> + <param name="min" value="500" /> + <param name="fill" value="none" /> + <output name="output" file="gops-join-none-500.dat" /> + </test> + <test> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /> + <param name="min" value="100" /> + <param name="fill" value="both" /> + <output name="output" file="gops-join-both-100.dat" /> + </test> + </tests> + <help><![CDATA[ .. class:: infomark **TIP:** If your dataset does not appear in the pulldown menu, it means that it is not in interval format. Use "edit attributes" to set chromosome, start, end, and strand columns. ------ - -**Screencasts!** - -See Galaxy Interval Operation Screencasts_ (right click to open this link in another window). - -.. _Screencasts: http://wiki.g2.bx.psu.edu/Learn/Interval%20Operations - ------ +@SCREENCASTS@ **Syntax** - **Where overlap** specifies the minimum overlap between intervals that allows them to be joined. -- **Return only records that are joined** returns only the records of the first dataset that join to a record in the second dataset. This is analogous to an INNER JOIN. -- **Return all records of first dataset (fill null with ".")** returns all intervals of the first dataset, and any intervals that do not join an interval from the second dataset are filled in with a period(.). This is analogous to a LEFT JOIN. -- **Return all records of second dataset (fill null with ".")** returns all intervals of the second dataset, and any intervals that do not join an interval from the first dataset are filled in with a period(.). **Note that this may produce an invalid interval file, since a period(.) is not a valid chrom, start, end or strand.** -- **Return all records of both datasets (fill nulls with ".")** returns all records from both datasets, and fills on either the right or left with periods. **Note that this may produce an invalid interval file, since a period(.) is not a valid chrom, start, end or strand.** +- **Return only records that are joined** returns only the records of the first dataset that join to a record in the second dataset. This is analogous to an INNER JOIN. +- **Return all records of first dataset (fill null with ".")** returns all intervals of the first dataset, and any intervals that do not join an interval from the second dataset are filled in with a period(.). This is analogous to a LEFT JOIN. +- **Return all records of second dataset (fill null with ".")** returns all intervals of the second dataset, and any intervals that do not join an interval from the first dataset are filled in with a period(.). **Note that this may produce an invalid interval file, since a period(.) is not a valid chrom, start, end or strand.** +- **Return all records of both datasets (fill nulls with ".")** returns all records from both datasets, and fills on either the right or left with periods. **Note that this may produce an invalid interval file, since a period(.) is not a valid chrom, start, end or strand.** ----- @@ -115,7 +109,5 @@ All records of both datasets: .. image:: gops_joinFullOuter.gif - - -</help> + ]]></help> </tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Thu Jun 22 18:52:36 2017 -0400 @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<macros> + <xml name="requirements"> + <requirements> + <requirement type="package" version="0.7.1">bx-python</requirement> + <requirement type="package" version="1.0.0">galaxy-ops</requirement> + </requirements> + </xml> + <token name="@SCREENCASTS@"> +----- + +**Screencasts!** + +See Galaxy Interval Operation Screencasts_ (right click to open this link in another window). + +.. _Screencasts: https://galaxyproject.org/learn/interval-operations/ + +----- + </token> +</macros>
--- a/operation_filter.py Wed Nov 11 12:48:58 2015 -0500 +++ b/operation_filter.py Thu Jun 22 18:52:36 2017 -0400 @@ -1,8 +1,7 @@ # runs after the job (and after the default post-filter) +from galaxy.jobs.handler import JOB_ERROR from galaxy.tools.parameters import DataToolParameter -from galaxy.jobs.handler import JOB_ERROR - # Older py compatibility try: set() @@ -14,7 +13,7 @@ dbkeys = set() data_param_names = set() data_params = 0 - for name, param in page_param_map.iteritems(): + for name, param in page_param_map.items(): if isinstance( param, DataToolParameter ): # for each dataset parameter if param_values.get(name, None) is not None: @@ -53,7 +52,6 @@ try: if stderr and len( stderr ) > 0: raise Exception( stderr ) - except Exception: data.blurb = JOB_ERROR data.state = JOB_ERROR
--- a/tool_dependencies.xml Wed Nov 11 12:48:58 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -<?xml version="1.0"?> -<tool_dependency> - <package name="bx-python" version="0.7.1"> - <repository changeset_revision="2d0c08728bca" name="package_bx_python_0_7" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" /> - </package> - <package name="galaxy-ops" version="1.0.0"> - <repository changeset_revision="9cbb20b85c01" name="package_galaxy_ops_1_0_0" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" /> - </package> -</tool_dependency>