geoseeq 0.6.10__py3-none-any.whl → 0.6.12.dev0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
geoseeq/cli/main.py CHANGED
@@ -54,7 +54,7 @@ def version():
54
54
  Use of this tool implies acceptance of the GeoSeeq End User License Agreement.
55
55
  Run `geoseeq eula show` to view the EULA.
56
56
  """
57
- click.echo('0.6.10') # remember to update pyproject.toml
57
+ click.echo('0.6.12dev0') # remember to update pyproject.toml
58
58
 
59
59
 
60
60
  @main.group('advanced')
geoseeq/sample.py CHANGED
@@ -200,6 +200,7 @@ class Sample(RemoteObject):
200
200
  """
201
201
  url = f"data/samples/{self.uuid}/all-fastqs"
202
202
  blob = self.knex.get(url)
203
+ print(blob)
203
204
  files = {}
204
205
  for read_type, folders in blob.items():
205
206
  files[read_type] = {}
@@ -208,8 +209,8 @@ class Sample(RemoteObject):
208
209
  if read_type in ["short_read::paired_end"]:
209
210
  files[read_type][folder_name].append(
210
211
  [
211
- self._grn_to_file(file_grns[0]),
212
- self._grn_to_file(file_grns[1]),
212
+ self._grn_to_file(file_grns[0][0]),
213
+ self._grn_to_file(file_grns[0][1]),
213
214
  ]
214
215
  )
215
216
  else:
@@ -127,15 +127,22 @@ class GeoSeeqUploadManager:
127
127
 
128
128
 
129
129
  def _download_one_file(args):
130
- url, file_path, pbar, ignore_errors, head, log_level, parallel_downloads = args
130
+ original_url, file_path, callback, pbar, ignore_errors, head, log_level, parallel_downloads = args
131
131
  if parallel_downloads:
132
132
  _make_in_process_logger(log_level)
133
- if isinstance(url, ResultFile):
134
- url = url.get_download_url()
133
+ if isinstance(original_url, ResultFile):
134
+ url = original_url.get_download_url()
135
+ else:
136
+ url = original_url
135
137
  try:
136
138
  if dirname(file_path):
137
139
  makedirs(dirname(file_path), exist_ok=True)
138
- return download_url(url, filename=file_path, progress_tracker=pbar, head=head)
140
+ local_path = download_url(url, filename=file_path, progress_tracker=pbar, head=head)
141
+ if callback is not None:
142
+ callback_result = callback(local_path)
143
+ else:
144
+ callback_result = None
145
+ return local_path, original_url, callback_result
139
146
  except Exception as e:
140
147
  if ignore_errors:
141
148
  logger.error(f"Error downloading {url}: {e}")
@@ -153,13 +160,14 @@ class GeoSeeqDownloadManager:
153
160
  self.log_level = log_level
154
161
  self._result_files = []
155
162
 
156
- def add_download(self, url, file_path=None, progress_tracker=None):
163
+
164
+ def add_download(self, url, file_path=None, progress_tracker=None, callback=None):
157
165
  if not file_path:
158
166
  if isinstance(url, ResultFile):
159
167
  file_path = url.get_local_filename()
160
168
  else:
161
169
  raise ValueError("file_path must be provided if url is not a ResultFile object.")
162
- self._result_files.append((url, file_path))
170
+ self._result_files.append((url, file_path, callback))
163
171
 
164
172
 
165
173
  def add_result_folder_download(self, result_folder, local_folder_path, hidden_files=True):
@@ -170,14 +178,14 @@ class GeoSeeqDownloadManager:
170
178
 
171
179
  def get_preview_string(self):
172
180
  out = ["Download Preview:"]
173
- for url, file_path in self._result_files:
181
+ for url, file_path, _ in self._result_files:
174
182
  out.append(f"{url} -> {file_path}")
175
183
  return "\n".join(out)
176
184
 
177
185
  def get_url_string(self):
178
186
  self._convert_result_files_to_urls()
179
187
  out = []
180
- for url, _ in self._result_files:
188
+ for url, _, _ in self._result_files:
181
189
  out.append(url)
182
190
  return "\n".join(out)
183
191
 
@@ -187,17 +195,21 @@ class GeoSeeqDownloadManager:
187
195
  def _convert_result_files_to_urls(self):
188
196
  self._result_files = [(
189
197
  url.get_download_url() if isinstance(url, ResultFile) else url,
190
- file_path,
191
- ) for url, file_path in self._result_files]
198
+ file_path, callback
199
+ ) for url, file_path, callback in self._result_files]
192
200
 
193
201
  def download_files(self):
202
+ """Return a list of 3-ples (local_path, remote url, callback_result).
203
+
204
+ If no callback was provided with the file callback result is None
205
+ """
194
206
  self._convert_result_files_to_urls()
195
207
  download_args = [(
196
- url, file_path,
208
+ url, file_path, callback,
197
209
  self.progress_tracker_factory(file_path),
198
210
  self.ignore_errors, self.head, self.log_level,
199
211
  self.n_parallel_downloads > 1
200
- ) for url, file_path in self._result_files]
212
+ ) for url, file_path, callback in self._result_files]
201
213
  out = []
202
214
  if self.n_parallel_downloads == 1:
203
215
  logger.info(f"Downloading files in series.")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: geoseeq
3
- Version: 0.6.10
3
+ Version: 0.6.12.dev0
4
4
  Summary: GeoSeeq command line tools and python API
