changeset 9:468c71dac78a draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/uniprot_rest_interface commit da476148d1c609f5c26e880a3e593f0fa71ff2f6
author bgruening
date Wed, 22 May 2024 21:18:15 +0000
parents af5eccf83605
children 95fb5712344f
files macros.xml test-data/test2_map.tab uniprot.py uniprot.xml
diffstat 4 files changed, 1048 insertions(+), 473 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Mon Nov 21 22:02:41 2022 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-<macros>
-<token name="@EXECUTABLE@">1.0</token>
-    <macro name="macro-category_FROM">
-            <param name="category_FROM" type="select" label="Choose your database category (FROM):"
-                help="Select a databse from which your ids are coming from">
-                <option value="uniprot">UniProt</option>
-                <option value="oseqdb">Other sequence databases</option>
-                <option value="3Dstrdb">3D structure databases</option>
-                <option value="ppidb">Protein-protein interaction databases</option>
-                <option value="chemistry">Chemistry</option>
-                <option value="protfgdb">Protein family/group databases</option>
-                <option value="polymorphismANDmutation">Polymorphism and mutation databases</option>
-                <option value="2DgelDB">2D gel databases</option>
-                <option value="ProtocolsMaterialsDB">Protocols and materials databases</option>
-                <option value="GenomeAnnotationDB">Genome annotation databases</option>
-                <option value="OrganismSpecificGeneDB">Organism-specific gene databases</option>
-                <option value="phylogenomic">Phylogenomic databases</option>
-                <option value="EnzymePathwayDB">Enzyme and pathway databases</option>
-                <option value="GeneExpression">Gene expression databases</option>
-                <option value="other">Other</option>
-            </param>
-        </macro>
-        <macro name="macro-category_TO">
-            <param name="category_TO" type="select" label="Choose your database category (TO):"
-                help="Select a database which will be used for mapping">
-                <option value="uniprot">UniProt</option>
-                <option value="oseqdb">Other sequence databases</option>
-                <option value="3Dstrdb">3D structure databases</option>
-                <option value="ppidb">Protein-protein interaction databases</option>
-                <option value="chemistry">Chemistry</option>
-                <option value="protfgdb">Protein family/group databases</option>
-                <option value="polymorphismANDmutation">Polymorphism and mutation databases</option>
-                <option value="2DgelDB">2D gel databases</option>
-                <option value="ProtocolsMaterialsDB">Protocols and materials databases</option>
-                <option value="GenomeAnnotationDB">Genome annotation databases</option>
-                <option value="OrganismSpecificGeneDB">Organism-specific gene databases</option>
-                <option value="phylogenomic">Phylogenomic databases</option>
-                <option value="EnzymePathwayDB">Enzyme and pathway databases</option>
-                <option value="GeneExpression">Gene expression databases</option>
-                <option value="other">Other</option>
-            </param>
-        </macro>
-        <macro name="macro-db_uniprot_FROM">
-            <param name="db_uniprot_FROM" type="select" label="Choose a database:"
-                                help="">
-                                <option value="ACC+ID">UniProtKB AC/ID</option>
-                                <option value="ACC">UniProtKB AC</option>
-                                <option value="ID">UniProtKB ID</option>
-                                <option value="UPARC">UniParc</option>
-                                <option value="NF50">UniRef50</option>
-                                <option value="NF90">UniRef90</option>
-                                <option value="NF100">UniRef100</option>
-                                <option value="GENENAME">Gene name</option>
-            </param>
-        </macro>
-        <macro name="macro-db_uniprot_TO">
-            <param name="db_uniprot_TO" type="select" label="Choose a database:"
-                                help="">
-                                <option value="ACC">UniProtKB AC</option>
-                                <option value="ID">UniProtKB ID</option>
-                                <option value="UPARC">UniParc</option>
-                                <option value="NF50">UniRef50</option>
-                                <option value="NF90">UniRef90</option>
-                                <option value="NF100">UniRef100</option>
-                                <option value="GENENAME">Gene name</option>
-            </param>
-        </macro>
-        <macro name="macro-db_oseqdb">
-            <param name="db_oseqdb" type="select" label="Choose a database:"
-                help="">
-                <option value="EMBL_ID">EMBL/GenBank/DDBJ</option>
-                <option value="EMBL">EMBL/GenBank/DDBJ CDS</option>
-                <option value="PIR">PIR</option>
-
-                <option value="UNIGENE_ID">UniParc</option>
-                <option value="P_ENTREZGENEID">Entrez Gene (GeneID)</option>
-                <option value="P_GI">GI number</option>
-                <option value="P_REFSEQ_AC">RefSeq Protein</option>
-                <option value="REFSEQ_NT_ID">RefSeq Nucleotide</option>
-            </param>
-        </macro>
-        <macro name="macro-db_3Dstrdb">
-            <param name="db_3Dstrdb" type="select" label="Choose a database:"
-                help="">
-                <option value="PDB_ID">PDB</option>
-                <option value="DISPROT_ID">DisProt</option>
-            </param>
-        </macro>
-        <macro name="macro-db_ppidb">
-            <param name="db_ppidb" type="select" label="Choose a database:"
-                help="">
-                <option value="BIOGRID_ID">BioGrid</option>
-                <option value="DIP_ID">DIP</option>
-                <option value="MINT_ID">MINT</option>
-                <option value="STRING_ID">STRING</option>
-            </param>
-        </macro>
-        <macro name="macro-db_chemistry">
-            <param name="db_chemistry" type="select" label="Choose a database:"
-                help="">
-                <option value="CHEMBL_ID">ChEMBL</option>
-                <option value="DrugBank_ID">DrugBank</option>
-                <option value="GUIDETOPHARMACOLOGY_ID">GuidetoPHARMACOLOGY</option>
-            </param>
-        </macro>
-        <macro name="macro-db_protfgdb">
-            <param name="db_protfgdb" type="select" label="Choose a database:"
-                help="">
-                <option value="ALLERGOME_ID">Allergome</option>
-                <option value="MEROPS_ID">MEROPS</option>
-                <option value="MYCOCLAP_ID">mycoCLAP</option>
-                <option value="PEROXIBASE_ID">PeroxiBase</option>
-                <option value="REBASE_ID">REBASE</option>
-                <option value="TCDB_ID">TCDB</option>
-            </param>
-        </macro>
-        <macro name="macro-db_polymorphismANDmutation">
-            <param name="db_polymorphismANDmutation" type="select" label="Choose a database:"
-                help="">
-                <option value="DMDM_ID">DMDM</option>
-            </param>
-        </macro>
-        <macro name="macro-db_2DgelDB">
-            <param name="db_2DgelDB" type="select" label="Choose a database:"
-                help="">
-                <option value="WORLD_2DPAGE_ID">World-2DPAGE</option>
-            </param>
-        </macro>
-        <macro name="macro-db_ProtocolsMaterialsDB">
-            <param name="db_ProtocolsMaterialsDB" type="select" label="Choose a database:"
-                help="">
-                <option value="DNASU_ID">DNASU</option>
-            </param>
-        </macro>
-        <macro name="macro-db_GenomeAnnotationDB">
-            <param name="db_GenomeAnnotationDB" type="select" label="Choose a database:"
-                help="">
-                <option value="ENSEMBL_ID">Ensembl</option>
-                <option value="ENSEMBL_PRO_ID">Ensembl Protein</option>
-                <option value="ENSEMBL_TRS_ID">Ensembl Transcript</option>
-                <option value="ENSEMBLGENOME_ID">Ensembl Genomes</option>
-                <option value="ENSEMBLGENOME_PRO_ID">Ensembl Genomes Protein</option>
-                <option value="ENSEMBLGENOME_TRS_ID">Ensembl Genomes Transcript</option>
-                <option value="P_ENTREZGENEID">GeneID</option>
-                <option value="KEGG_ID">KEGG</option>
-                <option value="PATRIC_ID">PATRIC</option>
-                <option value="UCSC_ID">UCSC</option>
-                <option value="VECTORBASE_ID">VectorBase</option>
-            </param>
-        </macro>
-        <macro name="macro-db_OrganismSpecificGeneDB">
-            <param name="db_OrganismSpecificGeneDB" type="select" label="Choose a database:"
-                help="">
-                <option value="ARACHNOSERVER_ID">ArachnoServer</option>
-                <option value="CGD">CGD</option>
-                <option value="CONOSERVER_ID">ConoServer</option>
-                <option value="DICTYBASE_ID">dictyBase</option>
-                <option value="ECHOBASE_ID">EchoBASE</option>
-                <option value="ECOGENE_ID">EcoGene</option>
-                <option value="EUHCVDB_ID">euHCVdb</option>
-                <option value="EUPATHDB_ID">EuPathDB</option>
-                <option value="FLYBASE_ID">FlyBase</option>
-                <option value="GENECARDS_ID">GeneCards</option>
-                <option value="GENEFARM_ID">GeneFarm</option>
-                <option value="GENOLIST_ID">GenoList</option>
-                <option value="H_INVDB_ID">H-InvDB</option>
-                <option value="HGNC_ID">HGNC</option>
-                <option value="HPA_ID">HPA</option>
-                <option value="LEGIOLIST_ID">LegioList</option>
-                <option value="MAIZEGDB_ID">MaizeGDB</option>
-                <option value="MIM_ID">MIM</option>
-                <option value="MGI_ID">MGI</option>
-                <option value="NEXTPROT_ID">neXtProt</option>
-                <option value="ORPHANET_ID">Orphanet</option>
-                <option value="PHARMGKB_ID">PharmGKB</option>
-                <option value="POMBASE_ID">PomBase</option>
-                <option value="PSEUDOCAP_ID">PseudoCAP</option>
-                <option value="RGD_ID">RGD</option>
-                <option value="SGD_ID">SGD</option>
-                <option value="TAIR_ID">TAIR</option>
-                <option value="TUBERCULIST_ID">TubercuList</option>
-                <option value="WORMBASE_ID">WormBase</option>
-                <option value="WORMBASE_TRS_ID">WormBase Transcript</option>
-                <option value="WORMBASE_PRO_ID">WormBase Protein</option>
-                <option value="XENBASE_ID">Xenbase</option>
-                <option value="ZFIN_ID">ZFIN</option>
-            </param>
-        </macro>
-        <macro name="macro-db_phylogenomic">
-            <param name="db_phylogenomic" type="select" label="Choose a database:"
-                help="">
-                <option value="EGGNOG_ID">eggNOG</option>
-                <option value="GENETREE_ID">GeneTree</option>
-                <option value="HOGENOM_ID">HOGENOM</option>
-                <option value="HOVERGEN_ID">HOVERGEN</option>
-                <option value="KO_ID">KO</option>
-                <option value="OMA_ID">OMA</option>
-                <option value="ORTHODB_ID">OrthoDB</option>
-                <option value="PROTCLUSTDB_ID">ProtClustDB</option>
-                <option value="TREEFAM_ID">TreeFam</option>
-            </param>
-        </macro>
-        <macro name="macro-db_EnzymePathwayDB">
-            <param name="db_EnzymePathwayDB" type="select" label="Choose a database:"
-                help="">
-                <option value="BIOCYC_ID">BioCyc</option>
-                <option value="REACTOME_ID">Reactome</option>
-                <option value="UNIPATHWAY_ID">UniPathWay</option>
-            </param>
-        </macro>
-        <macro name="macro-db_GeneExpression">
-            <param name="db_GeneExpression" type="select" label="Choose a database:"
-                help="">
-                <option value="CLEANEX_ID">CleanEx</option>
-            </param>
-        </macro>
-        <macro name="macro-db_other">
-            <param name="db_other" type="select" label="Choose a database:"
-                help="">
-                <option value="CHITARS_ID">ChiTaRS</option>
-                <option value="GENOMERNAI_ID">GenomeRNAi</option>
-                <option value="GENEWIKI_ID">GeneWiki</option>
-                <option value="NEXTBIO_ID">NextBio</option>
-            </param>
-        </macro>
-</macros>
--- a/test-data/test2_map.tab	Mon Nov 21 22:02:41 2022 +0000
+++ b/test-data/test2_map.tab	Wed May 22 21:18:15 2024 +0000
@@ -1,4 +1,4 @@
-From	To
-NM_001087	AAMP_HUMAN
-NM_130786	A1BG_HUMAN
-NM_130786	V9HWD8_HUMAN
+From	Entry	Entry Name	Reviewed	Protein names	Gene Names	Organism	Length
+NM_001087	Q13685	AAMP_HUMAN	reviewed	Angio-associated migratory cell protein	AAMP	Homo sapiens (Human)	434
+NM_130786	P04217	A1BG_HUMAN	reviewed	Alpha-1B-glycoprotein (Alpha-1-B glycoprotein)	A1BG	Homo sapiens (Human)	495
+NM_130786	V9HWD8	V9HWD8_HUMAN	unreviewed	Epididymis secretory sperm binding protein Li 163pA	HEL-S-163pA	Homo sapiens (Human)	495
--- a/uniprot.py	Mon Nov 21 22:02:41 2022 +0000
+++ b/uniprot.py	Wed May 22 21:18:15 2024 +0000
@@ -1,92 +1,266 @@
-#!/usr/bin/env python
-"""
-uniprot python interface
-to access the uniprot database
-
-Based on work from Jan Rudolph: https://github.com/jdrudolph/uniprot
-available services:
-    map
-    retrieve
-
-rewitten using inspiration form: https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/
-"""
 import argparse
+import json
+import re
 import sys
+import time
+import zlib
+from urllib.parse import (
+    parse_qs,
+    urlencode,
+    urlparse,
+)
+from xml.etree import ElementTree
 
 import requests
-from requests.adapters import HTTPAdapter
-from requests.packages.urllib3.util.retry import Retry
-
-
-DEFAULT_TIMEOUT = 5  # seconds
-URL = 'https://legacy.uniprot.org/'
-
-retry_strategy = Retry(
-    total=5,
-    backoff_factor=2,
-    status_forcelist=[429, 500, 502, 503, 504],
-    allowed_methods=["HEAD", "GET", "OPTIONS", "POST"]
+from requests.adapters import (
+    HTTPAdapter,
+    Retry,
 )
 
 
-class TimeoutHTTPAdapter(HTTPAdapter):
-    def __init__(self, *args, **kwargs):
-        self.timeout = DEFAULT_TIMEOUT
-        if "timeout" in kwargs:
-            self.timeout = kwargs["timeout"]
-            del kwargs["timeout"]
-        super().__init__(*args, **kwargs)
+POLLING_INTERVAL = 3
+API_URL = "https://rest.uniprot.org"
+
+
+retries = Retry(total=5, backoff_factor=0.25, status_forcelist=[500, 502, 503, 504])
+session = requests.Session()
+session.mount("https://", HTTPAdapter(max_retries=retries))
+
+
+def check_response(response):
+    try:
+        response.raise_for_status()
+    except requests.HTTPError:
+        print(response.json())
+        raise
+
+
+def submit_id_mapping(from_db, to_db, ids):
+    print(f"{from_db} {to_db}")
+    request = requests.post(
+        f"{API_URL}/idmapping/run",
+        data={"from": from_db, "to": to_db, "ids": ",".join(ids)},
+    )
+    check_response(request)
+    return request.json()["jobId"]
+
+
+def get_next_link(headers):
+    re_next_link = re.compile(r'<(.+)>; rel="next"')
+    if "Link" in headers:
+        match = re_next_link.match(headers["Link"])
+        if match:
+            return match.group(1)
+
+
+def check_id_mapping_results_ready(job_id):
+    while True:
+        request = session.get(f"{API_URL}/idmapping/status/{job_id}")
+        check_response(request)
+        j = request.json()
+        if "jobStatus" in j:
+            if j["jobStatus"] == "RUNNING":
+                print(f"Retrying in {POLLING_INTERVAL}s")
+                time.sleep(POLLING_INTERVAL)
+            else:
+                raise Exception(j["jobStatus"])
+        else:
+            return bool(j["results"] or j["failedIds"])
+
+
+def get_batch(batch_response, file_format, compressed):
+    batch_url = get_next_link(batch_response.headers)
+    while batch_url:
+        batch_response = session.get(batch_url)
+        batch_response.raise_for_status()
+        yield decode_results(batch_response, file_format, compressed)
+        batch_url = get_next_link(batch_response.headers)
 
-    def send(self, request, **kwargs):
-        timeout = kwargs.get("timeout")
-        if timeout is None:
-            kwargs["timeout"] = self.timeout
-        return super().send(request, **kwargs)
+
+def combine_batches(all_results, batch_results, file_format):
+    if file_format == "json":
+        for key in ("results", "failedIds"):
+            if key in batch_results and batch_results[key]:
+                all_results[key] += batch_results[key]
+    elif file_format == "tsv":
+        return all_results + batch_results[1:]
+    else:
+        return all_results + batch_results
+    return all_results
+
+
+def get_id_mapping_results_link(job_id):
+    url = f"{API_URL}/idmapping/details/{job_id}"
+    request = session.get(url)
+    check_response(request)
+    return request.json()["redirectURL"]
+
+
+def decode_results(response, file_format, compressed):
+    if compressed:
+        decompressed = zlib.decompress(response.content, 16 + zlib.MAX_WBITS)
+        if file_format == "json":
+            j = json.loads(decompressed.decode("utf-8"))
+            return j
+        elif file_format == "tsv":
+            return [line for line in decompressed.decode("utf-8").split("\n") if line]
+        elif file_format == "xlsx":
+            return [decompressed]
+        elif file_format == "xml":
+            return [decompressed.decode("utf-8")]
+        else:
+            return decompressed.decode("utf-8")
+    elif file_format == "json":
+        return response.json()
+    elif file_format == "tsv":
+        return [line for line in response.text.split("\n") if line]
+    elif file_format == "xlsx":
+        return [response.content]
+    elif file_format == "xml":
+        return [response.text]
+    return response.text
+
+
+def get_xml_namespace(element):
+    m = re.match(r"\{(.*)\}", element.tag)
+    return m.groups()[0] if m else ""
+
+
+def merge_xml_results(xml_results):
+    merged_root = ElementTree.fromstring(xml_results[0])
+    for result in xml_results[1:]:
+        root = ElementTree.fromstring(result)
+        for child in root.findall("{http://uniprot.org/uniprot}entry"):
+            merged_root.insert(-1, child)
+    ElementTree.register_namespace("", get_xml_namespace(merged_root[0]))
+    return ElementTree.tostring(merged_root, encoding="utf-8", xml_declaration=True)
 
 
-def _map(query, f, t, format='tab', chunk_size=100):
-    """ _map is not meant for use with the python interface, use `map` instead
-    """
-    tool = 'uploadlists/'
-    data = {'format': format, 'from': f, 'to': t}
+def print_progress_batches(batch_index, size, total):
+    n_fetched = min((batch_index + 1) * size, total)
+    print(f"Fetched: {n_fetched} / {total}")
+
 
-    req = []
-    for i in range(0, len(query), chunk_size):
-        q = query[i:i + chunk_size]
-        req.append(dict([("url", URL + tool),
-                         ('data', data),
-                         ("files", {'file': ' '.join(q)})]))
-    return req
-    response = requests.post(URL + tool, data=data)
-    response.raise_for_status()
-    page = response.text
-    if "The service is temporarily unavailable" in page:
-        exit("The UNIPROT service is temporarily unavailable. Please try again later.")
-    return page
+def get_id_mapping_results_search(url):
+    parsed = urlparse(url)
+    query = parse_qs(parsed.query)
+    file_format = query["format"][0] if "format" in query else "json"
+    if "size" in query:
+        size = int(query["size"][0])
+    else:
+        size = 500
+        query["size"] = size
+    compressed = (
+        query["compressed"][0].lower() == "true" if "compressed" in query else False
+    )
+    parsed = parsed._replace(query=urlencode(query, doseq=True))
+    url = parsed.geturl()
+    request = session.get(url)
+    check_response(request)
+    results = decode_results(request, file_format, compressed)
+    total = int(request.headers["x-total-results"])
+    print_progress_batches(0, size, total)
+    for i, batch in enumerate(get_batch(request, file_format, compressed), 1):
+        results = combine_batches(results, batch, file_format)
+        print_progress_batches(i, size, total)
+    if file_format == "xml":
+        return merge_xml_results(results)
+    return results
 
 
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser(description='retrieve uniprot mapping')
-    subparsers = parser.add_subparsers(dest='tool')
+# print(results)
+# {'results': [{'from': 'P05067', 'to': 'CHEMBL2487'}], 'failedIds': ['P12345']}
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description="retrieve uniprot mapping")
+    subparsers = parser.add_subparsers(dest="tool")
 
