# HG changeset patch # User stevecassidy # Date 1510831193 18000 # Node ID fe887de9b4b51f258c048beefe3f777bb8574d3f planemo upload for repository https://github.com/Alveo/alveo-galaxy-tools commit b5b26e9118f2ad8af109d606746b39a5588f0511-dirty diff -r 000000000000 -r fe887de9b4b5 zipcollection.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zipcollection.py Thu Nov 16 06:19:53 2017 -0500 @@ -0,0 +1,28 @@ +from __future__ import print_function +import argparse +from zipfile import ZipFile + +def parser(): + parser = argparse.ArgumentParser(description="Find matching segments in a TextGrid") + parser.add_argument('--dataset', required=True, action="store", type=str, help="TextGrid files (comma separated)") + parser.add_argument('--identifier', required=True, action="store", type=str, help="Dataset identifiers (comma separated)") + parser.add_argument('--output', required=True, action="store", type=str, help="Path to output file") + return parser.parse_args() + + +def main(): + args = parser() + + datasets = args.dataset.split(',') + identifiers = args.identifier.split(',') + assert len(datasets) == len(identifiers), "number of datasets must match number of identifiers" + + pairs = zip(datasets, identifiers) + + with ZipFile(args.output, 'w') as zipfile: + for dataset, identifier in pairs: + zipfile.write(dataset, identifier) + + +if __name__ == '__main__': + main() diff -r 000000000000 -r fe887de9b4b5 zipcollection.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zipcollection.xml Thu Nov 16 06:19:53 2017 -0500 @@ -0,0 +1,31 @@ + + from one or more datasets + + + zipcollection.py --dataset "${",".join(map(str, $dataset))}" --identifier "${",".join(map(str, [t.element_identifier + "." + t.extension for t in $dataset]))}" --output $output + + + + + + + + + + + + + + + + Creates a zip file from a dataset or dataset collection + +