AlloViz.Protein.analyze¶
- Protein.analyze(pkgs='all', filterings='all', elements='edges', metrics='all', cores=1, nodes_dict={'btw': {'arguments': {'seed': 0, 'weight': 'graph_distance'}, 'function': 'networkx.algorithms.centrality.betweenness_centrality'}, 'cfb': {'arguments': {'weight': 'graph_weight'}, 'function': 'networkx.algorithms.centrality.current_flow_betweenness_centrality'}}, edges_dict={'btw': {'arguments': {'seed': 0, 'weight': 'graph_distance'}, 'function': 'networkx.algorithms.centrality.edge_betweenness_centrality'}, 'cfb': {'arguments': {'weight': 'graph_weight'}, 'function': 'networkx.algorithms.centrality.edge_current_flow_betweenness_centrality'}})[source]¶
Analyzed filtered network
Analyze the selected (un)filtered networks with the passed elements-metrics. It calls
AlloViz.AlloViz.Analysis.analyze()
and results are stored in instances of classes from theAlloViz.AlloViz.Elements
module, which extend thepandas.DataFrame
class. The graphs stored in the filtered object ‘graphs’ attribute are used for analysis, which contain “graph_weight” and “graph_distance” as edge attributes.- Parameters:
- pkgsstr or list, default: “all”
Package(s)/Network construction method(s) for which to analyze their raw edge weights, which must be already calculated and their data saved as instance attribute. In this case, “all” sends the computation for all available methods that are already calculated and saved as instance attributes.
- filteringsstr or list, default: “all”
Filtering scheme(s) for which to perform the analyses, which must exist already for the selected packages. “all” sends the computation for all available schemes that are already saved.
- elementsstr or list, {“edges”, “nodes”}
Network elements for which to perform the analysis.
- metricsstr or list, default: “all”
Network metrics to compute, which must be keys in the nodes_dict or edges_dict dictionaries. Default is “all” and it sends the computation for all the metrics defined in the corresponding dictionary of the selected elements in element.
- coresint, default: 1
Number of cores to use for parallelization with a multiprocess Pool. Default value only uses 1 core with a custom
AlloViz.utils.dummypool
that performs computations synchronously.
- Other Parameters:
- nodes_dict, edges_dictdict
Optional kwarg(s) of the dictionary(ies) that maps network metrics custom names (e.g., betweenness centrality, “btw”) with their corresponding NetworkX function and arguments, with the format: ```
- {
- “btw”: {
“function”: “networkx.algorithms.centrality.betweenness_centrality”, “arguments”: {“weight”: “graph_distance”, “seed”: 0}
}
}
``` Functions strings must be written as if they were absolute imports, and must return a dictionary of edges or nodes, depending on the element dictionary in which they are. The keys of the dictionaries will be used to name the columns of the analyzed data that the functions produce. Defaults are
nodes_dict
andedges_dict
.
See also
AlloViz.AlloViz.Analysis
Module with analysis functions.
AlloViz.Protein.calculate
Class method to calculate the network(s) raw edge weights with different network construction methods.
AlloViz.Protein.filter
Class method to filter the network(s) raw edge weights with different criteria.
AlloViz.Protein.view
Class method to visualize the network on the protein structure.
Examples
>>> opioidGPCR = AlloViz.Protein(GPCR=169) >>> opioidGPCR.calculate(["getcontacts", "dynetan"], cores=6, taskcpus=2) >>> opioidGPCR.filter("dynetan", "GetContacts_edges") >>> opioidGPCR.analyze("dynetan", "GetContacts_edges", "nodes", "btw") <AlloViz.AlloViz.Elements.Nodes at 0x7f892c3c0fa0>