Keep old and new version

This commit is contained in:
mvdbeek
2025-05-13 15:47:48 +02:00
parent 065ebd53c3
commit 490766e539
7 changed files with 319 additions and 3 deletions
@@ -11,7 +11,6 @@
</edam_operations>
<inputs>
<param type="data_collection" collection_type="list,list:paired" name="input" label="Input Collection" />
<param type="data" name="replacement" optional="true" label="Replace empty elements with this dataset" help="If provided, empty elements will be replaced with this dataset"/>
</inputs>
<outputs>
<collection name="output" format_source="input" type_source="input" label="${on_string} (filtered empty datasets)" >
@@ -0,0 +1,57 @@
<tool id="__FILTER_EMPTY_DATASETS__"
name="Filter empty datasets"
version="1.1.0"
tool_type="filter_empty_datasets_collection">
<description></description>
<type class="FilterEmptyDatasetsTool" module="galaxy.tools" />
<action module="galaxy.tools.actions.model_operations"
class="ModelOperationToolAction"/>
<edam_operations>
<edam_operation>operation_3695</edam_operation>
</edam_operations>
<inputs>
<param type="data_collection" collection_type="list,list:paired" name="input" label="Input Collection" />
<param type="data" name="replacement" optional="true" label="Replace empty elements with this dataset" help="If provided, empty elements will be replaced with this dataset"/>
</inputs>
<outputs>
<collection name="output" format_source="input" type_source="input" label="${on_string} (filtered empty datasets)" >
</collection>
</outputs>
<tests>
<test>
<param name="input">
<collection type="list">
<element name="e1" value="simple_line.txt" />
</collection>
</param>
<output_collection name="output" type="list" count="1">
<element name="e1">
<assert_contents>
<has_text_matching expression="^This is a line of text.\n$" />
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
========
Synopsis
========
Removes empty elements from a collection.
This tool takes a dataset collection and filters out (removes) empty datasets. This is useful for continuing a multi-sample analysis when downstream tools require datasets to have content.
.. image:: ${static_path}/images/tools/collection_ops/filter_empty.svg
:width: 500
:alt: Filtering empty datasets
-----
.. class:: infomark
This tool will create new history datasets from your collection but your quota usage will not increase.
]]></help>
</tool>
+150
View File
@@ -0,0 +1,150 @@
<tool id="__FILTER_FROM_FILE__"
name="Filter collection"
version="1.1.0"
tool_type="filter_from_file">
<description></description>
<type class="FilterFromFileTool" module="galaxy.tools" />
<action module="galaxy.tools.actions.model_operations"
class="ModelOperationToolAction"/>
<edam_operations>
<edam_operation>operation_3695</edam_operation>
</edam_operations>
<inputs>
<param type="data_collection" name="input" label="Input Collection" help="A collection whose elements will be filtered."/>
<conditional name="how">
<param type="select" name="how_filter" label="How should the elements to remove be determined?">
<option value="remove_if_absent" selected="true">Remove if identifiers are ABSENT from file</option>
<option value="remove_if_present">Remove if identifiers are PRESENT in file</option>
</param>
<when value="remove_if_absent">
<param type="data" name="filter_source" format="txt" label="Filter out identifiers absent from" />
</when>
<when value="remove_if_present">
<param type="data" name="filter_source" format="txt" label="Filter out identifiers present in" />
</when>
</conditional>
</inputs>
<outputs>
<collection name="output_filtered" format_source="input" type_source="input" label="${on_string} (filtered)" >
</collection>
<collection name="output_discarded" format_source="input" type_source="input" label="${on_string} (discarded)" >
</collection>
</outputs>
<tests>
<test>
<param name="input">
<collection type="list">
<element name="i1" value="simple_line.txt" />
<element name="i2" value="simple_line_alternative.txt" />
</collection>
</param>
<param name="how_filter" value="remove_if_present" />
<param name="filter_source" value="filter_labels_1.txt" ftype="txt" />
<output_collection name="output_filtered" type="list">
<element name="i1">
<assert_contents>
<has_text_matching expression="^This is a line of text.\n$" />
</assert_contents>
</element>
</output_collection>
<output_collection name="output_discarded" type="list">
<element name="i2">
<assert_contents>
<has_text_matching expression="^This is a different line of text.\n$" />
</assert_contents>
</element>
</output_collection>
</test>
<test>
<param name="input">
<collection type="list">
<element name="i1" value="simple_line.txt" />
<element name="i2" value="simple_line_alternative.txt" />
</collection>
</param>
<param name="how_filter" value="remove_if_absent" />
<param name="filter_source" value="filter_labels_1.txt" ftype="txt" />
<output_collection name="output_filtered" type="list">
<element name="i2">
<assert_contents>
<has_text_matching expression="^This is a different line of text.\n$" />
</assert_contents>
</element>
</output_collection>
<output_collection name="output_discarded" type="list">
<element name="i1">
<assert_contents>
<has_text_matching expression="^This is a line of text.\n$" />
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
========
Synopsis
========
Filters elements from a collection using a list supplied in a file.
===========
Description
===========
This tools allow filtering elements from a data collection. It takes an input collection and a text file with names (i.e. identifiers). The tool behavious is controlled by **How should the elements to remove be determined?** drop-down. It has the following options:
**Remove if identifiers are ABSENT from file**
Given a collection::
Collection: [Dataset A]
[Dataset B]
[Dataset X]
and a text file::
A
B
Z
the tool will return two collections::
(filtered): [Dataset A]
[Dataset B]
(discarded): [Dataset X]
------
**Remove if identifiers are PRESENT in file**
Given a collection::
Collection: [Dataset A]
[Dataset B]
[Dataset X]
and a text file::
A
B
Z
the tool will return two collections::
(filtered): [Dataset X]
(discarded): [Dataset A]
[Dataset B]
.. class:: warningmark
**Note** how the tool deals with the ``Z`` entry.
.. class:: infomark
This tool will create new history datasets from your collection but your quota usage will not increase.
]]></help>
</tool>
-1
View File
@@ -7,7 +7,6 @@
</edam_operations>
<inputs>
<param type="data_collection" collection_type="list,list:paired" name="input" label="Input Collection"/>
<param type="data" name="replacement" optional="true" label="Replace null elements with this dataset" help="If provided, null elements will be replaced with this dataset"/>
</inputs>
<outputs>
<collection name="output" format_source="input" type_source="input" label="${on_string} (without null datasets)">
+47
View File
@@ -0,0 +1,47 @@
<tool id="__FILTER_NULL__" name="Filter null elements" version="1.1.0" tool_type="filter_null">
<description/>
<type class="FilterNullTool" module="galaxy.tools"/>
<action module="galaxy.tools.actions.model_operations" class="ModelOperationToolAction"/>
<edam_operations>
<edam_operation>operation_3695</edam_operation>
</edam_operations>
<inputs>
<param type="data_collection" collection_type="list,list:paired" name="input" label="Input Collection"/>
<param type="data" name="replacement" optional="true" label="Replace null elements with this dataset" help="If provided, null elements will be replaced with this dataset"/>
</inputs>
<outputs>
<collection name="output" format_source="input" type_source="input" label="${on_string} (without null datasets)">
</collection>
</outputs>
<tests>
<test>
<param name="input">
<collection type="list">
<element name="e1" value="simple_line.txt"/>
</collection>
</param>
<output_collection name="output" type="list" count="1">
<element name="e1">
<assert_contents>
<has_text_matching expression="^This is a line of text.\n$"/>
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
========
Synopsis
========
Removes null elements from a collection.
This tool takes a dataset collection and filters out nulls. This is useful for removing elements that resulted from conditional execution of jobs.
.. class:: infomark
This tool will create new history datasets from your collection but your quota usage will not increase.
]]></help>
</tool>
@@ -11,7 +11,6 @@
</edam_operations>
<inputs>
<param type="data_collection" collection_type="list,list:paired" name="input" label="Input Collection" />
<param type="data" name="replacement" optional="true" label="Replace unsuccessful elements with this dataset" help="If provided, unsuccessful elements will be replaced with this dataset"/>
</inputs>
<outputs>
<collection name="output" format_source="input" type_source="input" label="${on_string} (only successed datasets)" >
@@ -0,0 +1,65 @@
<tool id="__KEEP_SUCCESS_DATASETS__"
name="Keep success"
version="1.1.0"
tool_type="keep_success_datasets_collection">
<description></description>
<type class="KeepSuccessDatasetsTool" module="galaxy.tools" />
<action module="galaxy.tools.actions.model_operations"
class="ModelOperationToolAction"/>
<edam_operations>
<edam_operation>operation_3695</edam_operation>
</edam_operations>
<inputs>
<param type="data_collection" collection_type="list,list:paired" name="input" label="Input Collection" />
<param type="data" name="replacement" optional="true" label="Replace unsuccessful elements with this dataset" help="If provided, unsuccessful elements will be replaced with this dataset"/>
</inputs>
<outputs>
<collection name="output" format_source="input" type_source="input" label="${on_string} (only successed datasets)" >
</collection>
</outputs>
<tests>
<!-- Test framework has no way of creating a collection with
unsuccess elements, so best we can do is verify identity on
an okay collection.
-->
<test>
<param name="input">
<collection type="list">
<element name="e1" value="simple_line.txt" />
</collection>
</param>
<output_collection name="output" type="list">
<element name="e1">
<assert_contents>
<has_text_matching expression="^This is a line of text.\n$" />
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
========
Synopsis
========
Keep datasets in success (green) from a collection.
===========
Description
===========
This tool takes a dataset collection and filters in (keep) datasets in the success (green) state. This is useful for continuing a multi-sample analysis when one of more of the samples fails or is in paused state.
.. image:: ${static_path}/images/tools/collection_ops/keep_success.svg
:width: 500
:alt: Keep success datasets
-----
.. class:: infomark
This tool will create new history datasets from your collection but your quota usage will not increase.
]]></help>
</tool>