Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: add_aromatic_interactions get None DataFrame #81

Closed
EyalRozenberg1 opened this issue Nov 23, 2021 · 2 comments
Closed

bug: add_aromatic_interactions get None DataFrame #81

EyalRozenberg1 opened this issue Nov 23, 2021 · 2 comments

Comments

@EyalRozenberg1
Copy link

EyalRozenberg1 commented Nov 23, 2021

In graphein/protein/edges/distance.py, function add_aromatic_interactions. The pdb_df dataframe is None by default. The following lines should be probably added (at line 261):

    if pdb_df is None:
        pdb_df = G.graph["pdb_df"]
@a-r-j a-r-j mentioned this issue Nov 23, 2021
@a-r-j a-r-j closed this as completed in 0f2565d Nov 25, 2021
@johnnytam100
Copy link

johnnytam100 commented Feb 19, 2022

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?

@a-r-j
Copy link
Owner

a-r-j commented Feb 19, 2022

Hey @johnnytam100 this should be fixed in graphein 1.1.0 (pip install graphein==1.1.0)

Colab example

Looks like I'd made the fix & not updated the package 🙄 Sorry!

Closing this now, do let me know if it's still not working!

@a-r-j a-r-j closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants