diff --git a/config/tool_conf.xml.sample b/config/tool_conf.xml.sample
index 3e19d92f265..2f039985374 100644
--- a/config/tool_conf.xml.sample
+++ b/config/tool_conf.xml.sample
@@ -36,6 +36,7 @@
+
diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py
index b84709615f6..94c65ed43d2 100755
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -2506,11 +2506,31 @@ class FlattenTool( DatabaseOperationTool ):
)
+class RelabelFromFileTool( DatabaseOperationTool ):
+ tool_type = 'relabel_from_file'
+
+ def produce_outputs( self, trans, out_data, output_collections, incoming, history ):
+ hdca = incoming[ "input" ]
+ new_labels_dataset_assoc = incoming[ "labels" ]
+ new_elements = odict()
+ log.info(new_labels_dataset_assoc)
+ new_labels_path = new_labels_dataset_assoc.file_name
+ new_labels = open(new_labels_path, "r").readlines(1024 * 1000000)
+
+ for i, dce in enumerate(hdca.collection.elements):
+ dce_object = dce.element_object
+ new_elements[new_labels[i].strip()] = dce_object.copy()
+
+ output_collections.create_collection(
+ next(iter(self.outputs.values())), "output", elements=new_elements
+ )
+
+
# Populate tool_type to ToolClass mappings
tool_types = {}
for tool_class in [ Tool, SetMetadataTool, OutputParameterJSONTool,
DataManagerTool, DataSourceTool, AsyncDataSourceTool,
- UnzipCollectionTool, ZipCollectionTool, MergeCollectionTool,
+ UnzipCollectionTool, ZipCollectionTool, MergeCollectionTool, RelabelFromFileTool,
DataDestinationTool ]:
tool_types[ tool_class.tool_type ] = tool_class
diff --git a/lib/galaxy/tools/relabel_from_file.xml b/lib/galaxy/tools/relabel_from_file.xml
new file mode 100644
index 00000000000..f52c9e38ef9
--- /dev/null
+++ b/lib/galaxy/tools/relabel_from_file.xml
@@ -0,0 +1,53 @@
+
+ from contents of a file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This tool will take an input list and a text file with new identifiers
+ and build a new list with the same datasets but these new identifiers.
+
+ This tool will create new history datasets from your collection
+ but your quota usage will not increase.
+
+
diff --git a/test-data/new_labels_1.txt b/test-data/new_labels_1.txt
new file mode 100644
index 00000000000..3fe0afa80c6
--- /dev/null
+++ b/test-data/new_labels_1.txt
@@ -0,0 +1 @@
+new_i1
\ No newline at end of file
diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml
index 59f76c37d1d..35a1480f817 100644
--- a/test/functional/tools/samples_tool_conf.xml
+++ b/test/functional/tools/samples_tool_conf.xml
@@ -146,5 +146,6 @@
+