-    mapping = subparsers.add_parser('map')
-    mapping.add_argument('f', help='from')
-    mapping.add_argument('t', help='to')
-    mapping.add_argument('inp', nargs='?', type=argparse.FileType('r'),
-                         default=sys.stdin, help='input file (default: stdin)')
-    mapping.add_argument('out', nargs='?', type=argparse.FileType('w'),
-                         default=sys.stdout, help='output file (default: stdout)')
-    mapping.add_argument('--format', default='tab', help='output format')
+    mapping = subparsers.add_parser("map")
+    mapping.add_argument("f", help="from")
+    mapping.add_argument("t", help="to")
+    mapping.add_argument(
+        "inp",
+        nargs="?",
+        type=argparse.FileType("r"),
+        default=sys.stdin,
+        help="input file (default: stdin)",
+    )
+    mapping.add_argument(
+        "out",
+        nargs="?",
+        type=argparse.FileType("w"),
+        default=sys.stdout,
+        help="output file (default: stdout)",
+    )
+    mapping.add_argument("--format", default="tab", help="output format")
 
-    retrieve = subparsers.add_parser('retrieve')
-    retrieve.add_argument('inp', metavar='in', nargs='?', type=argparse.FileType('r'),
-                          default=sys.stdin, help='input file (default: stdin)')
-    retrieve.add_argument('out', nargs='?', type=argparse.FileType('w'),
-                          default=sys.stdout, help='output file (default: stdout)')
-    retrieve.add_argument('-f', '--format', help='specify output format', default='txt')
+    retrieve = subparsers.add_parser("retrieve")
+    retrieve.add_argument(
+        "inp",
+        metavar="in",
+        nargs="?",
+        type=argparse.FileType("r"),
+        default=sys.stdin,
+        help="input file (default: stdin)",
+    )
+    retrieve.add_argument(
+        "out",
+        nargs="?",
+        type=argparse.FileType("w"),
+        default=sys.stdout,
+        help="output file (default: stdout)",
+    )
+    retrieve.add_argument("-f", "--format", help="specify output format", default="txt")
+    mapping = subparsers.add_parser("menu")
 
     args = parser.parse_args()
 