5
5
  Author: David C. Danko
6
6
  Author-email: "David C. Danko" <dcdanko@biotia.io>
@@ -17,6 +17,7 @@ Requires-Dist: click
17
17
  Requires-Dist: pandas
18
18
  Requires-Dist: biopython
19
19
  Requires-Dist: tqdm
20
+ Dynamic: author
20
21
 
21
22
  # Geoseeq API Client
22
23
 
@@ -9,9 +9,9 @@ geoseeq/organization.py,sha256=bJkYL8_D-k6IYAaii2ZbxjwYnXy6lvu6iLXscxKlA3w,2542
9
9
  geoseeq/pipeline.py,sha256=89mhWaecsKnm6tyRkdkaVp4dmZh62_v42Ze0oXf8OTY,9873
10
10
  geoseeq/project.py,sha256=kN6m1N4Tlud7saU03Sbir-oIBnXet_Cwi2OVVdaeag0,13929
11
11
  geoseeq/remote_object.py,sha256=GYN6PKU7Zz3htIdpFjfZiFejzGqqJHbJyKlefM1Eixk,7151
12
- geoseeq/sample.py,sha256=OU4H-U8XxsFosfa9wcWWrHq9NVT3nDKZcvPtPGGlLlk,8310
12
+ geoseeq/sample.py,sha256=nlvmSy2WmiOMamkulNRloFPX7E9jVs34m1vO1PSOrHU,8336
13
13
  geoseeq/search.py,sha256=gawad6Cx5FxJBPlYkXWb-UKAO-UC0_yhvyU9Ca1kaNI,3388
14
- geoseeq/upload_download_manager.py,sha256=FMRqLLg77o1qFbWZc5Yc86a2pjeZrrn1rHJr1iaxKCU,8757
14
+ geoseeq/upload_download_manager.py,sha256=jVGZn9xXa4HZUFRFZawRRhfzFc8f2U8x06P-WTDDSNw,9271
15
15
  geoseeq/user.py,sha256=tol8i1UGLRrbMw5jeJDnna1ikRgrCDd50Jxz0a1lSgg,690
16
16
  geoseeq/utils.py,sha256=ZXpWb2MetUIeLrExiXb7IaOXYrW1pvrdP3o0KWzbwCs,4035
17
17
  geoseeq/work_orders.py,sha256=5uLVVfdKE8qh4gGaHkdBpXJGRTujuSg59knWCqEET4A,8071
@@ -22,7 +22,7 @@ geoseeq/cli/detail.py,sha256=q8Suu-j2k18knfSVFG-SWWGNsKM-n8y9RMA3LcIIi9Y,4132
22
22
  geoseeq/cli/download.py,sha256=W3OswqpHg1thzW6CJ7IcSS0Te2LA2WfgYISQMSl4GQg,18921
23
23
  geoseeq/cli/fastq_utils.py,sha256=-bmeQLaiMBm57zWOF0R5OlWTU0_3sh1JBC1RYw2BOFM,3083
24
24
  geoseeq/cli/get_eula.py,sha256=79mbUwyiF7O1r0g6UTxG9kJGQEqKuH805E6eLkPC6Y4,997
25
- geoseeq/cli/main.py,sha256=NPW0EHw2JSdyQ5_nCSPiCsEsy0ZKJ1u7WJa9RQfMmqI,3918
25
+ geoseeq/cli/main.py,sha256=wiZwbHB21qaqERjOk1tvkgX7pyhJv2_vSfe9tp1NItI,3922
26
26
  geoseeq/cli/manage.py,sha256=wGXAcVaXqE5JQEU8Jh6OlHr02nB396bpS_SFcOZdrEo,5929
27
27
  geoseeq/cli/progress_bar.py,sha256=p1Xl01nkYxSBZCB30ue2verIIi22W93m3ZAMAxipD0g,738
28
28
  geoseeq/cli/project.py,sha256=V5SdXm2Hwo2lxrkpwRDedw-mAE4XnM2uwT-Gj1D90VQ,3030
@@ -85,9 +85,9 @@ geoseeq/vc/vc_stub.py,sha256=IQr8dI0zsWKVAeY_5ybDD6n49_3othcgfHS3P0O9tuY,3110
85
85
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  tests/test_api_client.py,sha256=TS5njc5pcPP_Ycy-ljcfPVT1hQRBsFVdQ0lCqBmoesU,12810
87
87
  tests/test_plotting.py,sha256=TcTu-2ARr8sxZJ7wPQxmbs3-gHw7uRvsgrhhhg0qKik,784
88
- geoseeq-0.6.10.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
89
- geoseeq-0.6.10.dist-info/METADATA,sha256=moKunTjFSy4nQVg0X-Es5JmhsyPwtU9DZr-LIR6bCUE,4916
90
- geoseeq-0.6.10.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
91
- geoseeq-0.6.10.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
92
- geoseeq-0.6.10.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
93
- geoseeq-0.6.10.dist-info/RECORD,,
88
+ geoseeq-0.6.12.dev0.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
89
+ geoseeq-0.6.12.dev0.dist-info/METADATA,sha256=PC7pMgWpLQfZMsADepB4xj7y4zBpNjGJdP0DkcB7ccY,4937
90
+ geoseeq-0.6.12.dev0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
91
+ geoseeq-0.6.12.dev0.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
92
+ geoseeq-0.6.12.dev0.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
93
+ geoseeq-0.6.12.dev0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.7.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5