haddocking / pdb-tools

A dependency-free cross-platform swiss army knife for PDB files.
https://haddocking.github.io/pdb-tools/
Apache License 2.0
385 stars 113 forks source link

Ligand selection command #19

Closed cgott98 closed 5 years ago

cgott98 commented 5 years ago

I am currently attempting to implement pdb-tools into protocol at my institution so that there is less need for text editors. The issue I am having is that there is currently no way to extract a ligand from a PDB file without knowing the residue number. A possible solution to this would be a pdb_sellig command that extracted all hetatm lines associated with the ligand. As of now, the only interaction one can have with Hetatm is to delete them all. Another possible solution would be to give the option of a selhetatm. The selhetatm tool could be used in combination with the delelem to give me my ligand and delete the extraneous water molecules.

mtrellet commented 5 years ago

Did you try pdb_selresname.py? It does take the residue name (and in your case, the ligand name) to filter the rest of the PDB file records out (ATOM, HETATM, ANISOU and TER). Selection will be applied to both ATOM and HETATM records. It seems to me that's what you're looking for but I might have misunderstood your issue.

amjjbonvin commented 5 years ago

Wouldn't a simple grep command give you all HETATM? And if you want to know what are the unique HETATM residue names:

grep HETATM filename.pdb |sed -e 's/ATM/\ /g' |awk '{print $4}' |sort |uniq

And then you can use the pdb_selresname.py command to extract the ligand you want

mtrellet commented 5 years ago

@amjjbonvin Very true but you loose header information, might be ok in most of the cases though!

amjjbonvin commented 5 years ago

Well - once you get the ligand names you can use a proper pdb-tools command to extract the ligand and all the header info as you suggested.

mtrellet commented 5 years ago

Ok my bad, I was assuming the name of the ligand was known, it is not obvious from the question indeed. Then using a grep command could do the trick!

JoaoRodrigues commented 5 years ago

Hi there,

First of all, thanks for using the tools and taking the time to logging on GitHub and making an issue with the suggestion. We could indeed add a pdb_selhetatm to select HETATM, but selecting ligands from HETATM records is a very complex business. My suggestion is to use either pdb_selresname, as @mtrellet suggested and if you know the ligand name. If you don't know the ligand name, you can use a one-liner like @amjjbonvin wrote.

OTOH, I've been thinking of adding a tool to display unique chains and residue names in a PDB file, somewhat related to the question raised in #12 .

JoaoRodrigues commented 5 years ago

Hi @cgott98 ,

We added pdb_selhetatm to the toolkit, thanks for the suggestion. Using this with pdb_selresname should get you closer to picking ligands. Let us know if it works, you can update the tools directly pip install --upgrade git+https://github.com/haddocking/pdb-tools.git@master