+    # code for auto generating the from - to conditional
+    if args.tool == "menu":
+        from lxml import etree
+
+        request = session.get("https://rest.uniprot.org/configure/idmapping/fields")
+        check_response(request)
+        fields = request.json()
+
+        tos = dict()
+        from_cond = etree.Element("conditional", name="from_cond")
+        from_select = etree.SubElement(
+            from_cond, "param", name="from", type="select", label="Source database:"
+        )
+
+        rules = dict()
+        for rule in fields["rules"]:
+            rules[rule["ruleId"]] = rule["tos"]
+
+        for group in fields["groups"]:
+            group_name = group["groupName"]
+            group_name = group_name.replace("databases", "DBs")
+            for item in group["items"]:
+                if item["to"]:
+                    tos[item["name"]] = f"{group_name} - {item['displayName']}"
+
+        for group in fields["groups"]:
+            group_name = group["groupName"]
+            group_name = group_name.replace("databases", "DBs")
+            for item in group["items"]:
+                if not item["from"]:
+                    continue
+                option = etree.SubElement(from_select, "option", value=item["name"])
+                option.text = f"{group_name} - {item['displayName']}"
+                when = etree.SubElement(from_cond, "when", value=item["name"])
+
+                to_select = etree.SubElement(
+                    when, "param", name="to", type="select", label="Target database:"
+                )
+                ruleId = item["ruleId"]
+                for to in rules[ruleId]:
+                    option = etree.SubElement(to_select, "option", value=to)
+                    option.text = tos[to]
+        etree.indent(from_cond, space="    ")
+        print(etree.tostring(from_cond, pretty_print=True, encoding="unicode"))
+        sys.exit(0)
+
     # get the IDs from the file as sorted list
     # (sorted is convenient for testing)
     query = set()
@@ -94,15 +268,19 @@
         query.add(line.strip())
     query = sorted(query)
 
-    if args.tool == 'map':
-        pload = _map(query, args.f, args.t, chunk_size=100)
-    elif args.tool == 'retrieve':
-        pload = _map(query, 'ACC+ID', 'ACC', args.format, chunk_size=100)
+    if args.tool == "map":
+        job_id = submit_id_mapping(from_db=args.f, to_db=args.t, ids=query)
+    elif args.tool == "retrieve":
+        job_id = submit_id_mapping(
+            from_db="UniProtKB_AC-ID", to_db="UniProtKB", ids=query
+        )
 
-    adapter = TimeoutHTTPAdapter(max_retries=retry_strategy)
-    http = requests.Session()
-    http.mount("https://", adapter)
-    for i, p in enumerate(pload):
-        response = http.post(**p)
-        args.out.write(response.text)
-    http.close()
+    if check_id_mapping_results_ready(job_id):
+        link = get_id_mapping_results_link(job_id)
+        link = f"{link}?format={args.format}"
+        print(link)
+        results = get_id_mapping_results_search(link)
+
+    if not isinstance(results, str):
+        results = "\n".join(results)
+    args.out.write(f"{results}\n")
--- a/uniprot.xml	Mon Nov 21 22:02:41 2022 +0000
+++ b/uniprot.xml	Wed May 22 21:18:15 2024 +0000
@@ -1,197 +1,824 @@
-<tool id="uniprot" name="UniProt" version="0.4">
+<tool id="uniprot" name="UniProt" version="0.5" profile="23.1">
     <description>ID mapping and retrieval</description>
-    <macros>
-         <import>macros.xml</import>
-    </macros>
     <requirements>
         <requirement type="package" version="2.25.1">requests</requirement>
     </requirements>
     <version_command>echo "UniProt ID mapping for Galaxy in version 0.1"</version_command>
     <command detect_errors="aggressive"><![CDATA[
-
         cut -f ${id_column} '$infile' > id_file.tabular &&
 
-        '$__tool_directory__/uniprot.py'
-
+        python '$__tool_directory__/uniprot.py'
         #if $tool.tool_choice == "retrieve":
             retrieve -f $tool.format id_file.tabular ./output
         #elif $tool.tool_choice == "map":
             map
-
-            #if $tool.from.category_FROM == "uniprot"
-                '${tool.from.db_uniprot_FROM}'
-            #elif $tool.from.category_FROM == "oseqdb"
-                ${tool.from.db_oseqdb}
-            #elif $tool.from.category_FROM == "3Dstrdb"
-                ${tool.from.db_3Dstrdb}
-            #elif $tool.from.category_FROM == "ppidb"
-                ${tool.from.db_ppidb}
-            #elif $tool.from.category_FROM == "chemistry"
-                ${tool.from.db_chemistry}
-            #elif $tool.from.category_FROM == "protfgdb"
-                ${tool.from.db_protfgdb}
-            #elif $tool.from.category_FROM == "polymorphismANDmutation"
-                ${tool.from.db_polymorphismANDmutation}
-            #elif $tool.from.category_FROM == "2DgelDB"
-                ${tool.from.db_2DgelDB}
-            #elif $tool.from.category_FROM == "ProtocolsMaterialsDB"
-                ${tool.from.db_ProtocolsMaterialsDB}
-            #elif $tool.from.category_FROM == "GenomeAnnotationDB"
-                ${tool.from.db_GenomeAnnotationDB}
-            #elif $tool.from.category_FROM == "OrganismSpecificGeneDB"
-                ${tool.from.db_OrganismSpecificGeneDB}
-            #elif $tool.from.category_FROM == "phylogenomic"
-                ${tool.from.db_phylogenomic}
-            #elif $tool.from.category_FROM == "EnzymePathwayDB"
-                ${tool.from.db_EnzymePathwayDB}
-            #elif $tool.from.category_FROM == "GeneExpression"
-                ${tool.from.db_GeneExpression}
-            #elif $tool.from.category_FROM == "other"
-                ${tool.from.db_other}
-            #end if
-
-            #if $tool.to.category_TO == "uniprot"
-                ${tool.to.db_uniprot_TO}
-            #elif $tool.to.category_TO == "oseqdb"
-                ${tool.to.db_oseqdb}
-            #elif $tool.to.category_TO == "3Dstrdb"
-                ${tool.to.db_3Dstrdb}
-            #elif $tool.to.category_TO == "ppidb"
-                ${tool.to.db_ppidb}
-            #elif $tool.to.category_TO == "chemistry"
-                ${tool.to.db_chemistry}
-            #elif $tool.to.category_TO == "protfgdb"
-                ${tool.to.db_protfgdb}
-            #elif $tool.to.category_TO == "polymorphismANDmutation"
-                ${tool.to.db_polymorphismANDmutation}
-            #elif $tool.to.category_TO == "2DgelDB"
-                ${tool.to.db_2DgelDB}
-            #elif $tool.to.category_TO == "ProtocolsMaterialsDB"
-                ${tool.to.db_ProtocolsMaterialsDB}
-            #elif $tool.to.category_TO == "GenomeAnnotationDB"
-                ${tool.to.db_GenomeAnnotationDB}
-            #elif $tool.to.category_TO == "OrganismSpecificGeneDB"
-                ${tool.to.db_OrganismSpecificGeneDB}
-            #elif $tool.to.category_TO == "phylogenomic"
-                ${tool.to.db_phylogenomic}
-            #elif $tool.to.category_TO == "EnzymePathwayDB"
-                ${tool.to.db_EnzymePathwayDB}
-            #elif $tool.to.category_TO == "GeneExpression"
-                ${tool.to.db_GeneExpression}
-            #elif $tool.to.category_TO == "other"
-                ${tool.to.db_other}
-            #end if
-
+            --format tsv
+            "$from_cond.from"
+            "$from_cond.to"
             id_file.tabular
             ./output
         #end if
-
     ]]></command>
     <inputs>
         <param name="infile" type="data" format="tabular" label="Input file with IDs"
             help="One ID in each line."/>
         <param name="id_column" label="ID column" type="data_column" data_ref="infile" help=""/>
-
         <conditional name="tool">
             <param name="tool_choice" type="select" label="Do you want to map IDs or retrieve data from UniProt" help="">
                 <option value="retrieve">Retrieve: request entries by uniprot accession using batch retrieval</option>
                 <option value="map" selected="True">Map: map a list of ids from one format onto another using uniprots mapping API</option>
             </param>
             <when value="map">
-                <conditional name="from">
-                    <expand macro="macro-category_FROM"/>
-                    <when value="uniprot">
-                        <expand macro="macro-db_uniprot_FROM"/>
-                    </when>
-                    <when value="oseqdb">
-                        <expand macro="macro-db_oseqdb"/>
-                    </when>
-                    <when value="3Dstrdb">
-                        <expand macro="macro-db_3Dstrdb"/>
-                    </when>
-                    <when value="ppidb">
-                        <expand macro="macro-db_ppidb"/>
-                    </when>
-                    <when value="chemistry">
-                        <expand macro="macro-db_chemistry"/>
-                    </when>
-                    <when value="protfgdb">
-                        <expand macro="macro-db_protfgdb"/>
-                    </when>
-                    <when value="polymorphismANDmutation">
-                        <expand macro="macro-db_polymorphismANDmutation"/>
+                <!-- conditional auto generated with python tools/uniprot_rest_interface/uniprot.py menu -->
+                <conditional name="from_cond">
+                    <param name="from" type="select" label="Source database:">
+                        <option value="UniProtKB_AC-ID">UniProt - UniProtKB AC/ID</option>
+                        <option value="UniParc">UniProt - UniParc</option>
+                        <option value="UniRef50">UniProt - UniRef50</option>
+                        <option value="UniRef90">UniProt - UniRef90</option>
+                        <option value="UniRef100">UniProt - UniRef100</option>
+                        <option value="Gene_Name">UniProt - Gene Name</option>
+                        <option value="CRC64">UniProt - CRC64</option>
+                        <option value="CCDS">Sequence DBs - CCDS</option>
+                        <option value="EMBL-GenBank-DDBJ">Sequence DBs - EMBL/GenBank/DDBJ</option>
+                        <option value="EMBL-GenBank-DDBJ_CDS">Sequence DBs - EMBL/GenBank/DDBJ CDS</option>
+                        <option value="GI_number">Sequence DBs - GI number</option>
+                        <option value="PIR">Sequence DBs - PIR</option>
+                        <option value="RefSeq_Nucleotide">Sequence DBs - RefSeq Nucleotide</option>
+                        <option value="RefSeq_Protein">Sequence DBs - RefSeq Protein</option>
+                        <option value="PDB">3D structure DBs - PDB</option>
+                        <option value="BioGRID">Protein-protein interaction DBs - BioGRID</option>
+                        <option value="ComplexPortal">Protein-protein interaction DBs - ComplexPortal</option>
+                        <option value="DIP">Protein-protein interaction DBs - DIP</option>
+                        <option value="STRING">Protein-protein interaction DBs - STRING</option>
+                        <option value="ChEMBL">Chemistry - ChEMBL</option>
+                        <option value="DrugBank">Chemistry - DrugBank</option>
+                        <option value="GuidetoPHARMACOLOGY">Chemistry - GuidetoPHARMACOLOGY</option>
+                        <option value="SwissLipids">Chemistry - SwissLipids</option>
+                        <option value="Allergome">Protein family/group DBs - Allergome</option>
+                        <option value="CLAE">Protein family/group DBs - CLAE</option>
+                        <option value="ESTHER">Protein family/group DBs - ESTHER</option>
+                        <option value="MEROPS">Protein family/group DBs - MEROPS</option>
+                        <option value="PeroxiBase">Protein family/group DBs - PeroxiBase</option>
+                        <option value="REBASE">Protein family/group DBs - REBASE</option>
+                        <option value="TCDB">Protein family/group DBs - TCDB</option>
+                        <option value="GlyConnect">PTM DBs - GlyConnect</option>
+                        <option value="BioMuta">Genetic variation DBs - BioMuta</option>
+                        <option value="DMDM">Genetic variation DBs - DMDM</option>
+                        <option value="World-2DPAGE">2D gel DBs - World-2DPAGE</option>
+                        <option value="CPTAC">Proteomic DBs - CPTAC</option>
+                        <option value="ProteomicsDB">Proteomic DBs - ProteomicsDB</option>
+                        <option value="DNASU">Protocols and materials DBs - DNASU</option>
+                        <option value="Ensembl">Genome annotation DBs - Ensembl</option>
+                        <option value="Ensembl_Genomes">Genome annotation DBs - Ensembl Genomes</option>
+                        <option value="Ensembl_Genomes_Protein">Genome annotation DBs - Ensembl Genomes Protein</option>
+                        <option value="Ensembl_Genomes_Transcript">Genome annotation DBs - Ensembl Genomes Transcript</option>
+                        <option value="Ensembl_Protein">Genome annotation DBs - Ensembl Protein</option>
+                        <option value="Ensembl_Transcript">Genome annotation DBs - Ensembl Transcript</option>
+                        <option value="GeneID">Genome annotation DBs - GeneID</option>
+                        <option value="KEGG">Genome annotation DBs - KEGG</option>
+                        <option value="PATRIC">Genome annotation DBs - PATRIC</option>
+                        <option value="UCSC">Genome annotation DBs - UCSC</option>
+                        <option value="WBParaSite">Genome annotation DBs - WBParaSite</option>
+                        <option value="WBParaSite_Transcript-Protein">Genome annotation DBs - WBParaSite Transcript/Protein</option>
+                        <option value="ArachnoServer">Organism-specific DBs - ArachnoServer</option>
+                        <option value="Araport">Organism-specific DBs - Araport</option>
+                        <option value="CGD">Organism-specific DBs - CGD</option>
+                        <option value="ConoServer">Organism-specific DBs - ConoServer</option>
+                        <option value="dictyBase">Organism-specific DBs - dictyBase</option>
+                        <option value="EchoBASE">Organism-specific DBs - EchoBASE</option>
+                        <option value="euHCVdb">Organism-specific DBs - euHCVdb</option>
+                        <option value="FlyBase">Organism-specific DBs - FlyBase</option>
+                        <option value="GeneCards">Organism-specific DBs - GeneCards</option>
+                        <option value="GeneReviews">Organism-specific DBs - GeneReviews</option>
+                        <option value="HGNC">Organism-specific DBs - HGNC</option>
+                        <option value="LegioList">Organism-specific DBs - LegioList</option>
+                        <option value="Leproma">Organism-specific DBs - Leproma</option>
+                        <option value="MaizeGDB">Organism-specific DBs - MaizeGDB</option>
+                        <option value="MGI">Organism-specific DBs - MGI</option>
+                        <option value="MIM">Organism-specific DBs - MIM</option>
+                        <option value="neXtProt">Organism-specific DBs - neXtProt</option>
+                        <option value="OpenTargets">Organism-specific DBs - OpenTargets</option>
+                        <option value="Orphanet">Organism-specific DBs - Orphanet</option>
+                        <option value="PharmGKB">Organism-specific DBs - PharmGKB</option>
+                        <option value="PomBase">Organism-specific DBs - PomBase</option>
+                        <option value="PseudoCAP">Organism-specific DBs - PseudoCAP</option>
+                        <option value="RGD">Organism-specific DBs - RGD</option>
+                        <option value="SGD">Organism-specific DBs - SGD</option>
+                        <option value="TubercuList">Organism-specific DBs - TubercuList</option>
+                        <option value="VEuPathDB">Organism-specific DBs - VEuPathDB</option>
+                        <option value="VGNC">Organism-specific DBs - VGNC</option>
+                        <option value="WormBase">Organism-specific DBs - WormBase</option>
+                        <option value="WormBase_Protein">Organism-specific DBs - WormBase Protein</option>
+                        <option value="WormBase_Transcript">Organism-specific DBs - WormBase Transcript</option>
+                        <option value="Xenbase">Organism-specific DBs - Xenbase</option>
+                        <option value="ZFIN">Organism-specific DBs - ZFIN</option>
+                        <option value="eggNOG">Phylogenomic DBs - eggNOG</option>
+                        <option value="GeneTree">Phylogenomic DBs - GeneTree</option>
+                        <option value="HOGENOM">Phylogenomic DBs - HOGENOM</option>
+                        <option value="OMA">Phylogenomic DBs - OMA</option>
+                        <option value="OrthoDB">Phylogenomic DBs - OrthoDB</option>
+                        <option value="TreeFam">Phylogenomic DBs - TreeFam</option>
+                        <option value="BioCyc">Enzyme and pathway DBs - BioCyc</option>
+                        <option value="PlantReactome">Enzyme and pathway DBs - PlantReactome</option>
+                        <option value="Reactome">Enzyme and pathway DBs - Reactome</option>
+                        <option value="UniPathway">Enzyme and pathway DBs - UniPathway</option>
+                        <option value="ChiTaRS">Miscellaneous - ChiTaRS</option>
+                        <option value="GeneWiki">Miscellaneous - GeneWiki</option>
+                        <option value="GenomeRNAi">Miscellaneous - GenomeRNAi</option>
+                        <option value="PHI-base">Miscellaneous - PHI-base</option>
+                        <option value="CollecTF">Gene expression DBs - CollecTF</option>
+                        <option value="DisProt">Family and domain DBs - DisProt</option>
+                        <option value="IDEAL">Family and domain DBs - IDEAL</option>
+                    </param>
+                    <when value="UniProtKB_AC-ID">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="CCDS">Sequence DBs - CCDS</option>
+                            <option value="PIR">Sequence DBs - PIR</option>
+                            <option value="PDB">3D structure DBs - PDB</option>
+                            <option value="BioGRID">Protein-protein interaction DBs - BioGRID</option>
+                            <option value="ComplexPortal">Protein-protein interaction DBs - ComplexPortal</option>
+                            <option value="DIP">Protein-protein interaction DBs - DIP</option>
+                            <option value="STRING">Protein-protein interaction DBs - STRING</option>
+                            <option value="ChEMBL">Chemistry - ChEMBL</option>
+                            <option value="DrugBank">Chemistry - DrugBank</option>
+                            <option value="GuidetoPHARMACOLOGY">Chemistry - GuidetoPHARMACOLOGY</option>
+                            <option value="SwissLipids">Chemistry - SwissLipids</option>
+                            <option value="Allergome">Protein family/group DBs - Allergome</option>
+                            <option value="ESTHER">Protein family/group DBs - ESTHER</option>
+                            <option value="MEROPS">Protein family/group DBs - MEROPS</option>
+                            <option value="CLAE">Protein family/group DBs - CLAE</option>
+                            <option value="PeroxiBase">Protein family/group DBs - PeroxiBase</option>
+                            <option value="REBASE">Protein family/group DBs - REBASE</option>
+                            <option value="TCDB">Protein family/group DBs - TCDB</option>
+                            <option value="GlyConnect">PTM DBs - GlyConnect</option>
+                            <option value="BioMuta">Genetic variation DBs - BioMuta</option>
+                            <option value="DMDM">Genetic variation DBs - DMDM</option>
+                            <option value="World-2DPAGE">2D gel DBs - World-2DPAGE</option>
+                            <option value="CPTAC">Proteomic DBs - CPTAC</option>
+                            <option value="ProteomicsDB">Proteomic DBs - ProteomicsDB</option>
+                            <option value="DNASU">Protocols and materials DBs - DNASU</option>
+                            <option value="Ensembl">Genome annotation DBs - Ensembl</option>
+                            <option value="GeneID">Genome annotation DBs - GeneID</option>
+                            <option value="KEGG">Genome annotation DBs - KEGG</option>
+                            <option value="PATRIC">Genome annotation DBs - PATRIC</option>
+                            <option value="UCSC">Genome annotation DBs - UCSC</option>
+                            <option value="WBParaSite">Genome annotation DBs - WBParaSite</option>
+                            <option value="ArachnoServer">Organism-specific DBs - ArachnoServer</option>
+                            <option value="Araport">Organism-specific DBs - Araport</option>
+                            <option value="CGD">Organism-specific DBs - CGD</option>
+                            <option value="ConoServer">Organism-specific DBs - ConoServer</option>
+                            <option value="dictyBase">Organism-specific DBs - dictyBase</option>
+                            <option value="EchoBASE">Organism-specific DBs - EchoBASE</option>
+                            <option value="euHCVdb">Organism-specific DBs - euHCVdb</option>
+                            <option value="VEuPathDB">Organism-specific DBs - VEuPathDB</option>
+                            <option value="FlyBase">Organism-specific DBs - FlyBase</option>
+                            <option value="GeneCards">Organism-specific DBs - GeneCards</option>
+                            <option value="GeneReviews">Organism-specific DBs - GeneReviews</option>
+                            <option value="HGNC">Organism-specific DBs - HGNC</option>
+                            <option value="LegioList">Organism-specific DBs - LegioList</option>
+                            <option value="Leproma">Organism-specific DBs - Leproma</option>
+                            <option value="MaizeGDB">Organism-specific DBs - MaizeGDB</option>
+                            <option value="MGI">Organism-specific DBs - MGI</option>
+                            <option value="MIM">Organism-specific DBs - MIM</option>
+                            <option value="neXtProt">Organism-specific DBs - neXtProt</option>
+                            <option value="OpenTargets">Organism-specific DBs - OpenTargets</option>
+                            <option value="Orphanet">Organism-specific DBs - Orphanet</option>
+                            <option value="PharmGKB">Organism-specific DBs - PharmGKB</option>
+                            <option value="PomBase">Organism-specific DBs - PomBase</option>
+                            <option value="PseudoCAP">Organism-specific DBs - PseudoCAP</option>
+                            <option value="RGD">Organism-specific DBs - RGD</option>
+                            <option value="SGD">Organism-specific DBs - SGD</option>
+                            <option value="TubercuList">Organism-specific DBs - TubercuList</option>
+                            <option value="VGNC">Organism-specific DBs - VGNC</option>
+                            <option value="WormBase">Organism-specific DBs - WormBase</option>
+                            <option value="Xenbase">Organism-specific DBs - Xenbase</option>
+                            <option value="ZFIN">Organism-specific DBs - ZFIN</option>
+                            <option value="eggNOG">Phylogenomic DBs - eggNOG</option>
+                            <option value="GeneTree">Phylogenomic DBs - GeneTree</option>
+                            <option value="HOGENOM">Phylogenomic DBs - HOGENOM</option>
+                            <option value="OMA">Phylogenomic DBs - OMA</option>
+                            <option value="OrthoDB">Phylogenomic DBs - OrthoDB</option>
+                            <option value="TreeFam">Phylogenomic DBs - TreeFam</option>
+                            <option value="BioCyc">Enzyme and pathway DBs - BioCyc</option>
+                            <option value="Reactome">Enzyme and pathway DBs - Reactome</option>
+                            <option value="UniPathway">Enzyme and pathway DBs - UniPathway</option>
+                            <option value="PlantReactome">Enzyme and pathway DBs - PlantReactome</option>
+                            <option value="ChiTaRS">Miscellaneous - ChiTaRS</option>
+                            <option value="GeneWiki">Miscellaneous - GeneWiki</option>
+                            <option value="GenomeRNAi">Miscellaneous - GenomeRNAi</option>
+                            <option value="PHI-base">Miscellaneous - PHI-base</option>
+                            <option value="CollecTF">Gene expression DBs - CollecTF</option>
+                            <option value="IDEAL">Family and domain DBs - IDEAL</option>
+                            <option value="DisProt">Family and domain DBs - DisProt</option>
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                            <option value="UniParc">UniProt - UniParc</option>
+                            <option value="UniRef50">UniProt - UniRef50</option>
+                            <option value="UniRef90">UniProt - UniRef90</option>
+                            <option value="UniRef100">UniProt - UniRef100</option>
+                            <option value="Gene_Name">UniProt - Gene Name</option>
+                            <option value="CRC64">UniProt - CRC64</option>
+                            <option value="EMBL-GenBank-DDBJ">Sequence DBs - EMBL/GenBank/DDBJ</option>
+                            <option value="EMBL-GenBank-DDBJ_CDS">Sequence DBs - EMBL/GenBank/DDBJ CDS</option>
+                            <option value="GI_number">Sequence DBs - GI number</option>
+                            <option value="RefSeq_Nucleotide">Sequence DBs - RefSeq Nucleotide</option>
+                            <option value="RefSeq_Protein">Sequence DBs - RefSeq Protein</option>
+                            <option value="Ensembl_Protein">Genome annotation DBs - Ensembl Protein</option>
+                            <option value="Ensembl_Transcript">Genome annotation DBs - Ensembl Transcript</option>
+                            <option value="Ensembl_Genomes">Genome annotation DBs - Ensembl Genomes</option>
+                            <option value="Ensembl_Genomes_Protein">Genome annotation DBs - Ensembl Genomes Protein</option>
+                            <option value="Ensembl_Genomes_Transcript">Genome annotation DBs - Ensembl Genomes Transcript</option>
+                            <option value="WBParaSite_Transcript-Protein">Genome annotation DBs - WBParaSite Transcript/Protein</option>
+                            <option value="WormBase_Protein">Organism-specific DBs - WormBase Protein</option>
+                            <option value="WormBase_Transcript">Organism-specific DBs - WormBase Transcript</option>
+                        </param>
                     </when>
