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

Function multi_pose_sampling

flowdock/utils/sampling_utils.py:122–427  ·  view source on GitHub ↗

Sample multiple poses of a protein-ligand complex. :param receptor_path: Path to the receptor file. :param ligand_path: Path to the ligand file. :param cfg: Config dictionary. :param lit_module: LightningModule instance. :param out_path: Path to save the output files. :param

(
    receptor_path: str,
    ligand_path: str,
    cfg: DictConfig,
    lit_module: LightningModule,
    out_path: str,
    save_pdb: bool = True,
    separate_pdb: bool = True,
    chain_id: Optional[str] = None,
    apo_receptor_path: Optional[str] = None,
    sample_id: Optional[str] = None,
    protein: Optional[FDProtein] = None,
    sequences_to_embeddings: Optional[Dict[str, np.ndarray]] = None,
    confidence: bool = True,
    affinity: bool = True,
    return_all_states: bool = False,
    auxiliary_estimation_only: bool = False,
    **kwargs: Dict[str, Any],
)

Source from the content-addressed store, hash-verified

120
121
122def multi_pose_sampling(
123 receptor_path: str,
124 ligand_path: str,
125 cfg: DictConfig,
126 lit_module: LightningModule,
127 out_path: str,
128 save_pdb: bool = True,
129 separate_pdb: bool = True,
130 chain_id: Optional[str] = None,
131 apo_receptor_path: Optional[str] = None,
132 sample_id: Optional[str] = None,
133 protein: Optional[FDProtein] = None,
134 sequences_to_embeddings: Optional[Dict[str, np.ndarray]] = None,
135 confidence: bool = True,
136 affinity: bool = True,
137 return_all_states: bool = False,
138 auxiliary_estimation_only: bool = False,
139 **kwargs: Dict[str, Any],
140) -> Tuple[
141 Optional[Chem.Mol],
142 Optional[List[float]],
143 Optional[List[float]],
144 Optional[List[float]],
145 Optional[List[Any]],
146 Optional[Any],
147 Optional[np.ndarray],
148 Optional[np.ndarray],
149]:
150 """Sample multiple poses of a protein-ligand complex.
151
152 :param receptor_path: Path to the receptor file.
153 :param ligand_path: Path to the ligand file.
154 :param cfg: Config dictionary.
155 :param lit_module: LightningModule instance.
156 :param out_path: Path to save the output files.
157 :param save_pdb: Whether to save PDB files.
158 :param separate_pdb: Whether to save separate PDB files for each pose.
159 :param chain_id: Chain ID of the receptor.
160 :param apo_receptor_path: Path to the optional apo receptor file.
161 :param sample_id: Optional sample ID.
162 :param protein: Optional protein object.
163 :param sequences_to_embeddings: Mapping of sequences to embeddings.
164 :param confidence: Whether to estimate confidence scores.
165 :param affinity: Whether to estimate affinity scores.
166 :param return_all_states: Whether to return all states.
167 :param auxiliary_estimation_only: Whether to only estimate auxiliary outputs (e.g., confidence,
168 affinity) for the input (generated) samples (potentially derived from external sources).
169 :param kwargs: Additional keyword arguments.
170 :return: Reference molecule, protein plDDTs, ligand plDDTs, ligand fragment plDDTs, estimated
171 binding affinities, structure trajectories, input batch, B-factors, and structure rankings.
172 """
173 if return_all_states and auxiliary_estimation_only:
174 # NOTE: If auxiliary estimation is solely enabled, structure trajectory sampling will be disabled
175 return_all_states = False
176 struct_res_all, lig_res_all = [], []
177 plddt_all, plddt_lig_all, plddt_ligs_all, res_plddt_all = [], [], [], []
178 affinity_all, ligs_affinity_all = [], []
179 frames_all = []

Callers 1

predict_stepMethod · 0.90

Calls 13

collate_numpy_samplesFunction · 0.90
inplace_to_deviceFunction · 0.90
inplace_to_torchFunction · 0.90
prepare_batchFunction · 0.90
segment_meanFunction · 0.90
write_pdb_singleFunction · 0.90
write_pdb_modelsFunction · 0.90
write_conformer_sdfFunction · 0.90
joinMethod · 0.80

Tested by

no test coverage detected