a-r-j / graphein

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

Still unable to use `add_aromatic_interactions` #106

Closed johnnytam100 closed 2 years ago

johnnytam100 commented 2 years ago

Hi, I'm sorry for reporting several situations at the same time. I met the same problem using the add_aromatic_interactions

from graphein.protein.edges.distance import (add_peptide_bonds,
                                             add_hydrogen_bond_interactions,
                                             add_disulfide_interactions,
                                             add_ionic_interactions,
                                             add_aromatic_interactions,
                                             add_aromatic_sulphur_interactions,
                                             add_cation_pi_interactions
                                            )

new_edge_funcs = {"edge_construction_functions": [add_peptide_bonds,
                                                  add_hydrogen_bond_interactions,
                                                  add_disulfide_interactions,
                                                  add_ionic_interactions,
                                                  add_aromatic_interactions,
                                                  add_aromatic_sulphur_interactions,
                                                  add_cation_pi_interactions
                                                  ]
                 }

config = ProteinGraphConfig(**new_edge_funcs)
g = construct_graph(config=config, pdb_code="3ED8")
p = plot_protein_structure_graph(G=g, angle=0, colour_edges_by="kind", colour_nodes_by="seq_position", label_node_ids=False)
plt.suptitle("Protein graph with: peptide backbone, H-Bonds, \n Disulphide, ionic, aromatic, aromatic-sulphur and cation-pi interactions. \n  Nodes coloured by sequence position, edges by type")

returned

DEBUG:graphein.protein.graphs:Deprotonating protein. This removes H atoms from the pdb_df dataframe
DEBUG:graphein.protein.graphs:Detected 1134 total nodes
INFO:graphein.protein.edges.distance:Found 372 hbond interactions.
INFO:graphein.protein.edges.distance:Found 25 hbond interactions.
INFO:graphein.protein.edges.distance:Found 10 disulfide interactions.
INFO:graphein.protein.edges.distance:Found 983 ionic interactions.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-8-183722266f5a>](https://localhost:8080/#) in <module>()
     19 
     20 config = ProteinGraphConfig(**new_edge_funcs)
---> 21 g = construct_graph(config=config, pdb_code="3ED8")
     22 p = plot_protein_structure_graph(G=g, angle=0, colour_edges_by="kind", colour_nodes_by="seq_position", label_node_ids=False)
     23 plt.suptitle("Protein graph with: peptide backbone, H-Bonds, \n Disulphide, ionic, aromatic, aromatic-sulphur and cation-pi interactions. \n  Nodes coloured by sequence position, edges by type")

4 frames
[/usr/local/lib/python3.7/dist-packages/graphein/protein/utils.py](https://localhost:8080/#) in filter_dataframe(dataframe, by_column, list_of_values, boolean)
     81     :rtype: pd.DataFrame
     82     """
---> 83     df = dataframe.copy()
     84     df = df[df[by_column].isin(list_of_values) == boolean]
     85     df.reset_index(inplace=True, drop=True)

AttributeError: 'NoneType' object has no attribute 'copy'

And I checked my pandas version:

import pandas as pd
print(pd.__version__)
1.3.5

May I know is it the problem with pandas version?

Originally posted by @johnnytam100 in https://github.com/a-r-j/graphein/issues/81#issuecomment-1045985671

a-r-j commented 2 years ago

Hi @johnnytam100 I’m going to check this out. I’ll close this and reopen the previous issue. Thanks for bringing it to my attention!