The Deep Layer Scatter Plot is still in prototype phase but really good for seeing where the package is going in terms of lexical network graphs. We implement the Parallel Coordinates from Plotly:
Imports
from global_chem import GlobalChem
from global_chem_extensions import GlobalChemExtensions
gc = GlobalChem()
cheminformatics = GlobalChemExtensions().cheminformatics()
Here we want to visualize deep layer networks and add colour, weights of lines etc for a more sophisticated data visualization.
In the algorithm we first determine the max depth of the network object. While keep tracking of how many nodes are in each deep layer. For example, the Network Graph we have 3 layers
layer = 1
node_counts = []
for node_key, node_value in self.deep_layer_network.items():
if int(node_value['layer']) > layer:
layer = int(node_value['layer'])
for i in range(1, layer + 1):
counts = 0
for node_key, node_value in self.deep_layer_network.items():
if int(node_value['layer']) == i:
counts += 1
node_counts.append(counts)
Now we have to convert our GlobalChem Network object into a Plotly Style to get it ready for Parcats plotting.
Algorithm:
1.) Establish the First Layer as Root & Establish Second Layer Concomitantly.
2.) Determine Lexical Symmetry or Anti-Symmetry & Add Continued Layers
3.) Prepare Plotly Python Data Structure
In the third step, the dimensions refers to the a list that will house the list of dictionary objects. Each category is a layer, where it's values correspond to a combination of lexical keys. For example let's say we create a three node graph with 3 layers:
if i == 1:
first_layer = [ nodes[0]['name'] ] * reduce((lambda x, y: x * y), self.node_counts)
layer_object.append(first_layer)
values = nodes[0]['children']
for value in values:
second_layer += [ value ] * self.node_counts[1]
layer_object.append(second_layer)
for node in nodes:
if not symmetric:
layer += [ node['name'] ]
else:
layer += [ node['name'] ] * self.node_counts[i - 1]
if not symmetric:
layer = layer * self.node_counts[i - 1]
layer_object.append(layer)