Example #1
0
                rep = '{}: {}'.format(name, len(self.reps.replist))
            else:
                rep = '{}: {}'.format(name, field)
            return rep

        rep = 'SmallMol with {} atoms and {} conformers'.format(self.numAtoms, self.numFrames)
        for p in sorted(self._atom_fields):
            if p.startswith('_'):
                continue
            rep += '\n'
            rep += 'Atom field - {}'.format(p)
        for j in sorted(self.__dict__.keys() - list(SmallMol._atom_fields)):
            if j[0] == '_':
                continue
            rep += '\n'
            rep += formatstr(j, self.__dict__[j])

        return rep

if __name__ == '__main__':

    import doctest
    import os
    from moleculekit.home import home
    from moleculekit.smallmol.smallmollib import SmallMolLib

    lib = SmallMolLib(os.path.join(home(dataDir='test-smallmol'), 'fda_drugs_light.sdf'))
    sm = SmallMol(os.path.join(home(dataDir='test-smallmol'), 'benzamidine.mol2'))
    doctest.testmod(extraglobs={'lib': lib.copy(), 'sm': sm.copy()})

Example #2
0
                rep = f"{name}: {len(self.reps.replist)}"
            else:
                rep = f"{name}: {field}"
            return rep

        rep = f"SmallMol with {self.numAtoms} atoms and {self.numFrames} conformers"
        for p in sorted(self._atom_fields):
            if p.startswith("_"):
                continue
            rep += "\n"
            rep += f"Atom field - {p}"
        for j in sorted(self.__dict__.keys() - list(SmallMol._atom_fields)):
            if j[0] == "_":
                continue
            rep += "\n"
            rep += formatstr(j, self.__dict__[j])

        return rep


if __name__ == "__main__":
    import doctest
    from moleculekit.home import home
    from moleculekit.smallmol.smallmollib import SmallMolLib

    lib = SmallMolLib(
        os.path.join(home(dataDir="test-smallmol"), "fda_drugs_light.sdf"))
    sm = SmallMol(
        os.path.join(home(dataDir="test-smallmol"), "benzamidine.mol2"))
    doctest.testmod(extraglobs={"lib": lib.copy(), "sm": sm.copy()})