示例#1
0
    def test_from_file(self, filepath, compute2d):
        """
        Test if input produces an RDKit molecule.
        """

        rmol = Rdkit.from_file(filepath, compute2d)
        self._rdkit_format_tests(rmol)
示例#2
0
    def to_rdkit(self,
                 structure_klifs_id_or_filepath,
                 entity="complex",
                 extension="mol2",
                 compute2d=True):  # pylint: disable=W0221

        filepath = self._to_filepath(structure_klifs_id_or_filepath, entity,
                                     extension)
        rdkit_mol = Rdkit.from_file(filepath, compute2d)
        return rdkit_mol
示例#3
0
    def test_from_mol2_file(self, mol2_file):
        """
        Test loading mol2 files as RDKit molecule.

        Parameters
        ----------
        mol2_file : pathlib.Path or str
            Path to mol2 file.
        """

        rmol = Rdkit._from_mol2_file(mol2_file)
        self._rdkit_format_tests(rmol)
示例#4
0
    def test_from_text(self, filepath, format, compute2d):
        """
        Test if input produces an RDKit molecule.
        Note: Use file as test function input; file content will be read as string,
        which is the input for the class method to be tested here!
        """

        # Let's load a file's content as string (text) to simulate example input data
        with open(filepath, "r") as f:
            text = f.read()

        rmol = Rdkit.from_text(text, format, compute2d)
        self._rdkit_format_tests(rmol)
示例#5
0
    def test_from_mol2_text(self, mol2_file):
        """
        Test loading mol2 file contents (text) as RDKit molecule.

        Parameters
        ----------
        mol2_file : pathlib.Path or str
            Path to mol2 file.
        """

        # Let's load a file's content as string (text) to simulate example input data
        with open(mol2_file, "r") as f:
            mol2_text = f.read()

        rmol = Rdkit._from_mol2_text(mol2_text)
        self._rdkit_format_tests(rmol)
示例#6
0
    def to_rdkit(self, structure_klifs_id, entity="complex", extension="mol2", compute2d=True):

        text = self.to_text(structure_klifs_id, entity, extension)
        rdkit_mol = Rdkit.from_text(text, extension, compute2d)
        return rdkit_mol