Пример #1
0
    def test_parity_method(id_1, id_2, score):
        c1 = ccd_reader.read_pdb_cif_file(cif_filename(id_1)).component
        c2 = ccd_reader.read_pdb_cif_file(cif_filename(id_2)).component

        parity = compare_molecules(c1.mol, c2.mol)

        assert round(parity.similarity_score, 2) == score
Пример #2
0
    def test_scaffold_absent(ccd_id):
        component = ccd_reader.read_pdb_cif_file(
            cif_filename(ccd_id)).component
        result = component.get_scaffolds()

        assert result[0].GetNumAtoms() == 0
        assert not component.scaffolds
Пример #3
0
def component(request):
    reader = ccd_reader.read_pdb_cif_file(request.param)
    c = reader.component

    if c.id not in problematic_ids:
        assert reader.warnings == []

    return c
Пример #4
0
    def test_unichem_download(het_code):
        c = ccd_reader.read_pdb_cif_file(cif_filename(het_code)).component

        c.fetch_external_mappings()
        assert len(c.external_mappings) > 0

        c.fetch_external_mappings(True)
        assert len(c.external_mappings) > 0
Пример #5
0
    def test_scaffold_present(ccd_id, smiles):
        component = ccd_reader.read_pdb_cif_file(
            cif_filename(ccd_id)).component
        result = component.get_scaffolds()

        mol = result[0]

        assert Chem.MolToSmiles(mol) == smiles
        assert component.scaffolds
        assert component.scaffolds[0].smiles == smiles
Пример #6
0
    def test_components_layouts_downloaded(tmpdir, het_code):
        dl = PubChemDownloader(tmpdir)

        to_download = os.path.join(tmpdir, f'{het_code}.sdf')
        comp = ccd_reader.read_pdb_cif_file(cif_filename(het_code)).component
        dl.process_template(comp)

        assert os.path.isfile(to_download)
        assert os.path.getsize(to_download) > 0
        assert comp.mol_no_h.HasSubstructMatch(
            Chem.MolFromMolFile(to_download, sanitize=True))
Пример #7
0
    def update_ccd_dir(self, components: str):
        """Update 2D images of PDBeChem components which are available
        in the pubchem database

        Args:
            components (str): Path to the directory with components in
                .cif format
        """

        for f in os.listdir(components):
            c = ccd_reader.read_pdb_cif_file(os.path.join(components, f)).component
            self.process_template(c)
Пример #8
0
    def test_valid_properties(key):
        physchem_props = ccd_reader.read_pdb_cif_file(
            cif_filename(key)).component.physchem_properties

        assert test_inputs[key]["logp"] == round(
            physchem_props["CrippenClogP"], 3)
        assert test_inputs[key]["heavy_atom_count"] == physchem_props[
            "NumHeavyAtoms"]
        assert test_inputs[key]["numH_acceptors"] == physchem_props["NumHBA"]
        assert test_inputs[key]["numH_donors"] == physchem_props["NumHBD"]
        assert (test_inputs[key]["num_rotable_bonds"] ==
                physchem_props["NumRotatableBonds"])
        assert test_inputs[key]["rings_count"] == physchem_props["NumRings"]
        assert test_inputs[key]["TPSA"] == round(physchem_props["tpsa"], 3)
        assert test_inputs[key]["molwt"] == round(physchem_props["exactmw"], 3)
Пример #9
0
    def component_eoh():
        """
        loads PDB-CCD for ethanol eoh.cif and returns the
        component object

        Returns:
            pdbeccdutils.core.component.Component: component object for
            eoh.cif
        """
        cif_file = cif_filename('EOH')
        reader = ccd_reader.read_pdb_cif_file(cif_file)
        assert reader.warnings == []
        assert reader.errors == []
        component = reader.component
        return component
Пример #10
0
    def test_invalid_properties(key):
        physchem_props = ccd_reader.read_pdb_cif_file(
            cif_filename(key)).component.physchem_properties

        assert physchem_props == {}
Пример #11
0
def load_molecule(id_):
    c = ccd_reader.read_pdb_cif_file(cif_filename(id_)).component
    c.compute_2d(depictions)

    return c
Пример #12
0
    def test_scaffolds(scaffold_type):
        c = ccd_reader.read_pdb_cif_file(cif_filename("NAG")).component
        c.get_scaffolds(scaffold_type)

        assert len(c.scaffolds) > 0