Core objects and utilities¶
The working Network.nodes and Network.edges DataFrames are authoritative.
Node and Edge are value-object views that are synchronized explicitly by
network operations.
Node¶
Node ¶
Edge¶
Edge ¶
Edge(source: str, target: str, interaction_type: str = 'undefined', evidence: str = None, database: str = None, metadata: dict = None)
Represents an edge (interaction) in the biological network. Stores source, target, interaction type, evidence, database of origin, and metadata.
Source code in neko/core/edge.py
Public graph utilities¶
is_connected ¶
This function checks if a network is connected. It takes a Network object as input and returns True if the network is connected, otherwise it returns False.
Args: - network: A Network object representing the network to be checked.
Returns: - bool
Source code in neko/core/tools.py
check_sign ¶
This function checks the sign of an interaction in the Omnipath format (Pandas DataFrame or Series). The attribute "consensus" checks for the consistency of the sign of the interaction among the references.
Args: - interaction: A pandas DataFrame or Series representing the interaction. - consensus: A boolean indicating whether to check for consensus among references.
Returns: - A string indicating the sign of the interaction: "stimulation", "inhibition", "form complex", or "undefined".
Source code in neko/core/tools.py
check_gene_list_format ¶
This function checks the format of the gene list and returns True if the gene list is in Uniprot format, False if the gene list is in genesymbol format.
Args: - gene_list: A list of gene identifiers. The gene identifiers can be either Uniprot identifiers or genesymbols.
Returns: - A boolean indicating whether the gene list is in Uniprot format (True) or genesymbol format (False).
Source code in neko/core/tools.py
mapping_node_identifier ¶
This function takes a node identifier and returns a list containing the possible identifiers for the node. The identifiers include a complex string, a genesymbol, and a uniprot identifier. The function uses the to_uniprot and to_genesymbol functions from the neko.inputs.identifier_mapping module to translate the node identifier into these different formats.
Args: - node: A string representing the node identifier. The node identifier can be a genesymbol, a uniprot identifier, or a complex string.
Returns: - A list containing the complex string, genesymbol, and uniprot identifier for the node. If the node identifier cannot be translated into one of these formats, the corresponding value in the list is None.
Source code in neko/core/tools.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
translate_paths ¶
This function translates a list of paths, where each path is a sequence of node identifiers.
It uses the helper function handle_complex_identifier to translate each node identifier in the paths.
Args: - paths: A list of paths, where each path is a sequence of node identifiers. A node identifier can be a string or a list of strings.
Returns: - A list of translated paths, where each path is a sequence of translated node identifiers.
Source code in neko/core/tools.py
consolidate_edges ¶
Merge parallel working edges without discarding conflicting signs.
Regulatory evidence is consolidated per source-target pair. Observing both
stimulation and inhibition produces one bimodal edge, regardless of
evidence counts. Complex formation and non-regulatory effects remain
separate because they cannot be represented by a regulatory sign.