Exemplo n.º 1
0
 def from_mol(self) -> dict:
     if self.get('extension') in ('mol', 'sdf', 'mdl'):
         mol = Chem.MolFromMolBlock(self.get('block'),
                                    sanitize=True,
                                    removeHs=False,
                                    strictParsing=True)
     elif self.get('extension') in ('mol2', ):
         mol = Chem.MolFromMol2Block(self.get('block'),
                                     sanitize=True,
                                     removeHs=False)
     elif self.get('extension') in ('pdb', ):
         mol = Chem.MolFromPDBBlock(self.get('block'),
                                    sanitize=True,
                                    removeHs=False,
                                    proximityBonding=False)
     else:
         raise exc.HTTPClientError(
             f"Format {self.get('extension')} not supported")
     if self.get_bool('protons') is True:
         mol = AllChem.AddHs(mol)
     p = Params.from_mol(mol,
                         self.name,
                         generic=self.generic,
                         atomnames=self.atomnames)
     return self.to_dict(p)
Exemplo n.º 2
0
 def from_pdb(self) -> dict:
     smiles = self.get('smiles').strip()
     block = self.get('block').strip()
     if smiles != '':
         p = Params.from_smiles_w_pdbblock(pdb_block=block,
                                           smiles=smiles,
                                           generic=self.generic,
                                           name=self.name,
                                           proximityBonding=False)
         return self.to_dict(p)
     else:
         protein = Chem.MolFromPDBBlock(block,
                                        removeHs=False,
                                        proximityBonding=False)
         mol = Chem.SplitMolByPDBResidues(protein,
                                          whiteList=[self.name])[self.name]
         AllChem.SanitizeMol(mol)
         mol = AllChem.AddHs(mol)
         p = Params.from_mol(mol,
                             self.name,
                             generic=self.generic,
                             atomnames=self.atomnames)
         return self.to_dict(p)