-                    <when value="2DgelDB">
-                        <expand macro="macro-db_2DgelDB"/>
+                    <when value="UniParc">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                            <option value="UniParc">UniProt - UniParc</option>
+                        </param>
+                    </when>
+                    <when value="UniRef50">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                            <option value="UniRef50">UniProt - UniRef50</option>
+                        </param>
+                    </when>
+                    <when value="UniRef90">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                            <option value="UniRef90">UniProt - UniRef90</option>
+                        </param>
                     </when>
-                    <when value="ProtocolsMaterialsDB">
-                        <expand macro="macro-db_ProtocolsMaterialsDB"/>
+                    <when value="UniRef100">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                            <option value="UniRef100">UniProt - UniRef100</option>
+                        </param>
+                    </when>
+                    <when value="Gene_Name">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="CRC64">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="CCDS">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="GenomeAnnotationDB">
-                        <expand macro="macro-db_GenomeAnnotationDB"/>
+                    <when value="EMBL-GenBank-DDBJ">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="EMBL-GenBank-DDBJ_CDS">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GI_number">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PIR">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="OrganismSpecificGeneDB">
-                        <expand macro="macro-db_OrganismSpecificGeneDB"/>
+                    <when value="RefSeq_Nucleotide">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="RefSeq_Protein">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PDB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="BioGRID">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="phylogenomic">
-                        <expand macro="macro-db_phylogenomic"/>
+                    <when value="ComplexPortal">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="DIP">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="STRING">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="ChEMBL">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="EnzymePathwayDB">
-                        <expand macro="macro-db_EnzymePathwayDB"/>
+                    <when value="DrugBank">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GuidetoPHARMACOLOGY">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="SwissLipids">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Allergome">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="GeneExpression">
-                        <expand macro="macro-db_GeneExpression"/>
+                    <when value="CLAE">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="ESTHER">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="MEROPS">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PeroxiBase">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="other">
-                        <expand macro="macro-db_other"/>
+                    <when value="REBASE">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="TCDB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GlyConnect">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="BioMuta">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                </conditional>
-                <conditional name="to">
-                    <expand macro="macro-category_TO"/>
-                    <when value="uniprot">
-                        <expand macro="macro-db_uniprot_TO"/>
+                    <when value="DMDM">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="World-2DPAGE">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="CPTAC">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="ProteomicsDB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="DNASU">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Ensembl">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Ensembl_Genomes">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Ensembl_Genomes_Protein">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="oseqdb">
-                        <expand macro="macro-db_oseqdb"/>
+                    <when value="Ensembl_Genomes_Transcript">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Ensembl_Protein">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Ensembl_Transcript">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GeneID">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="3Dstrdb">
-                        <expand macro="macro-db_3Dstrdb"/>
+                    <when value="KEGG">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PATRIC">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="UCSC">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="WBParaSite">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="ppidb">
-                        <expand macro="macro-db_ppidb"/>
+                    <when value="WBParaSite_Transcript-Protein">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="ArachnoServer">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Araport">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="CGD">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="chemistry">
-                        <expand macro="macro-db_chemistry"/>
+                    <when value="ConoServer">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="dictyBase">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="EchoBASE">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="euHCVdb">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="protfgdb">
-                        <expand macro="macro-db_protfgdb"/>
+                    <when value="FlyBase">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GeneCards">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GeneReviews">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="HGNC">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="polymorphismANDmutation">
-                        <expand macro="macro-db_polymorphismANDmutation"/>
+                    <when value="LegioList">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Leproma">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="MaizeGDB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="MGI">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="MIM">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="2DgelDB">
-                        <expand macro="macro-db_2DgelDB"/>
+                    <when value="neXtProt">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="OpenTargets">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Orphanet">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PharmGKB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="ProtocolsMaterialsDB">
-                        <expand macro="macro-db_ProtocolsMaterialsDB"/>
+                    <when value="PomBase">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PseudoCAP">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="RGD">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="SGD">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="GenomeAnnotationDB">
-                        <expand macro="macro-db_GenomeAnnotationDB"/>
+                    <when value="TubercuList">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="VEuPathDB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="VGNC">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="WormBase">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="OrganismSpecificGeneDB">
-                        <expand macro="macro-db_OrganismSpecificGeneDB"/>
+                    <when value="WormBase_Protein">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="WormBase_Transcript">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="Xenbase">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="ZFIN">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="phylogenomic">
-                        <expand macro="macro-db_phylogenomic"/>
+                    <when value="eggNOG">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GeneTree">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="HOGENOM">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="OMA">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="EnzymePathwayDB">
-                        <expand macro="macro-db_EnzymePathwayDB"/>
+                    <when value="OrthoDB">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="TreeFam">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="BioCyc">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PlantReactome">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="GeneExpression">
-                        <expand macro="macro-db_GeneExpression"/>
+                    <when value="Reactome">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="UniPathway">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="ChiTaRS">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="GeneWiki">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
-                    <when value="other">
-                        <expand macro="macro-db_other"/>
+                    <when value="GenomeRNAi">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="PHI-base">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="CollecTF">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="DisProt">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
+                    </when>
+                    <when value="IDEAL">
+                        <param name="to" type="select" label="Target database:">
+                            <option value="UniProtKB">UniProt - UniProtKB</option>
+                            <option value="UniProtKB-Swiss-Prot">UniProt - UniProtKB/Swiss-Prot</option>
+                        </param>
                     </when>
                 </conditional>
             </when>
