Mercurial > repos > stevecassidy > ziptools
comparison zipcollection.py @ 0:fe887de9b4b5 draft
planemo upload for repository https://github.com/Alveo/alveo-galaxy-tools commit b5b26e9118f2ad8af109d606746b39a5588f0511-dirty
author | stevecassidy |
---|---|
date | Thu, 16 Nov 2017 06:19:53 -0500 |
parents | |
children | 278da6e5ab11 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:fe887de9b4b5 |
---|---|
1 from __future__ import print_function | |
2 import argparse | |
3 from zipfile import ZipFile | |
4 | |
5 def parser(): | |
6 parser = argparse.ArgumentParser(description="Find matching segments in a TextGrid") | |
7 parser.add_argument('--dataset', required=True, action="store", type=str, help="TextGrid files (comma separated)") | |
8 parser.add_argument('--identifier', required=True, action="store", type=str, help="Dataset identifiers (comma separated)") | |
9 parser.add_argument('--output', required=True, action="store", type=str, help="Path to output file") | |
10 return parser.parse_args() | |
11 | |
12 | |
13 def main(): | |
14 args = parser() | |
15 | |
16 datasets = args.dataset.split(',') | |
17 identifiers = args.identifier.split(',') | |
18 assert len(datasets) == len(identifiers), "number of datasets must match number of identifiers" | |
19 | |
20 pairs = zip(datasets, identifiers) | |
21 | |
22 with ZipFile(args.output, 'w') as zipfile: | |
23 for dataset, identifier in pairs: | |
24 zipfile.write(dataset, identifier) | |
25 | |
26 | |
27 if __name__ == '__main__': | |
28 main() |