netZooPy Documentation
Release 0.1.1
netZooPy
Contents:
1 Contents 3 1.1 Installation guide . . . 3 1.1.1 Requirements . . . 3 1.1.2 Install . . . 3 1.1.3 Troubleshooting. . . 4 1.2 Functions . . . 4 1.2.1 netZooPy.panda . . . 4 1.2.2 netZooPy.lioness . . . 7 1.2.3 netZooPy.puma . . . 9 1.3 Tutorials . . . 12 1.4 Changelog . . . 12 1.4.1 0.7.2 (2020-07-18) . . . 12 1.4.2 0.7.1 (2020-06-27) . . . 13 1.4.3 0.7.0 (2020-01-18) . . . 13 1.4.4 0.6.2 (Stockholm) (2020-05-15) . . . 13 1.4.5 0.6.1 (2020-01-18) . . . 13 1.4.6 0.5.0 (2019-11-22) . . . 13 1.4.7 0.4.0 (2019-11-18) . . . 13 1.4.8 0.3.0 (2019-11-14) . . . 13 1.4.9 0.2.0 (2019-11-13) . . . 14 1.4.10 0.1.1 (2019-9-3). . . 14 1.4.11 0.1.0 (2019-7-26) . . . 142 Indices and tables 15
netZooPy Documentation, Release 0.1.1
netZooPy is a catalog of methods for the reconstruction and analysis of gene regulatory networks. netZooPy has started as a merge of the following repositories and forks:
• pypandafrom David Van Ijzendorn,
• Alessandro Marin’s pypanda and Marieke Kuijjer’s pypumafork, and • Cho-Yi Chen’sfork.
• Genis Calderer’spysambarandpycondor
CHAPTER
1
Contents
1.1 Installation guide
To install netZooPy on your computer, please check the following requirements:
1.1.1 Requirements
• Python 3
In addition to the following pip packages: • networkx • numpy • pandas • matplotlib • scipy • python-igraph
1.1.2 Install
• git clone https://github.com/netZoo/netZooPy.git • cd netZooPy
• pip3 install -e .
• Then you can import netZooPy in your code through import netZooPy
netZooPy Documentation, Release 0.1.1
1.1.3 Troubleshooting
• If you experience installation issues with igraph on MacOs. Please install igraph through brew install igraph.
Please refer to the detailed error fix for MacOs and Ubuntuhere. Refer to the igraph instrallationmanual
• To report any installation issue or function bug, please report through opening anissueon github.
1.2 Functions
1.2.1 netZooPy.panda
analyze_panda class AnalyzePanda AnalyzePanda(Panda) Network plot. top_network_plottop_network_plot(self, top = 100, file = 'panda_top_100.png') Select top genes
shape_plot_network
__shape_plot_network(self, subset_panda_results, file = 'panda.png')
Create plot
create_plot
__create_plot(self, unique_genes, links, file = 'panda.png')
Run plot
run_panda Description:
Run PANDA algorithm from the command line.
Usage:
-h, --help: help
netZooPy Documentation, Release 0.1.1
(continued from previous page)
-e, --expression: expression values
-m, --motif: pair file of motif edges, or Pearson correlation matrix when not
˓→provided
-p, --ppi: pair file of PPI edges
-o, --out: output file
-r, --rm_missing
-q, --lioness: output for Lioness single sample networks
Example:
python run_panda.py -e ./ToyData/ToyExpressionData.txt -m ./ToyData/ToyMotifData.
˓→txt -p ./ToyData/ToyPPIData.txt -o test_panda.txt -q output_panda.txt
panda class Panda
Panda(object) Description:
Using PANDA to infer gene regulatory network.
Usage:
1. Reading in input data (expression data, motif prior, TF PPI data)
2. Computing coexpression network
3. Normalizing networks
4. Running PANDA algorithm
5. Writing out PANDA network
Authors:
cychen, davidvi, alessandromarin
init
init__(self, expression_file, motif_file, ppi_file, save_memory = False, save_
˓→tmp=True, remove_missing=False, keep_expression_matrix = False):
# ===================================================================== # Data loading
# =====================================================================
remove_missing
remove_missing(self)
Remove genes and tfs not present in all files.
netZooPy Documentation, Release 0.1.1
normalize_network
normalize_network(self, x)
panda_loop
panda_loop(self, correlation_matrix, motif_matrix, ppi_matrix)
Panda algorithm.
t_function
t_function(x, y=None) T function.
update_diagonal
update_diagonal(diagonal_matrix, num, alpha, step) Update diagonal.
pearson_results_data_frame
pearson_results_data_frame(self) Results to data frame.
save_panda_results
save_panda_results(self, path='panda.npy')
top_network_plot
top_network_plot(self, top = 100, file = 'panda_top_100.png') Select top genes.
shape_plot_network
shape_plot_network(self, subset_panda_results, file = 'panda.png')
netZooPy Documentation, Release 0.1.1
create_plot
create_plot(self, unique_genes, links, file = 'panda.png') Run plot.
split_label
split_label(label)
return_panda_indegree
return_panda_indegree(self) Return Panda indegree.
return_panda_outdegree
return_panda_outdegree(self)
Return Panda outdegree.
1.2.2 netZooPy.lioness
run_lionessDescription:
Run LIONESS algorithm from the command line.
Usage:
-h, --help: help
-e, --expression: expression matrix (.npy)
-m, --motif: motif matrix, normalized (.npy)
-p, --ppi: ppi matrix, normalized (.npy)
-n, --npy: PANDA network (.npy)
-o, --out: output folder
-f, --format: output format (txt, npy, or mat)
start: to start from nth sample (optional)
end: to end at nth sample (optional, must with start)
Example:
python run_lioness.py -e expression.npy -m motif.npy -p ppi.npy -n panda.npy -o /
˓→tmp -f npy 1 100
lioness
netZooPy Documentation, Release 0.1.1
class Lioness
Lioness(Panda) Description:
Using LIONESS to infer single-sample gene regulatory networks.
Usage:
1. Reading in PANDA network and preprocessed middle data
2. Computing coexpression network
3. Normalizing coexpression network
4. Running PANDA algorithm
5. Writing out LIONESS networks
Authors:
cychen, davidvi
init
init__(self, obj, start=1, end=None, save_dir='lioness_output', save_fmt='npy')
lioness_loop
lioness_loop(self)
save_lioness_results
save_lioness_results(self, file='lioness.txt')
analyze_lioness class AnalyzeLioness
AnalyzeLioness(Lioness)
init
init__(self, lioness_data)
netZooPy Documentation, Release 0.1.1
top_network_plot
top_network_plot(self, column = 0, top = 100, file = 'lioness_top_100.png') Select top genes.
lioness_for_puma class LionessPuma
LionessPuma(Puma)
Description:
Using LIONESS to infer single-sample gene regulatory networks.
Usage:
1. Reading in PUMA network and preprocessed middle data
2. Computing coexpression network
3. Normalizing coexpression network
4. Running PUMA algorithm
5. Writing out LIONESS networks
Authors:
cychen, davidvi
init
init__(self, obj, start=1, end=None, save_dir='lioness_output', save_fmt='npy')
lioness_loop
lioness_loop(self)
save_lioness_results
save_lioness_results(self, file='lioness.txt')
1.2.3 netZooPy.puma
run_pumaDescription:
Run PUMA algorithm from the command line.
Usage: run_puma
(continues on next page)
netZooPy Documentation, Release 0.1.1
(continued from previous page)
-h, --help: help
-e, --expression: expression values
-m, --motif: pair file of motif edges, or Pearson correlation matrix when not
˓→provided
-p, --ppi: pair file of PPI edges
-i, --mir (required): miR file
-o, --out: output file
-r, --rm_missing
-q, --lioness: output for Lioness single sample networks
Example:
python run_puma.py -e ./ToyData/ToyExpressionData.txt -m ./ToyData/ToyMotifData.
˓→txt -p ./ToyData/ToyPPIData.txt -i ToyData/ToyMiRList.txt -o test_puma.txt -q ˓→output_lioness.txt
puma class Puma
Puma(object)
Description:
Using PUMA to infer gene regulatory network.
Usage:
1. Reading in input data (expression data, motif prior, TF PPI data, miR)
2. Computing coexpression network
3. Normalizing networks
4. Running PUMA algorithm
5. Writing out PUMA network
Authors:
cychen, davidvi, alessandromarin
init
init__(self, expression_file, motif_file, ppi_file, mir_file, save_memory = False,
˓→save_tmp=True, remove_missing=False, keep_expression_matrix = False)
# ===================================================================== # Data loading
# =====================================================================
remove_missing
remove_missing(self)
netZooPy Documentation, Release 0.1.1
normalize_network
normalize_network(self, x)
puma_loop
puma_loop(self, correlation_matrix, motif_matrix, ppi_matrix)
Puma algorithm
t_function
t_function(x, y=None) T function
update_diagonal
update_diagonal(diagonal_matrix, num, alpha, step) Update diagoanl
pearson_results_data_frame
pearson_results_data_frame(self) Results to data frame
pearson_results_data_frame
pearson_results_data_frame(self) Results to data frame.
save_puma_results
save_puma_results(self, path='puma.npy')
top_network_plot
top_network_plot(self, top = 100, file = 'puma_top_100.png') Select top genes.
netZooPy Documentation, Release 0.1.1
shape_plot_network
shape_plot_network(self, subset_puma_results, file = 'puma.png') Create plot
create_plot
create_plot(self, unique_genes, links, file = 'puma.png') Run plot
split_label
split_label(label)
return_puma_indegree
return_puma_indegree(self) Return Puma indegree
return_puma_outdegree
return_puma_outdegree(self) Return Puma outdegree
1.3 Tutorials
Tutorials in netZooPy useJupternotebooks.
• Up_and_running_with_PANDA_and_netZooPyby Daniel C. Morgan.
• Building single-sample regulatory networks using LIONESS and netZooPyby Alex Qi Song. • CONDOR usage exampleby Genìs Calderer.
• SAMBAR usage exampleby Genìs Calderer.
• Running Panda and Lioness using the Graphical Processing Unit (GPU)by Daniel C. Morgan. • Controlling the variance of PANDA networksby Kalyan Palepu.
1.4 Changelog
1.4.1 0.7.2 (2020-07-18)
• changed condor ground truth to match output ofpython-igraph 0.8.2. • PANDA reads arguments as dataframes in addition to file paths
netZooPy Documentation, Release 0.1.1
1.4.2 0.7.1 (2020-06-27)
• Major fix for OTTER behavior across platforms.
1.4.3 0.7.0 (2020-01-18)
• new tool: OTTER • unit test for OTTER • fix for PANDA force field
• tweaks for compatibility of gpuPANDA with cupy
1.4.4 0.6.2 (Stockholm) (2020-05-15)
• Added gpuPANDA, which is a gpu-accelerated implementation of PANDA • Added gpuLIONESS
• Added a gpuPANDA and gpuLIONESS tutorial
• Fixed condor dependency to python-igraph (still under investigation in #82 )
1.4.5 0.6.1 (2020-01-18)
• sambar tutorial • condor tutorial
• added 3.8 to Ubunutu test server (along with 3.6 and 3.7 ) • Created three options for data processing in PANDA.
– Union: adds rows for genes/TFs that are missing in at least one prior (expression, ppi, motif) – Intersection: removes TF/genes that missing in at least one prior
– Legacy: previous data processing behavior
• The default was set to union in netZooM, netZooR, netZooPy as it is the default in netZooC.
1.4.6 0.5.0 (2019-11-22)
• pysambar1.4.7 0.4.0 (2019-11-18)
• pycondor1.4.8 0.3.0 (2019-11-14)
• pypuma 1.4. Changelog 13netZooPy Documentation, Release 0.1.1
1.4.9 0.2.0 (2019-11-13)
• pylioness
1.4.10 0.1.1 (2019-9-3)
• fixed call to save_memory=True
1.4.11 0.1.0 (2019-7-26)
• transition to python 3 • Changelog added to the doc
• pypanda: original import and NaN values in normalized matrices are replaced with values normalized by the overall z-score. This allows running the Toy Data provided in this repository.
CHAPTER
2
Indices and tables
• genindex • modindex • search