@@ -206,58 +833,54 @@
     </inputs>
     <outputs>
             <data name="outfile_retrieve_fasta" format="fasta" from_work_dir="./output"
-                label="${tool.name} on ${on_string} (retrieve output)">
+                label="${tool.name} on ${on_string}: fasta">
                 <filter>tool['tool_choice'] == 'retrieve'</filter>
                 <filter>tool['format'] == 'fasta'</filter>
             </data>
             <data name="outfile_retrieve_gff" format="gff" from_work_dir="./output"
-                label="${tool.name} on ${on_string} (retrieve output)">
+                label="${tool.name} on ${on_string}: gff">
                 <filter>tool['tool_choice'] == 'retrieve'</filter>
                 <filter>tool['format'] == 'gff'</filter>
             </data>
             <data name="outfile_retrieve_txt" format="txt" from_work_dir="./output"
-                label="${tool.name} on ${on_string} (retrieve output)">
+                label="${tool.name} on ${on_string}: txt">
                	<filter>tool['tool_choice'] == 'retrieve'</filter>
                 <filter>tool['format'] == 'txt'</filter>
             </data>
             <data name="outfile_map" format="tabular" from_work_dir="./output"
-                label="${tool.name} on ${on_string} (map output)">
+                label="${tool.name} on ${on_string}: mapping">
                 <filter>tool['tool_choice'] == 'map'</filter>
             </data>
     </outputs>
     <tests>
