annotate env/lib/python3.9/site-packages/bioblend/galaxy/libraries/__init__.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
1 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
2 Contains possible interactions with the Galaxy Data Libraries
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
3 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
4 import logging
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
5 import time
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
6
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
7 from bioblend.galaxy.client import Client
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
8 from bioblend.galaxy.datasets import (
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
9 DatasetTimeoutException,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
10 TERMINAL_STATES,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
11 )
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
12 from bioblend.util import attach_file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
13
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
14 log = logging.getLogger(__name__)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
15
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
16
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
17 class LibraryClient(Client):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
18
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
19 def __init__(self, galaxy_instance):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
20 self.module = 'libraries'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
21 super().__init__(galaxy_instance)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
22
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
23 def create_library(self, name, description=None, synopsis=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
24 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
25 Create a data library with the properties defined in the arguments.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
26
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
27 :type name: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
28 :param name: Name of the new data library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
29
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
30 :type description: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
31 :param description: Optional data library description
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
32
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
33 :type synopsis: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
34 :param synopsis: Optional data library synopsis
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
35
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
36 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
37 :return: Details of the created library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
38 For example::
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
39
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
40 {'id': 'f740ab636b360a70',
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
41 'name': 'Library from bioblend',
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
42 'url': '/api/libraries/f740ab636b360a70'}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
43 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
44 payload = {'name': name}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
45 if description:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
46 payload['description'] = description
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
47 if synopsis:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
48 payload['synopsis'] = synopsis
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
49 return self._post(payload)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
50
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
51 def delete_library(self, library_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
52 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
53 Delete a data library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
54
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
55 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
56 :param library_id: Encoded data library ID identifying the library to be
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
57 deleted
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
58
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
59 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
60 :return: Information about the deleted library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
61
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
62 .. warning::
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
63 Deleting a data library is irreversible - all of the data from the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
64 library will be permanently deleted.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
65 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
66 return self._delete(id=library_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
67
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
68 def _show_item(self, library_id, item_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
69 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
70 Get details about a given library item.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
71 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
72 url = '/'.join((self._make_url(library_id, contents=True), item_id))
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
73 return self._get(url=url)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
74
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
75 def delete_library_dataset(self, library_id, dataset_id, purged=False):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
76 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
77 Delete a library dataset in a data library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
78
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
79 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
80 :param library_id: library id where dataset is found in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
81
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
82 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
83 :param dataset_id: id of the dataset to be deleted
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
84
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
85 :type purged: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
86 :param purged: Indicate that the dataset should be purged (permanently
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
87 deleted)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
88
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
89 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
90 :return: A dictionary containing the dataset id and whether the dataset
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
91 has been deleted.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
92 For example::
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
93
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
94 {'deleted': True,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
95 'id': '60e680a037f41974'}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
96 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
97 url = '/'.join((self._make_url(library_id, contents=True), dataset_id))
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
98 return self._delete(payload={'purged': purged}, url=url)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
99
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
100 def update_library_dataset(self, dataset_id, **kwds):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
101 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
102 Update library dataset metadata. Some of the attributes that can be
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
103 modified are documented below.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
104
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
105 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
106 :param dataset_id: id of the dataset to be deleted
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
107
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
108 :type name: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
109 :param name: Replace library dataset name with the given string
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
110
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
111 :type misc_info: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
112 :param misc_info: Replace library dataset misc_info with given string
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
113
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
114 :type file_ext: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
115 :param file_ext: Replace library dataset extension (must exist in the Galaxy registry)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
116
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
117 :type genome_build: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
118 :param genome_build: Replace library dataset genome build (dbkey)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
119
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
120 :type tags: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
121 :param tags: Replace library dataset tags with the given list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
122
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
123 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
124 :return: details of the updated dataset
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
125 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
126 url = '/'.join((self._make_url(), 'datasets', dataset_id))
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
127 return self._patch(payload=kwds, url=url)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
128
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
129 def show_dataset(self, library_id, dataset_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
130 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
131 Get details about a given library dataset. The required ``library_id``
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
132 can be obtained from the datasets's library content details.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
133
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
134 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
135 :param library_id: library id where dataset is found in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
136
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
137 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
138 :param dataset_id: id of the dataset to be inspected
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
139
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
140 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
141 :return: A dictionary containing information about the dataset in the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
142 library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
143 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
144 return self._show_item(library_id, dataset_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
145
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
146 def wait_for_dataset(self, library_id, dataset_id, maxwait=12000, interval=3):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
147 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
148 Wait until the library dataset state is terminal ('ok', 'empty',
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
149 'error', 'discarded' or 'failed_metadata').
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
150
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
151 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
152 :param library_id: library id where dataset is found in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
153
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
154 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
155 :param dataset_id: id of the dataset to wait for
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
156
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
157 :type maxwait: float
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
158 :param maxwait: Total time (in seconds) to wait for the dataset state to
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
159 become terminal. If the dataset state is not terminal within this
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
160 time, a ``DatasetTimeoutException`` will be thrown.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
161
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
162 :type interval: float
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
163 :param interval: Time (in seconds) to wait between 2 consecutive checks.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
164
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
165 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
166 :return: A dictionary containing information about the dataset in the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
167 library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
168 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
169 assert maxwait >= 0
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
170 assert interval > 0
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
171
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
172 time_left = maxwait
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
173 while True:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
174 dataset = self.show_dataset(library_id, dataset_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
175 state = dataset['state']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
176 if state in TERMINAL_STATES:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
177 return dataset
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
178 if time_left > 0:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
179 log.warning("Dataset %s in library %s is in non-terminal state %s. Will wait %i more s", dataset_id, library_id, state, time_left)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
180 time.sleep(min(time_left, interval))
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
181 time_left -= interval
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
182 else:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
183 raise DatasetTimeoutException(f"Waited too long for dataset {dataset_id} in library {library_id} to complete")
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
184
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
185 def show_folder(self, library_id, folder_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
186 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
187 Get details about a given folder. The required ``folder_id`` can be
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
188 obtained from the folder's library content details.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
189
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
190 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
191 :param library_id: library id to inspect folders in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
192
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
193 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
194 :param folder_id: id of the folder to be inspected
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
195
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
196 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
197 :return: Information about the folder
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
198 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
199 return self._show_item(library_id, folder_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
200
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
201 def _get_root_folder_id(self, library_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
202 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
203 Find the root folder (i.e. '/') of a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
204
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
205 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
206 :param library_id: library id to find root of
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
207 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
208 l = self.show_library(library_id=library_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
209 return l['root_folder_id']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
210
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
211 def create_folder(self, library_id, folder_name, description=None, base_folder_id=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
212 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
213 Create a folder in a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
214
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
215 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
216 :param library_id: library id to use
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
217
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
218 :type folder_name: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
219 :param folder_name: name of the new folder in the data library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
220
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
221 :type description: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
222 :param description: description of the new folder in the data library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
223
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
224 :type base_folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
225 :param base_folder_id: id of the folder where to create the new folder.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
226 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
227
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
228 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
229 :return: List with a single dictionary containing information about the new folder
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
230 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
231 # Get root folder ID if no ID was provided
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
232 if base_folder_id is None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
233 base_folder_id = self._get_root_folder_id(library_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
234 # Compose the payload
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
235 payload = {}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
236 payload['name'] = folder_name
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
237 payload['folder_id'] = base_folder_id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
238 payload['create_type'] = 'folder'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
239 if description is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
240 payload['description'] = description
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
241 return self._post(payload, id=library_id, contents=True)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
242
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
243 def get_folders(self, library_id, folder_id=None, name=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
244 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
245 Get all the folders or filter specific one(s) via the provided ``name``
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
246 or ``folder_id`` in data library with id ``library_id``. Provide only
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
247 one argument: ``name`` or ``folder_id``, but not both.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
248
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
249 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
250 :param library_id: library id to use
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
251
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
252 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
253 :param folder_id: filter for folder by folder id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
254
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
255 :type name: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
256 :param name: filter for folder by name. For ``name`` specify the full
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
257 path of the folder starting from the library's root
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
258 folder, e.g. ``/subfolder/subsubfolder``.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
259
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
260 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
261 :return: list of dicts each containing basic information about a folder
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
262 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
263 if folder_id is not None and name is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
264 raise ValueError('Provide only one argument between name or folder_id, but not both')
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
265 library_contents = self.show_library(library_id=library_id, contents=True)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
266 if folder_id is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
267 folder = next((_ for _ in library_contents if _['type'] == 'folder' and _['id'] == folder_id), None)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
268 folders = [folder] if folder is not None else []
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
269 elif name is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
270 folders = [_ for _ in library_contents if _['type'] == 'folder' and _['name'] == name]
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
271 else:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
272 folders = [_ for _ in library_contents if _['type'] == 'folder']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
273 return folders
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
274
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
275 def get_libraries(self, library_id=None, name=None, deleted=False):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
276 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
277 Get all the libraries or filter for specific one(s) via the provided
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
278 name or ID. Provide only one argument: ``name`` or ``library_id``, but
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
279 not both.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
280
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
281 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
282 :param library_id: filter for library by library id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
283
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
284 :type name: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
285 :param name: If ``name`` is set and multiple names match the given name,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
286 all the libraries matching the argument will be returned
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
287
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
288 :type deleted: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
289 :param deleted: If ``False`` (the default), return only non-deleted
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
290 libraries. If ``True``, return only deleted libraries. If ``None``,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
291 return both deleted and non-deleted libraries.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
292
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
293 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
294 :return: list of dicts each containing basic information about a library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
295 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
296 if library_id is not None and name is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
297 raise ValueError('Provide only one argument between name or library_id, but not both')
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
298 libraries = self._get(params={"deleted": deleted})
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
299 if library_id is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
300 library = next((_ for _ in libraries if _['id'] == library_id), None)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
301 libraries = [library] if library is not None else []
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
302 if name is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
303 libraries = [_ for _ in libraries if _['name'] == name]
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
304 return libraries
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
305
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
306 def show_library(self, library_id, contents=False):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
307 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
308 Get information about a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
309
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
310 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
311 :param library_id: filter for library by library id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
312
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
313 :type contents: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
314 :param contents: whether to get contents of the library (rather
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
315 than just the library details)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
316
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
317 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
318 :return: details of the given library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
319 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
320 return self._get(id=library_id, contents=contents)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
321
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
322 def _do_upload(self, library_id, **keywords):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
323 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
324 Set up the POST request and do the actual data upload to a data library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
325 This method should not be called directly but instead refer to the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
326 methods specific for the desired type of data upload.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
327 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
328 folder_id = keywords.get('folder_id', None)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
329 if folder_id is None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
330 folder_id = self._get_root_folder_id(library_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
331 files_attached = False
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
332 # Compose the payload dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
333 payload = {}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
334 payload['folder_id'] = folder_id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
335 payload['file_type'] = keywords.get('file_type', 'auto')
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
336 payload['dbkey'] = keywords.get('dbkey', '?')
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
337 payload['create_type'] = 'file'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
338 if keywords.get("roles", None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
339 payload["roles"] = keywords["roles"]
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
340 if keywords.get("link_data_only", None) and keywords['link_data_only'] != 'copy_files':
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
341 payload["link_data_only"] = 'link_to_files'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
342 payload['tag_using_filenames'] = keywords.get('tag_using_filenames', False)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
343 if keywords.get('tags'):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
344 payload['tags'] = keywords['tags']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
345 payload['preserve_dirs'] = keywords.get('preserve_dirs', False)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
346 # upload options
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
347 if keywords.get('file_url', None) is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
348 payload['upload_option'] = 'upload_file'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
349 payload['files_0|url_paste'] = keywords['file_url']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
350 elif keywords.get('pasted_content', None) is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
351 payload['upload_option'] = 'upload_file'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
352 payload['files_0|url_paste'] = keywords['pasted_content']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
353 elif keywords.get('server_dir', None) is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
354 payload['upload_option'] = 'upload_directory'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
355 payload['server_dir'] = keywords['server_dir']
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
356 elif keywords.get('file_local_path', None) is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
357 payload['upload_option'] = 'upload_file'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
358 payload['files_0|file_data'] = attach_file(keywords['file_local_path'])
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
359 files_attached = True
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
360 elif keywords.get("filesystem_paths", None) is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
361 payload["upload_option"] = "upload_paths"
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
362 payload["filesystem_paths"] = keywords["filesystem_paths"]
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
363
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
364 try:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
365 return self._post(payload, id=library_id, contents=True,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
366 files_attached=files_attached)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
367 finally:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
368 if payload.get('files_0|file_data', None) is not None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
369 payload['files_0|file_data'].close()
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
370
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
371 def upload_file_from_url(self, library_id, file_url, folder_id=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
372 file_type='auto', dbkey='?',
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
373 tags=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
374 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
375 Upload a file to a library from a URL.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
376
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
377 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
378 :param library_id: id of the library where to place the uploaded file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
379
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
380 :type file_url: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
381 :param file_url: URL of the file to upload
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
382
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
383 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
384 :param folder_id: id of the folder where to place the uploaded file.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
385 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
386
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
387 :type file_type: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
388 :param file_type: Galaxy file format name
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
389
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
390 :type dbkey: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
391 :param dbkey: Dbkey
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
392
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
393 :type tags: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
394 :param tags: A list of tags to add to the datasets
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
395
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
396 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
397 :return: List with a single dictionary containing information about the LDDA
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
398 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
399 return self._do_upload(library_id, file_url=file_url,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
400 folder_id=folder_id, file_type=file_type,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
401 dbkey=dbkey,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
402 tags=tags)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
403
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
404 def upload_file_contents(self, library_id, pasted_content,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
405 folder_id=None, file_type='auto', dbkey='?',
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
406 tags=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
407 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
408 Upload pasted_content to a data library as a new file.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
409
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
410 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
411 :param library_id: id of the library where to place the uploaded file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
412
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
413 :type pasted_content: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
414 :param pasted_content: Content to upload into the library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
415
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
416 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
417 :param folder_id: id of the folder where to place the uploaded file.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
418 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
419
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
420 :type file_type: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
421 :param file_type: Galaxy file format name
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
422
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
423 :type dbkey: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
424 :param dbkey: Dbkey
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
425
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
426 :type tags: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
427 :param tags: A list of tags to add to the datasets
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
428
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
429 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
430 :return: List with a single dictionary containing information about the LDDA
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
431 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
432 return self._do_upload(library_id, pasted_content=pasted_content,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
433 folder_id=folder_id, file_type=file_type,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
434 dbkey=dbkey,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
435 tags=tags)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
436
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
437 def upload_file_from_local_path(self, library_id, file_local_path,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
438 folder_id=None, file_type='auto', dbkey='?',
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
439 tags=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
440 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
441 Read local file contents from file_local_path and upload data to a
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
442 library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
443
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
444 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
445 :param library_id: id of the library where to place the uploaded file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
446
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
447 :type file_local_path: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
448 :param file_local_path: path of local file to upload
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
449
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
450 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
451 :param folder_id: id of the folder where to place the uploaded file.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
452 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
453
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
454 :type file_type: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
455 :param file_type: Galaxy file format name
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
456
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
457 :type dbkey: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
458 :param dbkey: Dbkey
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
459
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
460 :type tags: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
461 :param tags: A list of tags to add to the datasets
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
462
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
463 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
464 :return: List with a single dictionary containing information about the LDDA
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
465 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
466 return self._do_upload(library_id, file_local_path=file_local_path,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
467 folder_id=folder_id, file_type=file_type,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
468 dbkey=dbkey,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
469 tags=tags)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
470
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
471 def upload_file_from_server(self, library_id, server_dir, folder_id=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
472 file_type='auto', dbkey='?', link_data_only=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
473 roles="", preserve_dirs=False, tag_using_filenames=False,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
474 tags=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
475 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
476 Upload all files in the specified subdirectory of the Galaxy library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
477 import directory to a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
478
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
479 .. note::
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
480 For this method to work, the Galaxy instance must have the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
481 ``library_import_dir`` option configured in the ``config/galaxy.yml``
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
482 configuration file.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
483
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
484 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
485 :param library_id: id of the library where to place the uploaded file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
486
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
487 :type server_dir: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
488 :param server_dir: relative path of the subdirectory of
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
489 ``library_import_dir`` to upload. All and only the files (i.e. no
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
490 subdirectories) contained in the specified directory will be
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
491 uploaded
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
492
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
493 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
494 :param folder_id: id of the folder where to place the uploaded files.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
495 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
496
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
497 :type file_type: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
498 :param file_type: Galaxy file format name
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
499
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
500 :type dbkey: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
501 :param dbkey: Dbkey
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
502
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
503 :type link_data_only: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
504 :param link_data_only: either 'copy_files' (default) or
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
505 'link_to_files'. Setting to 'link_to_files' symlinks instead of
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
506 copying the files
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
507
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
508 :type roles: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
509 :param roles: ???
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
510
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
511 :type preserve_dirs: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
512 :param preserve_dirs: Indicate whether to preserve the directory structure when importing dir
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
513
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
514 :type tag_using_filenames: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
515 :param tag_using_filenames: Indicate whether to generate dataset tags
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
516 from filenames.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
517
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
518 .. versionchanged:: 0.14.0
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
519 Changed the default from ``True`` to ``False``.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
520
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
521 :type tags: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
522 :param tags: A list of tags to add to the datasets
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
523
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
524 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
525 :return: List with a single dictionary containing information about the LDDA
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
526 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
527 return self._do_upload(library_id, server_dir=server_dir,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
528 folder_id=folder_id, file_type=file_type,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
529 dbkey=dbkey, link_data_only=link_data_only,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
530 roles=roles, preserve_dirs=preserve_dirs,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
531 tag_using_filenames=tag_using_filenames,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
532 tags=tags)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
533
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
534 def upload_from_galaxy_filesystem(self, library_id, filesystem_paths, folder_id=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
535 file_type="auto", dbkey="?", link_data_only=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
536 roles="", preserve_dirs=False, tag_using_filenames=False,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
537 tags=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
538 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
539 Upload a set of files already present on the filesystem of the Galaxy
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
540 server to a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
541
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
542 .. note::
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
543 For this method to work, the Galaxy instance must have the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
544 ``allow_path_paste`` option set to ``true`` in the
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
545 ``config/galaxy.yml`` configuration file.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
546
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
547 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
548 :param library_id: id of the library where to place the uploaded file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
549
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
550 :type filesystem_paths: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
551 :param filesystem_paths: file paths on the Galaxy server to upload to
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
552 the library, one file per line
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
553
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
554 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
555 :param folder_id: id of the folder where to place the uploaded files.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
556 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
557
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
558 :type file_type: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
559 :param file_type: Galaxy file format name
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
560
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
561 :type dbkey: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
562 :param dbkey: Dbkey
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
563
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
564 :type link_data_only: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
565 :param link_data_only: either 'copy_files' (default) or
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
566 'link_to_files'. Setting to 'link_to_files' symlinks instead of
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
567 copying the files
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
568
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
569 :type roles: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
570 :param roles: ???
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
571
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
572 :type preserve_dirs: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
573 :param preserve_dirs: Indicate whether to preserve the directory structure when importing dir
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
574
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
575 :type tag_using_filenames: bool
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
576 :param tag_using_filenames: Indicate whether to generate dataset tags
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
577 from filenames.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
578
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
579 .. versionchanged:: 0.14.0
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
580 Changed the default from ``True`` to ``False``.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
581
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
582 :type tags: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
583 :param tags: A list of tags to add to the datasets
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
584
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
585 :rtype: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
586 :return: List with a single dictionary containing information about the LDDA
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
587 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
588 return self._do_upload(library_id, filesystem_paths=filesystem_paths,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
589 folder_id=folder_id, file_type=file_type,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
590 dbkey=dbkey, link_data_only=link_data_only,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
591 roles=roles, preserve_dirs=preserve_dirs,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
592 tag_using_filenames=tag_using_filenames,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
593 tags=tags)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
594
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
595 def copy_from_dataset(self, library_id, dataset_id, folder_id=None, message=''):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
596 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
597 Copy a Galaxy dataset into a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
598
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
599 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
600 :param library_id: id of the library where to place the uploaded file
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
601
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
602 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
603 :param dataset_id: id of the dataset to copy from
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
604
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
605 :type folder_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
606 :param folder_id: id of the folder where to place the uploaded files.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
607 If not provided, the root folder will be used
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
608
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
609 :type message: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
610 :param message: message for copying action
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
611
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
612 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
613 :return: LDDA information
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
614 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
615 if folder_id is None:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
616 folder_id = self._get_root_folder_id(library_id)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
617 payload = {}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
618 payload['folder_id'] = folder_id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
619 payload['create_type'] = 'file'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
620 payload['from_hda_id'] = dataset_id
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
621 payload['ldda_message'] = message
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
622 return self._post(payload, id=library_id, contents=True)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
623
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
624 def get_library_permissions(self, library_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
625 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
626 Get the permissions for a library.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
627
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
628 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
629 :param library_id: id of the library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
630
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
631 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
632 :return: dictionary with all applicable permissions' values
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
633 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
634 url = self._make_url(library_id) + '/permissions'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
635 return self._get(url=url)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
636
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
637 def get_dataset_permissions(self, dataset_id):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
638 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
639 Get the permissions for a dataset.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
640
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
641 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
642 :param dataset_id: id of the dataset
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
643
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
644 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
645 :return: dictionary with all applicable permissions' values
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
646 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
647 url = '/'.join((self._make_url(), 'datasets', dataset_id, 'permissions'))
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
648 return self._get(url=url)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
649
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
650 def set_library_permissions(self, library_id, access_in=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
651 modify_in=None, add_in=None, manage_in=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
652 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
653 Set the permissions for a library. Note: it will override all security
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
654 for this library even if you leave out a permission type.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
655
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
656 :type library_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
657 :param library_id: id of the library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
658
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
659 :type access_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
660 :param access_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
661
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
662 :type modify_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
663 :param modify_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
664
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
665 :type add_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
666 :param add_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
667
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
668 :type manage_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
669 :param manage_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
670
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
671 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
672 :return: General information about the library
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
673 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
674 payload = {}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
675 if access_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
676 payload['LIBRARY_ACCESS_in'] = access_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
677 if modify_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
678 payload['LIBRARY_MODIFY_in'] = modify_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
679 if add_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
680 payload['LIBRARY_ADD_in'] = add_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
681 if manage_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
682 payload['LIBRARY_MANAGE_in'] = manage_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
683 url = self._make_url(library_id) + '/permissions'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
684 return self._post(payload, url=url)
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
685
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
686 def set_dataset_permissions(self, dataset_id, access_in=None,
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
687 modify_in=None, manage_in=None):
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
688 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
689 Set the permissions for a dataset. Note: it will override all security
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
690 for this dataset even if you leave out a permission type.
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
691
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
692 :type dataset_id: str
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
693 :param dataset_id: id of the dataset
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
694
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
695 :type access_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
696 :param access_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
697
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
698 :type modify_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
699 :param modify_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
700
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
701 :type manage_in: list
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
702 :param manage_in: list of role ids
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
703
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
704 :rtype: dict
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
705 :return: dictionary with all applicable permissions' values
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
706 """
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
707 payload = {}
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
708 if access_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
709 payload['access_ids[]'] = access_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
710 if modify_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
711 payload['modify_ids[]'] = modify_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
712 if manage_in:
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
713 payload['manage_ids[]'] = manage_in
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
714 # we need here to define an action
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
715 payload['action'] = 'set_permissions'
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
716 url = '/'.join((self._make_url(), 'datasets', dataset_id, 'permissions'))
4f3585e2f14b "planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
shellac
parents:
diff changeset
717 return self._post(payload, url=url)