Repository 'idr_download_by_ids'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/idr_download_by_ids

Changeset 7:f067504aa92a (2020-11-05)
Previous changeset 6:5c743356df83 (2020-07-06) Next changeset 8:97f70f7ed077 (2020-11-22)
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/idr_download commit 6b9df5f3cf2518e48eced93a2904a89776bde02d"
modified:
idr_download_by_ids.py
idr_download_by_ids.xml
added:
README.md
test-data/test0.tiff
b
diff -r 5c743356df83 -r f067504aa92a README.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md Thu Nov 05 23:29:40 2020 +0000
b
@@ -0,0 +1,18 @@
+## Set up user credentials on Galaxy to connect to other omero instance
+
+To enable users to set their credentials for this tool,
+make sure the file `config/user_preferences_extra.yml` has the following section:
+
+```
+    omero_account:
+        description: Your OMERO instance connection credentials
+        inputs:
+            - name: username
+              label: Username
+              type: text
+              required: False
+            - name: password
+              label: Password
+              type:  password
+              required: False
+```
b
diff -r 5c743356df83 -r f067504aa92a idr_download_by_ids.py
--- a/idr_download_by_ids.py Mon Jul 06 19:33:59 2020 -0400
+++ b/idr_download_by_ids.py Thu Nov 05 23:29:40 2020 +0000
b
@@ -112,7 +112,7 @@
     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
+    skip_failed=False, download_tar=False, omero_host='idr.openmicroscopy.org', omero_secured=True, omero_username='public', omero_password='public'
 ):
     # basic argument sanity checks and adjustments
     prefix = 'image-'
@@ -127,14 +127,12 @@
             'Got unknown value "{0}" as region_spec argument'
             .format(region_spec)
         )
-
     with ExitStack() as exit_stack:
-        # connect to idr
         conn = exit_stack.enter_context(
             BlitzGateway(
-                'public', 'public',
-                host='idr.openmicroscopy.org',
-                secure=True
+                omero_username, omero_password,
+                host=omero_host,
+                secure=omero_secured
             )
         )
         # exit_stack.callback(conn.connect().close)
@@ -356,6 +354,18 @@
     p.add_argument(
         '--download-tar', action='store_true'
     )
+    p.add_argument(
+        '-oh', '--omero-host', type=str, default="idr.openmicroscopy.org"
+    )
+    p.add_argument(
+        '--omero-secured', action='store_false'
+    )
+    p.add_argument(
+        '-u', '--omero-username', type=str, default="public"
+    )
+    p.add_argument(
+        '-p', '--omero-password', type=str, default="public"
+    )
     args = p.parse_args()
     if not args.image_ids:
         args.image_ids = sys.stdin.read().split()
