Network
Network
A class for building and analyzing a directed graph network of biological pathways.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_data |
DataFrame
|
A DataFrame containing the input data for the pathways. |
required |
pathways |
DataFrame
|
A DataFrame containing information on the pathways. |
required |
mapping |
DataFrame or None
|
A DataFrame containing mapping information.
If None, then a DataFrame will be constructed from the |
None
|
input_data_column |
str
|
The name of the column in |
'Protein'
|
subset_pathways |
bool
|
Whether to subset the pathways DataFrame to include only those pathways that are relevant to the input data. Default is True. |
True
|
Attributes:
Name | Type | Description |
---|---|---|
mapping |
DataFrame
|
A DataFrame containing the mapping information. |
pathways |
DataFrame
|
A DataFrame containing information on the pathways. |
input_data |
DataFrame
|
A DataFrame containing the input data for the pathways. |
inputs |
list
|
A list of the unique inputs in the mapping DataFrame. |
netx |
DiGraph
|
A directed graph network of the pathways. |
Source code in binn/network.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
build_network()
Constructs a networkx DiGraph from the edges in the 'pathways' attribute of the object, with a root node added to the graph to connect all root nodes together.
Returns:
Type | Description |
---|---|
A networkx DiGraph object representing the constructed network. |
Source code in binn/network.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
get_connectivity_matrices(n_levels, direction='root_to_leaf')
Returns a list of connectivity matrices for each layer of the completed network, ordered from leaf nodes to root node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_levels |
The number of levels below the root node to complete the network to. |
required | |
direction |
The direction of the layers to return. Must be either "root_to_leaf" or "leaf_to_root". Defaults to "root_to_leaf". |
'root_to_leaf'
|
Returns:
Type | Description |
---|---|
list
|
A list of pandas DataFrames representing the connectivity matrices for each layer of the completed network. |
Source code in binn/network.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
get_layers(n_levels, direction='root_to_leaf')
Returns a list of dictionaries where each dictionary contains the pathways at a certain level of the completed network and their inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_levels |
The number of levels below the root node to complete the network to. |
required | |
direction |
The direction of the layers to return. Must be either "root_to_leaf" or "leaf_to_root". Defaults to "root_to_leaf". |
'root_to_leaf'
|
Returns:
Type | Description |
---|---|
list
|
A list of dictionaries, where each dictionary contains pathway names as keys and input lists as values. |
Source code in binn/network.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|