Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pdberellig/conf/conf.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
reactants_threshold=0.7
similarities_threshold=0.6
minimal_ligand_size=5
api_base_url=https://wwwdev.ebi.ac.uk/pdbe/aggregated-api
api_base_url=https://www.ebi.ac.uk/pdbe/aggregated-api

[cofactor]
template_path=cofactors/templates
Expand All @@ -11,4 +11,4 @@ details=cofactors/cofactors_details.json
ec=cofactors/cofactor_ec.csv

[reactant]
chebi_structure_file=https://ftp.ebi.ac.uk/pub/databases/chebi/Flat_file_tab_delimited/structures.csv.gz
chebi_structure_file=https://ftp.ebi.ac.uk/pub/databases/chebi/flat_files/structures.tsv.gz
18 changes: 10 additions & 8 deletions pdberellig/core/reactants.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,25 +162,27 @@ def parse_chebi(self, chebi_ids: list[str]) -> list[CompareObj]:

self.chebi = pd.read_csv(chebi_structure_file, dtype=str)
self.chebi = self.chebi.loc[
(self.chebi["COMPOUND_ID"].isin(chebi_ids))
& (self.chebi["TYPE"] == "mol")
& (self.chebi["DEFAULT_STRUCTURE"] == "Y"),
["COMPOUND_ID", "STRUCTURE"],
(self.chebi["compound_id"].isin(chebi_ids))
& (self.chebi["status_id"] == 1) # include only ChEBI curated entires
& (
self.chebi["default_structure"] == "TRUE"
), # include only with structure
["compound_id", "molfile"],
]
for _, row in self.chebi.iterrows():
try:
chebi_mol = Chem.MolFromMolBlock(row["STRUCTURE"])
chebi_mol = Chem.MolFromMolBlock(row["molfile"])
chebi_mol_no_h = Chem.RemoveHs(chebi_mol)
if len(chebi_mol_no_h.GetAtoms()) < self.args.minimal_ligand_size:
# chebi is too small.
self.log.debug(f"""Number of atoms in {row["COMPOUND_ID"]} is less
self.log.debug(f"""Number of atoms in {row["compound_id"]} is less
than {self.args.minimal_ligand_size},
hence skipping""")
else:
templates.append(CompareObj(row["COMPOUND_ID"], chebi_mol_no_h))
templates.append(CompareObj(row["compound_id"], chebi_mol_no_h))

except Exception:
self.log.warn(f"Couldn't parse {row['COMPOUND_ID']} using RDKit")
self.log.warn(f"Couldn't parse {row['compound_id']} using RDKit")

return templates

Expand Down
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pdberellig"
version = "1.0.1"
version = "1.0.2"
description = "A toolkit for functional annotation of ligands in the PDB"
authors = ["Ibrahim Roshan Kunnakkattu <roshan@ebi.ac.uk>"]
readme = "README.md"
Expand All @@ -19,11 +19,11 @@ classifiers = [


[tool.poetry.dependencies]
python = "^3.10"
python = ">=3.10,<4"
click = "8.1.7"
pdbeccdutils = "^0.8.6"
pdbeccdutils = ">=1.0.0"
sparqlwrapper = "^2.0.0"
pandas = "^2.2.3"
pandas = ">=2.2.3"



Expand Down