seer-pas-sdk 0.3.3__py3-none-any.whl → 0.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
seer_pas_sdk/core/sdk.py CHANGED
@@ -515,6 +515,8 @@ class SeerSDK:
515
515
  f"Failed to fetch sample data for plate ID: {plate_id}."
516
516
  )
517
517
  res = samples.json()["data"]
518
+ if not res:
519
+ return [] if not as_df else dict_to_df(res)
518
520
  res_df = dict_to_df(res)
519
521
 
520
522
  # API returns empty strings if not a control, replace with None for filtering purposes
@@ -1195,7 +1197,9 @@ class SeerSDK:
1195
1197
 
1196
1198
  return peptide_data
1197
1199
 
1198
- def list_search_result_files(self, analysis_id: str):
1200
+ def list_search_result_files(
1201
+ self, analysis_id: str, folder: str = None, recursive: bool = False
1202
+ ):
1199
1203
  """
1200
1204
  Given an analysis id, this function returns a list of files associated with the analysis.
1201
1205
 
@@ -1204,6 +1208,12 @@ class SeerSDK:
1204
1208
  analysis_id : str
1205
1209
  ID of the analysis for which the data is to be fetched.
1206
1210
 
1211
+ folder : str, optional
1212
+ Root folder key to list search result files from, defaulted to None.
1213
+
1214
+ recursive : bool, optional
1215
+ Whether to list files recursively from subfolders, defaulted to False.
1216
+
1207
1217
  Returns
1208
1218
  -------
1209
1219
  files: list[str]
@@ -1218,9 +1228,15 @@ class SeerSDK:
1218
1228
 
1219
1229
  if analysis_metadata.get("status") in ["Failed", None]:
1220
1230
  raise ValueError("Cannot find files for a failed analysis.")
1231
+
1232
+ params = {"all": "true"}
1233
+ if folder:
1234
+ params["folderKey"] = folder
1235
+
1221
1236
  with self._get_auth_session() as s:
1222
1237
  response = s.get(
1223
- f"{self._auth.url}api/v2/analysisResultFiles/{analysis_id}"
1238
+ f"{self._auth.url}api/v2/analysisResultFiles/{analysis_id}",
1239
+ params=params,
1224
1240
  )
1225
1241
  if response.status_code != 200:
1226
1242
  raise ServerError(
@@ -1228,8 +1244,25 @@ class SeerSDK:
1228
1244
  )
1229
1245
  response = response.json()
1230
1246
  files = []
1247
+ folders = []
1231
1248
  for row in response["data"]:
1232
- files.append(row["filename"])
1249
+ if folder:
1250
+ row["filename"] = f"{folder}/{row['filename']}"
1251
+ if row["isFolder"]:
1252
+ if recursive:
1253
+ folders.append(row["filename"])
1254
+ else:
1255
+ row["filename"] += "/"
1256
+ files.append(row["filename"])
1257
+ else:
1258
+ files.append(row["filename"])
1259
+
1260
+ if recursive:
1261
+ for subfolder in folders:
1262
+ files += self.list_search_result_files(
1263
+ analysis_id, folder=subfolder, recursive=recursive
1264
+ )
1265
+
1233
1266
  return files
1234
1267
 
1235
1268
  def get_search_result(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seer-pas-sdk
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: SDK for Seer Proteograph Analysis Suite (PAS)
5
5
  Author-email: Ryan Sun <rsun@seer.bio>
6
6
  License:
@@ -5,14 +5,14 @@ seer_pas_sdk/common/__init__.py,sha256=jA5qm-t9x3qXMp5Q6v7vV2kZdLw32-lnbtf0fPY4l
5
5
  seer_pas_sdk/common/errors.py,sha256=4HFORWnaQQCMXRE8kwdsJWvQRB_3KFEZ7yMb391e4gA,142
6
6
  seer_pas_sdk/common/groupanalysis.py,sha256=DxB-gbQfYzl7p9MTYWDIqghcH-IeakzdYdrRZrlIHek,1730
7
7
  seer_pas_sdk/core/__init__.py,sha256=rxbKgg-Qe24OaxX2zyHHYPYgDCTEKE_-41bB2wvpvL4,25
8
- seer_pas_sdk/core/sdk.py,sha256=yjQAMDH5FTz-EQeB5d_Q0Qq9P-2Ca9bF2pVeDSR4GtU,107380
8
+ seer_pas_sdk/core/sdk.py,sha256=NHhUCxuhea_KhCd3FLpojCwkOZDIZuvjU7K52h695KY,108508
9
9
  seer_pas_sdk/core/unsupported.py,sha256=XAPZ3tidqjnsgftf3NUdTGIzvnsjHy0e_eGRCAo6GPo,59890
10
10
  seer_pas_sdk/objects/__init__.py,sha256=HJLS6sOr7DfzdI14fv5dWcITEj5QQsKcdfED3YNvUrY,107
11
11
  seer_pas_sdk/objects/groupanalysis.py,sha256=x3D_5NmYBoPDilNCQqUoCFARIfIeUq4FBY3_N6u8tfM,994
12
12
  seer_pas_sdk/objects/platemap.py,sha256=8IvJPAecs_e_FyqibzhCw-O4zjCFnf-zMUp_5krTEsg,5864
13
13
  seer_pas_sdk/objects/volcanoplot.py,sha256=tKuCWDIdoO8FLJlhpXhuwHn0aMYnvudTugxAslDXyGs,9357
14
- seer_pas_sdk-0.3.3.dist-info/licenses/LICENSE.txt,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
15
- seer_pas_sdk-0.3.3.dist-info/METADATA,sha256=LfLErPJW2iZBwSfBgZU61azIJtvDdh2d4Zvviv5zyjM,13448
16
- seer_pas_sdk-0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- seer_pas_sdk-0.3.3.dist-info/top_level.txt,sha256=-2kZ-KFMGtXwr8H1O5llMKlcJ8gRKohEmrIvazXB61s,13
18
- seer_pas_sdk-0.3.3.dist-info/RECORD,,
14
+ seer_pas_sdk-0.3.4.dist-info/licenses/LICENSE.txt,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
15
+ seer_pas_sdk-0.3.4.dist-info/METADATA,sha256=QuSAislG3NV9SE66n1xNF4Kf7Nk704jSEPCyefSoP_E,13448
16
+ seer_pas_sdk-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ seer_pas_sdk-0.3.4.dist-info/top_level.txt,sha256=-2kZ-KFMGtXwr8H1O5llMKlcJ8gRKohEmrIvazXB61s,13
18
+ seer_pas_sdk-0.3.4.dist-info/RECORD,,