5 # Merge two or more collections together. Can also be used to extract specific
6 # files from a collection to produce a new collection.
9 # An array of collections or collection/file paths in script_parameter["input"]
12 # A manifest with the collections merged. Duplicate file names will
13 # have their contents concatenated in the order that they appear in the input
18 import crunchutil.subst as subst
23 p = arvados.current_job()['script_parameters']
28 c = subst.do_substitution(p, c)
32 merged += arvados.CollectionReader(c).manifest_text()
35 cr = arvados.CollectionReader(c[0:i])
41 for s in cr.all_streams():
42 if s.name() == stream:
44 merged += s.files()[fn].as_manifest()
46 arvados.current_task().set_output(merged)