Mercurial > repos > iuc > idr_download_by_ids
diff idr_download_by_ids.py @ 8:97f70f7ed077 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/idr_download commit e337464c8219abdb7e8664ba94cff46025070664"
author | iuc |
---|---|
date | Sun, 22 Nov 2020 13:55:01 +0000 |
parents | f067504aa92a |
children | 4aed70472589 |
line wrap: on
line diff
--- a/idr_download_by_ids.py Thu Nov 05 23:29:40 2020 +0000 +++ b/idr_download_by_ids.py Sun Nov 22 13:55:01 2020 +0000 @@ -1,4 +1,5 @@ import argparse +import json import os import sys import tarfile @@ -112,8 +113,22 @@ image_ids, channel=None, z_stack=0, frame=0, coord=(0, 0), width=0, height=0, region_spec='rectangle', - skip_failed=False, download_tar=False, omero_host='idr.openmicroscopy.org', omero_secured=True, omero_username='public', omero_password='public' + skip_failed=False, download_tar=False, omero_host='idr.openmicroscopy.org', omero_secured=False, config_file=None ): + + if config_file is None: # IDR connection + omero_username = 'public' + omero_password = 'public' + else: # other omero instance + with open(config_file) as f: + cfg = json.load(f) + omero_username = cfg['username'] + omero_password = cfg['password'] + + if omero_username == "" or omero_password == "": + omero_username = 'public' + omero_password = 'public' + # basic argument sanity checks and adjustments prefix = 'image-' # normalize image ids by stripping off prefix if it exists @@ -358,13 +373,10 @@ '-oh', '--omero-host', type=str, default="idr.openmicroscopy.org" ) p.add_argument( - '--omero-secured', action='store_false' + '--omero-secured', action='store_true', default=True ) p.add_argument( - '-u', '--omero-username', type=str, default="public" - ) - p.add_argument( - '-p', '--omero-password', type=str, default="public" + '-cf', '--config-file', dest='config_file', default=None ) args = p.parse_args() if not args.image_ids: