@@ -199,93 +199,21 @@ def fold_get_extra_result(
199199 The result as a numpy array (for "pae", "pde", "plddt") or a list of dictionaries (for "confidence", "affinity").
200200 """
201201 if key in {"pae" , "pde" , "plddt" , "ptm" }:
202- formatter = lambda response : np .load (io .BytesIO (response .content ))
203- elif key in {"confidence" , "affinity" }:
204- formatter = lambda response : response .json ()
205- elif key in {"score" , "metrics" }:
206- import pandas as pd
207-
208- formatter = lambda response : pd .read_csv (io .StringIO (response .content .decode ()))
209- else :
210- raise ValueError (f"Unexpected key: { key } " )
211- endpoint = PATH_PREFIX + f"/{ job_id } /{ sequence_or_index } /{ key } "
212- try :
213- response = session .get (
214- endpoint ,
215- )
216- except HTTPError as e :
217- if e .status_code == 400 and key == "affinity" :
218- raise ValueError ("affinity not found for request" ) from None
219- raise e
220- output = formatter (response )
221- return output
222-
223-
224- def fold_get_complex_result (
225- session : APISession , job_id : str , format : Literal ["pdb" , "mmcif" ]
226- ) -> bytes :
227- """
228- Get encoded result for a complex from the request ID.
229202
230- Parameters
231- ----------
232- session : APISession
233- Session object for API communication.
234- job_id : str
235- Job ID to retrieve results from.
236- format : {'pdb', 'mmcif'}
237- Format of the result.
238-
239- Returns
240- -------
241- bytes
242- Encoded result for the complex.
243- """
244- endpoint = PATH_PREFIX + f"/{ job_id } /complex"
245- response = session .get (
246- endpoint ,
247- params = {
248- "format" : format ,
249- },
250- )
251- return response .content
252-
253-
254- def fold_get_complex_extra_result (
255- session : APISession ,
256- job_id : str ,
257- key : Literal [
258- "pae" , "pde" , "plddt" , "ptm" , "confidence" , "affinity" , "score" , "metrics"
259- ],
260- ) -> "np.ndarray | list[dict] | pd.DataFrame" :
261- """
262- Get extra result for a complex from the request ID.
263-
264- Parameters
265- ----------
266- session : APISession
267- Session object for API communication.
268- job_id : str
269- Job ID to retrieve results from.
270- key : {'pae', 'pde', 'plddt', 'ptm', 'confidence', 'affinity', 'score', 'metrics'}
271- The type of result to retrieve.
272-
273- Returns
274- -------
275- numpy.ndarray or list of dict
276- The result as a numpy array (for "pae", "pde", "plddt") or a list of dictionaries (for "confidence", "affinity").
277- """
278- if key in {"pae" , "pde" , "plddt" , "ptm" }:
279- formatter = lambda response : np .load (io .BytesIO (response .content ))
203+ def formatter (response ):
204+ return np .load (io .BytesIO (response .content ))
280205 elif key in {"confidence" , "affinity" }:
281- formatter = lambda response : response .json ()
206+
207+ def formatter (response ):
208+ return response .json ()
282209 elif key in {"score" , "metrics" }:
283210 import pandas as pd
284211
285- formatter = lambda response : pd .read_csv (io .StringIO (response .content .decode ()))
212+ def formatter (response ):
213+ return pd .read_csv (io .StringIO (response .content .decode ()))
286214 else :
287215 raise ValueError (f"Unexpected key: { key } " )
288- endpoint = PATH_PREFIX + f"/{ job_id } /complex /{ key } "
216+ endpoint = PATH_PREFIX + f"/{ job_id } /{ sequence_or_index } /{ key } "
289217 try :
290218 response = session .get (
291219 endpoint ,
@@ -321,28 +249,8 @@ def fold_models_post(
321249 The outer list represents the batch of requests, and the inner
322250 list represents the complex, with each item in the list being
323251 an entity in that complex. A monomer would thus be a single item.
324- num_recycles : int, optional
325- Number of recycles for structure prediction.
326- num_models : int, optional
327- Number of models to generate.
328- num_relax : int, optional
329- Number of relaxation steps.
330- use_potentials : bool, optional
331- Whether to use potentials.
332- diffusion_samples : int, optional
333- Number of diffusion samples (boltz).
334- recycling_steps : int, optional
335- Number of recycling steps (boltz).
336- sampling_steps : int, optional
337- Number of sampling steps (boltz).
338- step_scale : float, optional
339- Step scale (boltz).
340- constraints : dict, optional
341- Constraints to apply.
342- templates : list, optional
343- Templates to use.
344- properties : dict, optional
345- Additional properties.
252+ **kwargs
253+ Additional keyword arguments to be sent with POST body.
346254
347255 Returns
348256 -------
0 commit comments