This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problems separating and converting molecule files with openbabel

I'm trying to convert a single SDF file containing a chemical library of 1000+ compounds into individual PBDQT files to use with AutoDock Vina. I have previously used openbabel to convert individually downloaded SDF's into PDBQT's, and this has worked just fine until now (see first image below).

When trying to separate multicompound SDF's using openbabel, I can obtain inidividual SDF's and PDB's just fine. But when I try to convert to PDBQT, the structure is ruined (see second image below).

The expected output from openbabel convert to pdbqt

The actual output from openbabel convert to pdbqt

I can successfully convert to PDB with correct structure, so I tried to use Reduce to make sure all hydrogens are added to each compound (I thought I read that openbabel might try to recalculate bonds if each atom has an incorrect number). However, when I converted the corrected PDB to PDBQT, the result was the same ruined structure.

Has anyone come across anything like this before? Is there anything I might be missing that could be causing this?

openbabel

Is your problem solved? if not, what is your command?

1 answer

A few things can cause this, and they are easy to mix together because SDF, PDB, and PDBQT carry different chemistry information.

First, do not use PDB as an intermediate if you can avoid it. PDB does not preserve normal small-molecule bond order/connectivity well. If you split the library to SDF correctly, use those split SDF files as the source for ligand preparation, not SDF -> PDB -> Reduce -> PDBQT.

A simple split-and-convert pattern is:

mkdir -p sdf pdbqt logs
obabel library.sdf -O sdf/ligand_.sdf -m

for f in sdf/*.sdf; do
  base=$(basename "$f" .sdf)
  obabel "$f" -O "pdbqt/${base}.pdbqt" -h --gen3d 2> "logs/${base}.log"
done

Before docking, check a few output files manually:

grep -E "^(ROOT|BRANCH|ATOM|HETATM|TORSDOF)" pdbqt/ligand_1.pdbqt | head -40

Also be careful about what you mean by "the structure is ruined". Many viewers infer bonds poorly from PDBQT, because PDBQT is a docking input format with AutoDock atom types, charges, and rotatable-bond records. It is not a great format for preserving or displaying small-molecule chemistry. If the coordinates are correct but the drawn bonds look wrong, that may be a visualization/connectivity problem rather than a Vina input-coordinate problem.

I would debug one molecule like this:

  1. Open the split SDF and confirm the molecule is correct there.
  2. Convert only that one SDF to PDBQT.
  3. Check whether atom coordinates are plausible in the PDBQT.
  4. If the visualized bonds look wrong, convert the same SDF to MOL2/SDF for inspection and use PDBQT only for docking.
  5. If atom coordinates are actually wrong, regenerate 3D coordinates/protonation from the original SDF and check the Open Babel log.

For Vina specifically, the important part is that the final ligand PDBQT has valid coordinates, hydrogens/protonation appropriate for your system, sensible Gasteiger charges/AutoDock atom types, and rotatable bonds. The original SDF/MOL2 is usually the better source of truth for chemical structure.

If Open Babel keeps producing questionable PDBQT files, it is worth trying Meeko for ligand preparation from SDF instead of forcing the PDB route:

mk_prepare_ligand.py -i ligand.sdf -o ligand.pdbqt

I work on ProteinIQ's AutoDock Vina tool, where this sort of ligand-file handling is one of the common failure points. But the key point here is independent of the platform: keep SDF/MOL2 as the chemistry-preserving input, treat PDBQT as a docking-specific file, and verify whether the problem is bad coordinates or just bad inferred bonds in the viewer.

Log in to answer this question.