Reference
Initialization, random walk function and output
These are the main multixrank methods.
Main class to run the random walk with restart in universal multiplex networks
- multixrank.Multixrank.__init__(self, config: str, wdir: str, pr=None)
Constructs an object for the random walk with restart.
- Parameters:
config (str) – Path to the configuration file in YML format. Paths will be used relative to the wdir path variable below
wdir (str) – Path to the working directory that will be as starting point to the paths in the config file.
- multixrank.Multixrank.random_walk_rank(self) DataFrame
Function that carries ous the full random walk with restart from a list of seeds.
- Returns :
rwr_ranking_df (pandas.DataFrame) : A pandas Dataframe with columns: multiplex, node, layer, score
- multixrank.Multixrank.to_sif(self, random_walk_rank: DataFrame, path: str, top: int | None = None, top_type: str = 'layered', aggregation: str = 'gmean')
Writes the ‘random walk results’ to a subnetwork with the ‘top’ nodes as a SIF format (See Cytoscape documentation)
- Parameters:
rwr_ranking_df (pandas.DataFrame) – A pandas Dataframe with columns: multiplex, node, layer, score, which is the output of the random_walk_rank function
path (str) – Path to the TSV file with the random walk results
top (int) – Top nodes based on the random walk score to be included in the TSV file
top_type (str) – “per layer” (top nodes for each layer) or “all” (top nodes any layer)
aggregation (str) – One of “none”, “geometric mean” or “sum”
- multixrank.Multixrank.write_ranking(self, random_walk_rank: DataFrame, path: str, top: int | None = None, aggregation: str = 'gmean', degree: bool = False)
Writes the ‘random walk results’ to a subnetwork with the ‘top’ nodes as a SIF format (See Cytoscape documentation)
- Parameters:
rwr_ranking_df (pandas.DataFrame) – A pandas Dataframe with columns: multiplex, node, layer, score, which is the output of the random_walk_rank function
path (str) – Path to the SIF file
top (int) – Top nodes based on the random walk score to be included in the SIF file
aggregation (str) – One of “nomean”, “gmean”, “hmean”, “mean”, or “sum”
Example class
There is a class to generate a working example.
- multixrank.Example.__init__(self)
Initiates example class
- multixrank.Example.write(self, path)
Writes file tree of working example to ‘path’ directory
- Parameters:
path (str) – Path to the output directory
Configuration and network files
This configuration file defines network paths, multiplexes, bipartites and numerical parameters for the random walk. A working example can be found in the Tutorial section.
This is an example of a minimal configuration YAML file: config_minimal.yml
This is an example of a configuration YAML file with all parameters: config_full.yml
Multiplex and bipartite unweighted networks are given as two-column TSV files without a header.
This is an example: FR3.tsv
Multiplex and bipartite weighted networks are given as two-column TSV files without a header.
This is an example: 1_3.tsv
Remark: A space is needed after the symbol “-”, to define the elements of a list in the config.yml file.
Parameters
Below we explain the numerical parameters needed to run the random walk.
r
The global restart probability is given by the float number r between 0 and 1
delta
A vector of length equal to the number of multiplex networks with probabilities
A given element of the delta vector gives the probability to change the layer in a given multiplex network
tau
‘tau’ is given as a list of vectors where each vector corresponds to the restart probabilities in each multiplex network
Elements of each vector correspond to the restart probabilities at the given layer
For, instance the tau23 corresponds to the restart probability at the third layer of the second multiplex network
eta
The ‘eta’ parameter vector given the restart probability at a given multiplex network
A vector of probabilities with length equals to the number of multiplex networks
This vector sums up to one
lambda
The parameter ‘lambda’ is associated with the probability to jump from one multiplex network to another one. For instance, lambdaij represents the probability to jump from the multiplex network i to the multiplex network j.
graph_type field: unweighted/weighted, undirected/directed
The multiplex and bipartite graph types as either undirected or directed and unweighted or weighted are given by codes 00, 01, 10 and 11 in the following way:
Graph type |
Directed |
Weighted |
Code |
---|---|---|---|
Undirected, unweighted |
No |
No |
00 |
Undirected, weighted |
No |
Yes |
01 |
Directed, unweighted |
Yes |
No |
10 |
Directed, weighted |
Yes |
Yes |
11 |
self_loops
The ‘self_loops’ parameter defines whether self loops are removed or not
This parameter is a Boolean and takes values 0 or 1.
Setting this parameter to 1, it solves the problem of zero columns in the transition matrix if the network was wrongly built.