Exemplo n.º 1
0
def test_loadall() -> None:

    path = os.path.join(molecules.molpath, "1cbr_docking.sdf")

    mols = io.loadall(path)

    assert len(mols) == 10
Exemplo n.º 2
0
def test_loadall_sdf(molfile, natoms: int, nbonds: int) -> None:

    ms = io.loadall(os.path.join(molpath, molfile))

    assert len(ms) == 10

    for m in ms:
        assert io.numatoms(m) == natoms
        assert io.numbonds(m) == nbonds
Exemplo n.º 3
0
def test_loadall_mol2(molfile, natoms: int, nbonds: int) -> None:

    try:
        ms = io.loadall(os.path.join(molpath, molfile))

        assert len(ms) == 10

        for m in ms:
            assert io.numatoms(m) == natoms
            assert io.numbonds(m) == nbonds
    except NotImplementedError:  # Mol2MolSupplier in RDkit is not supported
        pass  # TODO: Warning
Exemplo n.º 4
0
def test_loadall_pdb_single_model() -> None:
    """
    Test load_all function for PDB files when only a single model is present.
    """

    try:
        ms = io.loadall(os.path.join(molpath, "1a99_ligand.pdb"))

        assert len(ms) == 1

        assert io.numatoms(ms[0]) == 20
        assert io.numbonds(ms[0]) == 19

    except NotImplementedError:  # PDBMolSupplier in RDkit is not supported
        pass  # TODO: Warning
Exemplo n.º 5
0
def molecules(request):
    system = request.param

    fref = os.path.join(molpath, system, f"{system}_ligand.sdf")
    fmols = os.path.join(molpath, system, f"{system}_dock.sdf")

    ref = io.load(os.path.join(molpath, fref))
    mols = io.loadall(os.path.join(molpath, fmols))

    ref = io.to_molecule(ref)
    mols = [io.to_molecule(mol) for mol in mols]

    ref.strip()
    for mol in mols:
        mol.strip()

    return ref, mols, system
Exemplo n.º 6
0
def loadall(fname: str) -> Tuple[List[Any], List[molecule.Molecule]]:
    """
    Load all molecule from file.

    Parameters
    ----------
    fname: str
        Input file name

    Returns
    -------
    Tuple[List[Any], List[molecule.Molecule]]
        Loaded molecule as `pybel.Molecule` or `rdkit.Chem.rdchem.Mol` and
        `pyrmsd.molecule.Molecule`
    """

    fname = os.path.join(molpath, fname)

    ms = io.loadall(fname)

    mols = [io.to_molecule(m, adjacency=True) for m in ms]

    return ms, mols