Closed avivko closed 2 years ago
Hey @avivko I'll check this out ASAP. Do you have a PDB code for the example?
No hurry @a-r-j :)
I used the PDB ID "6REW". This is a more detailed rundown of how I got the error:
from graphein.protein.subgraphs import extract_subgraph_from_chains
from graphein.protein.config import ProteinGraphConfig, DSSPConfig
from graphein.protein.features.nodes.amino_acid import expasy_protein_scale, meiler_embedding
from graphein.protein.features.nodes import asa, rsa
conf_functions = {"edge_construction_functions": [add_peptide_bonds,
add_aromatic_interactions,
add_hydrogen_bond_interactions,
add_disulfide_interactions,
add_ionic_interactions,
add_aromatic_sulphur_interactions,
add_cation_pi_interactions],
"graph_metadata_functions": [asa, rsa], # Add ASA and RSA features.
"node_metadata_functions": [meiler_embedding,partial(expasy_protein_scale, add_separate=True)], # Add expasy features (partial: each feature is added under a separate key)
"dssp_config":DSSPConfig(), # Add DSSP config in order to compute ASA and RSA.
"pdb_dir": '/vol/tmp/kormanav/pdb_dir'
}
config = ProteinGraphConfig(**conf_functions)
g = construct_graph(config=config, pdb_code="6rew")
g_a = extract_subgraph_from_chains(g, ["A"])
from graphein.protein.visualisation import asteroid_plot
asteroid_plot(g_a, node_id="A:LYS:255", k=3, colour_nodes_by="shell",colour_edges_by="kind", show_edges=True)
Ah, I dug into this.
The problem is that plotly doesn't support multiple colours for a single line trace. I've worked around this before here by making a new trace for each line segment. If you wanted to have a go at making the change I'd be super happy to support.
Alternatively, you can do what the function is doing under the hood and use the k-hop subgraph function and plot that with the normal plotting function
Describe the bug Using show_edges=True as an argument raises an error because of the formatting of the colo(u)rs for the scatter plot.
To Reproduce For example:
Expected behavior Having edges in the plot would be nice :)
Desktop (please complete the following information):