def dump4molviewer(filename='kripo-phar-molviewer.json'): """Dumps each pharmacophore/residue pairs to a json file which can be viewed with the 3d-e-chem molviewer ```python from tests.pharmacohore.test_from_site import dump4molviewer dump4molviewer() ``` """ rows = [] ligand_expo = LigandExpoDb('tests/fixtures/ligand-expo.db').as_dict() ligand = ligands(pdb_from_file('tests/fixtures/3HEG.prepped.pdb'), ligand_expo)[0] for residue in residues: block = residue.values[0] features = residue.values[1] site = prep_site(block, ligand.atomium_mol) label = site.residue().name() + str(len(list(site.residue().atoms()))) row = { 'id': label, 'label': label, 'protein': { 'data': site.ligand().model().to_file_string('pdb'), 'format': 'pdb', }, 'pharmacophore': { 'data': as_phar(label, feat2points(features)), 'format': 'phar', }, } rows.append(row) with open(filename, 'w') as f: json.dump(rows, f)
def dump_artificial_pdb_with_all_residues(all_res_site_pdb='all_res_site.pdb'): """ ```python from tests.pharmacohore.test_from_site import dump_artificial_pdb_with_all_residues dump_artificial_pdb_with_all_residues('all_res_site_pdb') ``` """ ligand = ligands(pdb_from_file('tests/fixtures/3HEG.prepped.pdb'))[0] block = "" for residue in residues: block += residue.values[0] site = prep_site(block, ligand.atomium_mol) block_with_ligand = site.ligand().model().to_file_string('pdb') with open(all_res_site_pdb, 'w') as f: f.write(block_with_ligand)
def yasara_fragment2_3heg_bax(ligand_expo_dict_fixture): filename = 'tests/fixtures/3HEG.frag2.pdb' pdb = pdb_from_file(filename) ligand = ligands(pdb, ligand_expo_dict_fixture)[0] frags = ligand.fragments() return frags[0]
def test_protonate_pdb_2muv(): unprotonated = pdb_from_file('tests/fixtures/2MUV.pdb', hydrogenate=False, clean=False) protonated = protonate_pdb(unprotonated) assert len(protonated.model().atoms(element='H')) == 982
def prep_pdb(opath, npath): """Speed up tests by using already hydrogenated and cleaned pdbs""" pdb = pdb_from_file(opath) pdb.save(npath)
def pdb_2muv(): # NMR and multi model filename = 'tests/fixtures/2MUV.prepped.pdb' return pdb_from_file(filename, hydrogenate=False, clean=False)
def pdb_3rze(): # multiple ligands filename = 'tests/fixtures/3RZE.prepped.pdb' return pdb_from_file(filename, hydrogenate=False, clean=False)
def pdb_5is0(): # electron microscopy filename = 'tests/fixtures/5IS0.prepped.pdb' return pdb_from_file(filename, hydrogenate=False, clean=False)
def pdb_3heg(): filename = 'tests/fixtures/3HEG.prepped.pdb' return pdb_from_file(filename, hydrogenate=False, clean=False)