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 (95 lines) | stat: -rw-r--r-- 2,886 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""
Contains possible interactions with the Galaxy Tool data tables
"""
from typing import (
    Any,
    Dict,
    List,
    TYPE_CHECKING,
)

from bioblend.galaxy.client import Client

if TYPE_CHECKING:
    from bioblend.galaxy import GalaxyInstance


class ToolDataClient(Client):
    module = "tool_data"

    def __init__(self, galaxy_instance: "GalaxyInstance") -> None:
        super().__init__(galaxy_instance)

    def get_data_tables(self) -> List[Dict[str, Any]]:
        """
        Get the list of all data tables.

        :rtype: list
        :return: A list of dicts with details on individual data tables.
          For example::

            [{"model_class": "TabularToolDataTable", "name": "fasta_indexes"},
             {"model_class": "TabularToolDataTable", "name": "bwa_indexes"}]
        """
        return self._get()

    def show_data_table(self, data_table_id: str) -> Dict[str, Any]:
        """
        Get details of a given data table.

        :type data_table_id: str
        :param data_table_id: ID of the data table

        :rtype: dict
        :return: A description of the given data table and its content.
          For example::

            {'columns': ['value', 'dbkey', 'name', 'path'],
             'fields': [['test id',
                         'test',
                         'test name',
                         '/opt/galaxy-dist/tool-data/test/seq/test id.fa']],
             'model_class': 'TabularToolDataTable',
             'name': 'all_fasta'}

        """
        return self._get(id=data_table_id)

    def reload_data_table(self, data_table_id: str) -> Dict[str, Any]:
        """
        Reload a data table.

        :type data_table_id: str
        :param data_table_id: ID of the data table

        :rtype: dict
        :return: A description of the given data table and its content.
          For example::

            {'columns': ['value', 'dbkey', 'name', 'path'],
             'fields': [['test id',
                         'test',
                         'test name',
                         '/opt/galaxy-dist/tool-data/test/seq/test id.fa']],
             'model_class': 'TabularToolDataTable',
             'name': 'all_fasta'}
        """
        url = self._make_url(data_table_id) + "/reload"
        return self._get(url=url)

    def delete_data_table(self, data_table_id: str, values: str) -> Dict[str, Any]:
        """
        Delete an item from a data table.

        :type data_table_id: str
        :param data_table_id: ID of the data table

        :type values: str
        :param values: a "|" separated list of column contents, there must be a
          value for all the columns of the data table

        :rtype: dict
        :return: Remaining contents of the given data table
        """
        payload = {"values": values}
        return self._delete(payload=payload, id=data_table_id)