# HG changeset patch # User iuc # Date 1606053301 0 # Node ID 97f70f7ed0771fbd503220bfa3c509bb516d5878 # Parent f067504aa92a77dc8e8be5edd5577e0ad6607162 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/idr_download commit e337464c8219abdb7e8664ba94cff46025070664" diff -r f067504aa92a -r 97f70f7ed077 idr_download_by_ids.py --- 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: diff -r f067504aa92a -r 97f70f7ed077 idr_download_by_ids.xml --- a/idr_download_by_ids.xml Thu Nov 05 23:29:40 2020 +0000 +++ b/idr_download_by_ids.xml Sun Nov 22 13:55:01 2020 +0000 @@ -1,6 +1,6 @@ - - - download images from the Image Data Resource using image IDs + + - download images from any OMERO instance using image IDs Preferences -> Manage Information" && - exit 1 + #if $omero_instance_type.galaxy_test_param != 'true' and ($username == "" or $password ==""): + echo "OMERO connection credentials are empty. Set your credentials via: User -> Preferences -> Manage Information" 1>&2 && + exit 1 && #end if #end if @@ -51,13 +53,28 @@ $skip_failed $download_tar #if $omero_instance_type.omero_instance =='priv': - -h '$omero_host' - $omero_secured - -u '$username' - -p '$password' + -oh '$omero_instance_type.omero_host' + $omero_instance_type.omero_secured + -cf '$credentials' #end if 2> >(tee -a $out_log >&2) ]]> + + + - - [.A-Za-z0-9_-] - + ^[a-zA-Z0-9._-]*$ + '..' not in value - + @@ -300,6 +317,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +