MCPcopy Create free account
hub / github.com/BioinfoMachineLearning/FlowDock / write_pdb_models

Function write_pdb_models

flowdock/utils/visualization_utils.py:307–328  ·  view source on GitHub ↗

Write multiple models to a PDB file. :param results: Model results. :param out_path: Output path. :param b_factors: Optional B-factors.

(
    results,
    out_path: str = os.path.join("test_results", "debug.pdb"),
    b_factors: Optional[np.ndarray] = None,
)

Source from the content-addressed store, hash-verified

305
306
307def write_pdb_models(
308 results,
309 out_path: str = os.path.join("test_results", "debug.pdb"),
310 b_factors: Optional[np.ndarray] = None,
311):
312 """Write multiple models to a PDB file.
313
314 :param results: Model results.
315 :param out_path: Output path.
316 :param b_factors: Optional B-factors.
317 """
318 os.makedirs(os.path.dirname(out_path), exist_ok=True)
319 with open(out_path, "w") as of:
320 for mid, result in enumerate(results):
321 protein = from_prediction(
322 result["features"],
323 result,
324 b_factors=b_factors[mid] if b_factors is not None else None,
325 )
326 out_string = to_pdb(protein, model=mid + 1)
327 of.write(out_string)
328 of.write("END")
329
330
331def write_conformer_sdf(

Callers 1

multi_pose_samplingFunction · 0.90

Calls 3

from_predictionFunction · 0.85
to_pdbFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected