# Retrieve ID ligand from PDB file

I have thousands of PDB files and I need to extract the following information from each of them: an ID or the name of the small molecule (ligand) present in the complex.

Is there a way to do that with BioPython or similar tools? Taking this PDB entry as an example, the tools should return 7FM.

• Can you please edit your question and include some examples and the output you would want from them? That way, we can test our solutions using your examples and we can be sure to give you the output you need. – terdon May 4 '19 at 16:22
• The PDB entry states that the ligand is 7FM. – wrong_path May 4 '19 at 17:35
• Anyway use the MMCIF2Dict tool to extract the information from the header via the PDB module of BioPython. If it's not in the header you can't do it because XML is not supported (not currently supported). Goodluck – M__ May 4 '19 at 17:43

I found out that the package PyPDB has the function get_ligands that does exactly what I'm looking for.