-        <test>
+        <test expect_num_outputs="1">
             <param name="infile" value="id_uniprot.tab" ftype="tabular"/>
             <param name="id_column" value="c1"/>
             <param name="format" value="fasta"/>
             <param name="tool_choice" value="retrieve"/>
             <output name="outfile_retrieve_fasta" file="test1_retrieve.fasta" ftype="fasta" compare="sim_size" />
         </test>
-        <test>
+        <test expect_num_outputs="1">
             <param name="infile" value="id_uniprot.tab" ftype="tabular"/>
             <param name="id_column" value="c1"/>
             <param name="format" value="gff"/>
             <param name="tool_choice" value="retrieve"/>
             <output name="outfile_retrieve_gff" file="test2_retrieve.gff" ftype="gff" compare="sim_size" />
         </test>
-        <test>
+        <test expect_num_outputs="1">
             <param name="infile" value="id_uniprot.tab" ftype="tabular"/>
             <param name="id_column" value="c1"/>
             <param name="tool_choice" value="map"/>
-            <param name="category_FROM" value="uniprot"/>
-            <param name="db_uniprot_FROM" value="ID"/>
-            <param name="category_TO" value="uniprot"/>
-            <param name="db_uniprot_TO" value="GENENAME"/>
+            <param name="from" value="UniProtKB_AC-ID"/>
+            <param name="to" value="Gene_Name"/>
             <output name="outfile_map" file="test1_map.tab" ftype="tabular"/>
         </test>
-        <test>
+        <test expect_num_outputs="1">
             <param name="infile" value="id_map_refseq.txt" ftype="tabular"/>
             <param name="id_column" value="c1"/>
             <param name="tool_choice" value="map"/>
-            <param name="category_FROM" value="oseqdb"/>
-            <param name="db_oseqdb" value="REFSEQ_NT_ID"/>
-            <param name="category_TO" value="uniprot"/>
-            <param name="db_uniprot_TO" value="ID"/>
+            <param name="from" value="RefSeq_Nucleotide"/>
+            <param name="to" value="UniProtKB"/>
             <output name="outfile_map" file="test2_map.tab" ftype="tabular"/>
         </test>
     </tests>