rowan-python 2.1.8__py3-none-any.whl → 2.1.10__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.
rowan/folder.py CHANGED
@@ -58,6 +58,7 @@ class Folder(BaseModel):
58
58
 
59
59
  return self
60
60
 
61
+
61
62
  def update(
62
63
  self,
63
64
  name: str | None = None,
@@ -110,6 +111,15 @@ class Folder(BaseModel):
110
111
  response = client.delete(f"/folder/{self.uuid}")
111
112
  response.raise_for_status()
112
113
 
114
+ def print_folder_tree(self, max_depth: int = 10, show_uuids: bool = False) -> None:
115
+ """
116
+ Retrieves a folder tree from the API.
117
+
118
+ :param max_depth: The maximum depth of the folder tree.
119
+ :param show_uuids: Whether to show the UUIDs of the folders.
120
+ :raises HTTPError: If the API request fails.
121
+ """
122
+ print_folder_tree(self.uuid, max_depth, show_uuids)
113
123
 
114
124
  def retrieve_folder(uuid: str) -> Folder:
115
125
  """
@@ -125,19 +135,6 @@ def retrieve_folder(uuid: str) -> Folder:
125
135
  return Folder(**response.json())
126
136
 
127
137
 
128
- def home_folder() -> Folder:
129
- """
130
- Retrieves the home folder from the API.
131
-
132
- :return: A Folder object representing the home folder.
133
- :raises HTTPError: If the API request fails.
134
- """
135
- with api_client() as client:
136
- response = client.get("/user/me/root_folders")
137
- response.raise_for_status()
138
- return Folder(**response.json()["user_root"])
139
-
140
-
141
138
  def list_folders(
142
139
  parent_uuid: str | None = None,
143
140
  name_contains: str | None = None,
@@ -210,3 +207,22 @@ def create_folder(
210
207
  response.raise_for_status()
211
208
  folder_data = response.json()
212
209
  return Folder(**folder_data)
210
+
211
+ def print_folder_tree(uuid: str, max_depth: int = 10, show_uuids: bool = False) -> None:
212
+ """
213
+ Retrieves a folder tree from the API.
214
+
215
+ :param uuid: The UUID of the root of the folder tree.
216
+ :param max_depth: The maximum depth of the folder tree.
217
+ :param show_uuids: Whether to show the UUIDs of the folders.
218
+ :raises HTTPError: If the API request fails.
219
+ """
220
+ params: dict[str, Any] = {
221
+ "max_depth": max_depth,
222
+ "show_uuids": show_uuids,
223
+ }
224
+ with api_client() as client:
225
+ response = client.get(f"/folder/{uuid}/folder_tree", params=params)
226
+ response.raise_for_status()
227
+ folder_data = response.json()
228
+ print(folder_data)
rowan/protein.py CHANGED
@@ -114,6 +114,27 @@ class Protein(BaseModel):
114
114
  response = client.post(f"/protein/sanitize/{self.uuid}")
115
115
  response.raise_for_status()
116
116
 
117
+ def download_pdb_file(self, path: Path | None = None, name: str | None = None) -> None:
118
+ """
119
+ Downloads the PDB file for a protein
120
+
121
+ :param path: Directory to save the file to (defaults to current directory)
122
+ :param name: Optional custom name for the file (defaults to protein name)
123
+ :raises requests.HTTPError: if the request to the API fails
124
+ """
125
+ if path is None:
126
+ path = Path.cwd()
127
+
128
+ path.mkdir(parents=True, exist_ok=True)
129
+
130
+ with api_client() as client:
131
+ response = client.get(f"/protein/{self.uuid}/get_pdb_file")
132
+ response.raise_for_status()
133
+
134
+ file_path = path / f"{name or self.name}.pdb"
135
+ with open(file_path, "wb") as f:
136
+ f.write(response.content)
137
+
117
138
 
118
139
  def retrieve_protein(uuid: str) -> Protein:
119
140
  """
rowan/workflow.py CHANGED
@@ -240,6 +240,35 @@ class Workflow(BaseModel):
240
240
  with open(path / f"{self.name}-msa.tar.gz", "wb") as f:
241
241
  f.write(response.content)
242
242
 
243
+ def download_dcd_files(self, replicates: list[int],
244
+ name: str | None = None, path: Path | None = None) -> None:
245
+ """
246
+ Downloads DCD trajectory files for specified replicates
247
+
248
+ :param replicates: List of replicate indices to download
249
+ :param name: Optional custom name for the tar.gz file (defaults to workflow name)
250
+ :param path: Directory to save the file to (defaults to current directory)
251
+ :raises ValueError: if workflow is not a pose analysis MD workflow
252
+ :raises requests.HTTPError: if the request to the API fails
253
+ """
254
+ if self.workflow_type != "pose_analysis_md":
255
+ raise ValueError("This workflow is not a pose analysis molecular dynamics workflow.")
256
+
257
+ if path is None:
258
+ path = Path.cwd()
259
+
260
+ path.mkdir(parents=True, exist_ok=True)
261
+
262
+ with api_client() as client:
263
+ response = client.post(
264
+ f"/trajectory/{self.uuid}/trajectory_dcds", json=replicates
265
+ )
266
+ response.raise_for_status()
267
+
268
+ file_path = path / f"{name or self.name}.tar.gz"
269
+ with open(file_path, "wb") as f:
270
+ f.write(response.content)
271
+
243
272
 
244
273
  def submit_workflow(
245
274
  workflow_type: stjames.WORKFLOW_NAME,
@@ -379,6 +408,33 @@ def retrieve_workflow(uuid: str) -> Workflow:
379
408
  return Workflow(**response.json())
380
409
 
381
410
 
411
+ def retrieve_workflows(uuids: list[str]) -> list[Workflow]:
412
+ """
413
+ Retrieves a list of workflows from the API.
414
+
415
+ :param uuids: The UUIDs of the workflows to retrieve.
416
+ :return: A list of Workflow objects representing the retrieved workflows.
417
+ :raises HTTPError: If the API request fails.
418
+ """
419
+ with api_client() as client:
420
+ response = client.post("/workflow/batch_retrieve", json={"uuids": uuids})
421
+ response.raise_for_status()
422
+ return [Workflow(**workflow_data) for workflow_data in response.json()]
423
+
424
+ def batch_poll_status(uuids: list[str]) -> list[Workflow]:
425
+ """
426
+ Polls the status of a list of workflows.
427
+
428
+ :param uuids: The UUIDs of the workflows to poll.
429
+ :return: A dictionary of statuses and the count of workflows in that status.
430
+ :raises HTTPError: If the API request fails.
431
+ """
432
+ with api_client() as client:
433
+ response = client.post("/workflow/batch_status", json={"uuids": uuids})
434
+ response.raise_for_status()
435
+ return response.json()
436
+
437
+
382
438
  def retrieve_calculation_molecules(
383
439
  uuid: str, return_frequencies: bool = False
384
440
  ) -> list[dict[str, Any]]:
@@ -1520,7 +1576,16 @@ def submit_msa_workflow(
1520
1576
  max_credits: int | None = None,
1521
1577
  ) -> Workflow:
1522
1578
  """
1523
- Submits an MSA workflow to the API.
1579
+ Submits a multiple sequence alignment (MSA) workflow to the API.
1580
+
1581
+ :param initial_protein_sequences: List of protein sequences to align, as ProteinSequence objects
1582
+ sor strings.
1583
+ :param output_formats: List of output formats for the resulting MSA files.
1584
+ :param name: The name to assign to the workflow.
1585
+ :param folder_uuid: UUID of the folder where the workflow will be stored.
1586
+ :param max_credits: The maximum number of credits to use for the workflow.
1587
+ :return: A Workflow object representing the submitted MSA workflow.
1588
+ :raises HTTPError: If the API request fails.
1524
1589
  """
1525
1590
  workflow = stjames.MSAWorkflow(
1526
1591
  initial_protein_sequences=initial_protein_sequences,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 2.1.8
3
+ Version: 2.1.10
4
4
  Summary: Rowan Python Library
5
5
  Project-URL: Homepage, https://github.com/rowansci/rowan-client
6
6
  Project-URL: Bug Tracker, https://github.com/rowansci/rowan-client/issues
@@ -11,7 +11,7 @@ Requires-Dist: httpx
11
11
  Requires-Dist: nest-asyncio
12
12
  Requires-Dist: rdkit
13
13
  Requires-Dist: setuptools
14
- Requires-Dist: stjames>=0.0.125
14
+ Requires-Dist: stjames>=0.0.128
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # Rowan Python Library
@@ -1,15 +1,15 @@
1
1
  rowan/__init__.py,sha256=2rz6dW0l9DzawiFi6S0WSv8XlZq1CoTBKJrsJ1uesvk,171
2
2
  rowan/constants.py,sha256=emCH4m9OL2Hm5E-6mJGM_FgzrK_JrZT-FiKJ6pMNQ4Y,84
3
- rowan/folder.py,sha256=n9WkjHMweQLtVcWUvCttOrmezvUdbFxam_eDEMzLF_A,6791
3
+ rowan/folder.py,sha256=MF3SU7uG6Hl2SJLFxbPmbhosS-pPEHwbTyummaaRdzM,7509
4
4
  rowan/project.py,sha256=ALPPkMa_cg7w5OkXno1cs6acCofw8AOUYRSeWgr3L0o,3774
5
- rowan/protein.py,sha256=bMemvLZua_pnTrYOxHFZ4jFlRH9KgpYvtjj5M2__28k,8026
5
+ rowan/protein.py,sha256=mFSVCr-08bSikXBUtJtSWzjKcVAuBmTeRckn7JUHYSE,8810
6
6
  rowan/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  rowan/user.py,sha256=Dl--NPUPATKCs2VmILsW8HnLiunG0Lxr0n6mKuHm21U,3891
8
8
  rowan/utils.py,sha256=64II-cPOe_SFJK302Bm8hP62d_3_CgnTVYCbn3zKT7U,3334
9
- rowan/workflow.py,sha256=tPvFXYC9O8Qr_9HVGDzYTgW-3MrFcDLGqbGDzlOq5tI,58562
9
+ rowan/workflow.py,sha256=l21KygojLRsM6JI2b0H-hcbOnaFsDZGhbqmLy3sexjA,61360
10
10
  rowan/rowan_rdkit/__init__.py,sha256=EATX2VRzywzKxqkpCUMTf7RNQLkWsfi5VcCNDW6EIiw,503
11
11
  rowan/rowan_rdkit/chem_utils.py,sha256=sKCzul2e0ldVYTBImhTwso7ddNgPKmvS-OmvCEjVJH0,34788
12
- rowan_python-2.1.8.dist-info/METADATA,sha256=H4imf_mPDAVYyT8l7AYJsC947qE2yfu0labnvuhDdX4,1600
13
- rowan_python-2.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- rowan_python-2.1.8.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
- rowan_python-2.1.8.dist-info/RECORD,,
12
+ rowan_python-2.1.10.dist-info/METADATA,sha256=8AzU2Im1apsPTrfFyZ3OYfPYaI9V_vwmRjKOfOy6xiI,1601
13
+ rowan_python-2.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ rowan_python-2.1.10.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
+ rowan_python-2.1.10.dist-info/RECORD,,