comparison idr_download_by_ids.py @ 7:f067504aa92a draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/idr_download commit 6b9df5f3cf2518e48eced93a2904a89776bde02d"
author iuc
date Thu, 05 Nov 2020 23:29:40 +0000
parents 5c743356df83
children 97f70f7ed077
comparison
equal deleted inserted replaced
6:5c743356df83 7:f067504aa92a
110 110
111 def download_image_data( 111 def download_image_data(
112 image_ids, 112 image_ids,
113 channel=None, z_stack=0, frame=0, 113 channel=None, z_stack=0, frame=0,
114 coord=(0, 0), width=0, height=0, region_spec='rectangle', 114 coord=(0, 0), width=0, height=0, region_spec='rectangle',
115 skip_failed=False, download_tar=False 115 skip_failed=False, download_tar=False, omero_host='idr.openmicroscopy.org', omero_secured=True, omero_username='public', omero_password='public'
116 ): 116 ):
117 # basic argument sanity checks and adjustments 117 # basic argument sanity checks and adjustments
118 prefix = 'image-' 118 prefix = 'image-'
119 # normalize image ids by stripping off prefix if it exists 119 # normalize image ids by stripping off prefix if it exists
120 image_ids = [ 120 image_ids = [
125 if region_spec not in ['rectangle', 'center']: 125 if region_spec not in ['rectangle', 'center']:
126 raise ValueError( 126 raise ValueError(
127 'Got unknown value "{0}" as region_spec argument' 127 'Got unknown value "{0}" as region_spec argument'
128 .format(region_spec) 128 .format(region_spec)
129 ) 129 )
130
131 with ExitStack() as exit_stack: 130 with ExitStack() as exit_stack:
132 # connect to idr
133 conn = exit_stack.enter_context( 131 conn = exit_stack.enter_context(
134 BlitzGateway( 132 BlitzGateway(
135 'public', 'public', 133 omero_username, omero_password,
136 host='idr.openmicroscopy.org', 134 host=omero_host,
137 secure=True 135 secure=omero_secured
138 ) 136 )
139 ) 137 )
140 # exit_stack.callback(conn.connect().close) 138 # exit_stack.callback(conn.connect().close)
141 if download_tar: 139 if download_tar:
142 # create an archive file to write images to 140 # create an archive file to write images to
354 '--skip-failed', action='store_true' 352 '--skip-failed', action='store_true'
355 ) 353 )
356 p.add_argument( 354 p.add_argument(
357 '--download-tar', action='store_true' 355 '--download-tar', action='store_true'
358 ) 356 )
357 p.add_argument(
358 '-oh', '--omero-host', type=str, default="idr.openmicroscopy.org"
359 )
360 p.add_argument(
361 '--omero-secured', action='store_false'
362 )
363 p.add_argument(
364 '-u', '--omero-username', type=str, default="public"
365 )
366 p.add_argument(
367 '-p', '--omero-password', type=str, default="public"
368 )
359 args = p.parse_args() 369 args = p.parse_args()
360 if not args.image_ids: 370 if not args.image_ids:
361 args.image_ids = sys.stdin.read().split() 371 args.image_ids = sys.stdin.read().split()
362 if 'center' in args: 372 if 'center' in args:
363 args.coord, args.width, args.height = ( 373 args.coord, args.width, args.height = (