File: __init__.py

package info (click to toggle)
python-bioblend 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,096 kB
  • sloc: python: 7,596; sh: 219; makefile: 158
file content (60 lines) | stat: -rw-r--r-- 2,046 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Interaction with a Tool Shed instance tools
"""
from typing import (
    Any,
    Dict,
    TYPE_CHECKING,
)

from bioblend.galaxy.client import Client

if TYPE_CHECKING:
    from bioblend.toolshed import ToolShedInstance


class ToolShedToolClient(Client):
    gi: "ToolShedInstance"
    module = "tools"

    def __init__(self, toolshed_instance: "ToolShedInstance") -> None:
        super().__init__(toolshed_instance)

    def search_tools(self, q: str, page: int = 1, page_size: int = 10) -> Dict[str, Any]:
        """
        Search for tools in a Galaxy Tool Shed.

        :type q: str
        :param q: query string for searching purposes

        :type page: int
        :param page: page requested

        :type page_size: int
        :param page_size: page size requested

        :rtype: dict
        :return: dictionary containing search hits as well as metadata for the
          search. For example::

            {'hits': [{'matched_terms': [],
                       'score': 3.0,
                       'tool': {'description': 'convert between various FASTQ quality formats',
                                'id': '69819b84d55f521efda001e0926e7233',
                                'name': 'FASTQ Groomer',
                                'repo_name': None,
                                'repo_owner_username': 'devteam'}},
                      {'matched_terms': [],
                       'score': 3.0,
                       'tool': {'description': 'converts a bam file to fastq files.',
                                'id': '521e282770fd94537daff87adad2551b',
                                'name': 'Defuse BamFastq',
                                'repo_name': None,
                                'repo_owner_username': 'jjohnson'}}],
             'hostname': 'https://testtoolshed.g2.bx.psu.edu/',
             'page': '1',
             'page_size': '2',
             'total_results': '118'}
        """
        params = {"q": q, "page": page, "page_size": page_size}
        return self._get(params=params)