a-r-j / graphein

Protein Graph Library
https://graphein.ai/
MIT License
1.02k stars 131 forks source link

Error occurred while constructing edges from pdb files #387

Open Runinthenight opened 5 months ago

Runinthenight commented 5 months ago

The bug information provided is as follows, what can I do to overcome it? Please help me,Thank you

  File "protein_pretrain.py", line 60, in protein_graph
    g = construct_graph(config=config, path=str(protein_path)+str(pdb_ID)+".pdb")
  File "anaconda3/envs/torch2.0/lib/python3.9/site-packages/graphein/protein/graphs.py", line 833, in construct_graph
    g = initialise_graph_with_metadata(
  File "anaconda3/envs/torch2.0/lib/python3.9/site-packages/graphein/protein/graphs.py", line 565, in initialise_graph_with_metadata
    protein_df.loc[protein_df["chain_id"] == c]["residue_name"]
  File "anaconda3/envs/torch2.0/lib/python3.9/site-packages/pandas/core/series.py", line 4771, in apply
    return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
  File "anaconda3/envs/torch2.0/lib/python3.9/site-packages/pandas/core/apply.py", line 1123, in apply
    return self.apply_standard()
  File "anaconda3/envs/torch2.0/lib/python3.9/site-packages/pandas/core/apply.py", line 1174, in apply_standard
    mapped = lib.map_infer(
  File "pandas/_libs/lib.pyx", line 2924, in pandas._libs.lib.map_infer
  File "anaconda3/envs/torch2.0/lib/python3.9/site-packages/graphein/protein/utils.py", line 379, in three_to_one_with_mods
    return RESI_THREE_TO_1[res]
KeyError: 'AYA'
a-r-j commented 5 months ago

Hi, thanks for raising this.

It looks like 'AYA' is a modified residue we've not included. You can modify RESI_THREE_TO_1 https://github.com/a-r-j/graphein/blob/a669516c22f73efac035ac9874ebb315132ea6ff/graphein/protein/resi_atoms.py#L630 to include: "AYA": "A"