b
diff -r 5c743356df83 -r f067504aa92a idr_download_by_ids.xml
--- a/idr_download_by_ids.xml Mon Jul 06 19:33:59 2020 -0400
+++ b/idr_download_by_ids.xml Thu Nov 05 23:29:40 2020 +0000
[
b'@@ -1,5 +1,5 @@\n <?xml version="1.0"?>\n-<tool id="idr_download_by_ids" name="IDR Download" version="0.42" profile="18.09">\n+<tool id="idr_download_by_ids" name="IDR Download" version="0.43" profile="18.09">\n     <description>- download images from the Image Data Resource using image IDs</description>\n     <macros>\n         <xml name="region_spec" token_pos="upper-left corner">\n@@ -16,10 +16,21 @@\n         </xml>\n     </macros>\n     <requirements>\n-        <requirement type="package" version="5.6.0">python-omero</requirement>\n+        <requirement type="package" version="5.7.1">python-omero</requirement>\n         <requirement type="package" version="0.4.2">pylibtiff</requirement>\n     </requirements>\n     <command detect_errors="exit_code"><![CDATA[\n+        \n+        #if $omero_instance_type.omero_instance == "priv":\n+            #set $username = $__user__.extra_preferences.get(\'omero_account|username\', "")\n+            #set $password = $__user__.extra_preferences.get(\'omero_account|password\', "")\n+\n+            #if $username == "" or $password =="":\n+                echo "OMERO connection credentials are empty. Set your credentials via: User -> Preferences -> Manage Information"  &&\n+                exit 1\n+            #end if\n+        #end if\n+        \n         mkdir downloads && cd downloads &&\n         #if str($image_ids.source) == \'link\':\n             python -c \'print("${image_ids.id_spec}".replace(",", "|").split("?show=")[-1].replace("|", "\\n"))\'\n@@ -39,10 +50,35 @@\n         #end if\n         $skip_failed\n         $download_tar\n-\n+        #if $omero_instance_type.omero_instance ==\'priv\':\n+            -h \'$omero_host\'\n+            $omero_secured\n+            -u \'$username\'\n+            -p \'$password\'\n+        #end if\n         2> >(tee -a $out_log >&2)\n     ]]></command>\n <inputs>\n+        <conditional name="omero_instance_type">\n+            <param name="omero_instance" type="select" label="Which OMERO instance to connect?"\n+                   help="By default, the tool will download a tarball containing individual images from IDR into your Galaxy history. If you \n+                   need to connect to your own instance, set your connection username and password from User->Preference->Manage Information" >\n+                <option value="idr">IDR</option>\n+                <option value="priv">other OMERO instance</option>\n+            </param>\n+            <when value="priv">\n+                <param name="omero_host" type="text" label="OMERO host URL">\n+                    <validator type="regex" message="Enter a valid host location, for example, your.omero.server">\n+                        [.A-Za-z0-9_-]\n+                    </validator>\n+                </param>\n+                <param name="omero_secured" type="boolean" label="Seured connection?" checked="true" truevalue="--omero-secured" falsevalue=""\n+                        help="Select Yes if your OMERO instance is running with SSL, otherwise select No">\n+                </param>\n+            </when>\n+            <when value="idr" />\n+        </conditional>\n+\n         <conditional name="image_ids">\n             <param name="source" type="select" label="How would you like to specify the IDs of images to download?">\n                 <option value="link">As text (comma-separated list of IDs or a valid IDR link)</option>\n@@ -104,9 +140,32 @@\n     </outputs>\n     <tests>\n         <test>\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n             <param name="source" value="dataset" />\n             <param name="id_spec" value="ids.txt" />\n-            <param name="channel" value="615.0" />\n+            <param name="channel" value="PCNT" />\n+            <conditional name="clip_image">\n+                <param name="select" value="--rectangle" />\n+                <param name="x_coord" value="3" />\n+                <param name="y_coord" value="3" />\n+                <param name='..b'              <element name="Centrin_PCNT_Cep215_20110506_Fri-1545_0_SIR_PRJ__1884807__3__3__5__5" file="test0.tiff"/>\n+            </output_collection>\n+        </test>\n+        <test>\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n+            <param name="source" value="link" />\n+            <param name="id_spec" value="1884807" />\n+            <param name="channel" value="PCNT" />\n             <conditional name="clip_image">\n                 <param name="select" value="--rectangle" />\n                 <param name="x_coord" value="3" />\n@@ -121,26 +180,12 @@\n             </output_collection>\n         </test>\n         <test>\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n             <param name="source" value="link" />\n             <param name="id_spec" value="1884807" />\n-            <param name="channel" value="615.0" />\n-            <conditional name="clip_image">\n-                <param name="select" value="--rectangle" />\n-                <param name="x_coord" value="3" />\n-                <param name="y_coord" value="3" />\n-                <param name="width" value="5" />\n-                <param name="height" value="5" />\n-            </conditional>\n-            <param name="frame" value="2" />\n-            <param name="download_tar" value="false" />\n-            <output_collection name="output_file" type="list">\n-                <element name="Centrin_PCNT_Cep215_20110506_Fri-1545_0_SIR_PRJ__1884807__3__3__5__5" file="test1.tiff"/>\n-            </output_collection>\n-        </test>\n-        <test>\n-            <param name="source" value="link" />\n-            <param name="id_spec" value="1884807" />\n-            <param name="channel" value="615.0" />\n+            <param name="channel" value="PCNT" />\n             <conditional name="clip_image">\n                 <param name="select" value="--center" />\n                 <param name="x_coord" value="5" />\n@@ -155,6 +200,9 @@\n             </output_collection>\n         </test>\n         <test>\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n             <param name="source" value="link" />\n             <param name="id_spec" value="https://idr.openmicroscopy.org/webclient/?show=image-9036708|image-9036710|image-9036711" />\n             <param name="channel" value="Spo20(51-91)" />\n@@ -179,6 +227,9 @@\n             </output>\n         </test>\n         <test expect_failure="true">\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n             <!-- Test behavior with non-existing image-ID 9036708999 -->\n             <param name="source" value="link" />\n             <param name="id_spec" value="https://idr.openmicroscopy.org/webclient/?show=image-9036708999|image-9036710|image-9036711" />\n@@ -193,6 +244,9 @@\n         <test>\n             <!-- Repeat test with non-existing image-ID 9036708999,\n             but use skip-failed option -->\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n             <param name="source" value="link" />\n             <param name="id_spec" value="https://idr.openmicroscopy.org/webclient/?show=image-9036708999|image-9036710|image-9036711" />\n             <param name="channel" value="Spo20(51-91)" />\n@@ -219,6 +273,9 @@\n             </output>\n         </test>\n         <test>\n+            <conditional name="omero_instance_type">\n+                 <param name="omero_instance" value="idr" />\n+            </conditional>\n             <!-- Test for download images in a tarball -->\n             <param name="source" value="dataset" />\n             <param name="id_spec" value="ids_tar.txt" />\n'
b
diff -r 5c743356df83 -r f067504aa92a test-data/test0.tiff
b
Binary file test-data/test0.tiff has changed