def test_rmsd(idx, download, path, minimize): id = download[idx] p = path_from_id(id, path) try: ref = io.loadmol(os.path.join(p, f"{id}_ligand.sdf")) mols = io.loadallmols(os.path.join(p, f"{id}_dock.sdf")) # Load results obtained with OpenBabel results = np.loadtxt( os.path.join(p, "obrms-min.dat" if minimize else "obrms.dat")) except OSError: # Docking didn't find any configuration for some systems pytest.xfail("Problems loading PDB ID {id}.") # Some molecules in the dataset give errors when parsed with RDKit if ref is None or None in mols: pytest.xfail("Problems loading PDB ID {id}.") rmsds = rmsd.rmsdwrapper(ref, mols, minimize=minimize, strip=True) assert np.allclose(rmsds, results)
def test_loadmol_mol2(molfile, natoms: int) -> None: m = io.loadmol(os.path.join(molpath, molfile)) assert len(m) == natoms
parser.add_argument("-c", "--center", action="store_true", help="Center molecules at origin") parser.add_argument("--hydrogens", action="store_true", help="Keep hydrogen atoms") parser.add_argument("-n", "--nosymm", action="store_false", help="No graph isomorphism") args = parser.parse_args() try: ref = io.loadmol(args.reference) except OSError: print("ERROR: Reference file not found.", file=sys.stderr) exit(-1) # Load all molecules try: mols = [ mol for molfile in args.molecules for mol in io.loadallmols(molfile) ] except OSError: print("ERROR: Molecule file(s) not found.", file=sys.stderr) exit(-1) # Loop over molecules within fil