Skip to content

Commit 93cb02d

Browse files
authored
Merge pull request #2 from netZoo/devel
Devel
2 parents 0af4bc5 + 3469acf commit 93cb02d

29 files changed

+697
-218
lines changed

CONDUCT.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
2+
3+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
4+
5+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
6+
7+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
8+
9+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
10+
11+
This Code of Conduct is adapted from the Contributor Covenant (http://contributor-covenant.org), version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 11 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -1,219 +1,17 @@
11
## Description
2-
Forked from [https://github.com/QuackenbushLab/pypanda](https://github.com/QuackenbushLab/pypanda),
3-
which was based on [https://github.com/davidvi/pypanda](https://github.com/davidvi/pypanda).
4-
Compared to QuackenbushLab/pypanda this repository adds the Python implementation of PUMA ([run_puma.py](run_puma.py) and [pypanda/puma.py](pypanda/puma.py)).
5-
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.
6-
7-
## Table of Contents
8-
* [Links to literature](#links-to-literature)
9-
* [Panda algorithm](#panda-algorithm)
10-
* [Installation](#installation)
11-
* [Usage](#usage)
12-
* [Run from terminal](#run-from-terminal)
13-
* [Run from python](#run-from-python)
14-
* [Toy data](#toy-data)
15-
* [Results](#results)
2+
netZooPy is a Python package of network methods.
163

4+
## Quick guide
5+
`git clone https://github.com/netZoo/netZooPy.git` into your local disk.
176

18-
## Links to literature
7+
## User guide
8+
Please refer to the [user guide](UserGuide.md) for installation instructions.
199

20-
* **[PUMA](https://static-content.springer.com/esm/art%3A10.1186%2Fs13045-017-0465-4/MediaObjects/13045_2017_465_MOESM3_ESM.pdf)** (PANDA Using MicroRNA Associations)
21-
_Manuscript in preparation, used in [PUMA](https://static-content.springer.com/esm/art%3A10.1186%2Fs13045-017-0465-4/MediaObjects/13045_2017_465_MOESM3_ESM.pdf)._
22-
C and MATLAB code: [https://github.com/mararie/PUMA](https://github.com/mararie/PUMA)
10+
## License
11+
The software is free and is licensed under the GNU General License v3.0, see the file [LICENSE](LICENSE) for details.
2312

24-
* **[PANDA](http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0064832)** Passing Attributes between Networks for Data Assimilation
25-
_Glass K, Huttenhower C, Quackenbush J, Yuan GC. Passing Messages Between Biological Networks to Refine Predicted Interactions, PLoS One, 2013 May 31;8(5):e64832_
26-
Original PANDA C++ code: [http://sourceforge.net/projects/panda-net/](http://sourceforge.net/projects/panda-net/).
13+
## Feedback/Issues
14+
Please report any issues to the [issues page](https://github.com/netZoo/netZooPy/issues).
2715

28-
* **[LIONESS](https://arxiv.org/abs/1505.06440)** (Linear Interpolation to Obtain Network Estimates for Single Samples)
29-
_Marieke Lydia Kuijjer, Matthew Tung,GuoCheng Yuan,John Quackenbush, Kimberly Glass. Estimating sample-specific regulatory networks_
30-
31-
LIONESS can be used to estimate single-sample networks using aggregate networks made with any network reconstruction algorithm (http://arxiv.org/pdf/1505.06440.pdf).
32-
33-
## Panda algorithm
34-
<img src="img/panda.png" height="300">
35-
36-
To find agreement between the three input networks first the responsibility (R) is calculated.
37-
38-
<img src="img/responsibility.png" height="30">
39-
40-
Thereafter availability (A) is calculated.
41-
42-
<img src="img/availability.png" height="30">
43-
44-
Availability and responsibility are combined with the following formula.
45-
46-
<img src="img/combine.png" height="30">
47-
48-
Protein cooperativity and gene co-regulatory networks are updated.
49-
50-
<img src="img/cooperativity.png" height="30">
51-
<img src="/img/co-regulatory.png" height="30">
52-
53-
P and C are updated to satisfy convergence.
54-
55-
<img src="img/p.png" height="30">
56-
<img src="/img/c.png" height="30">
57-
58-
Hamming distance is calculated every iteration.
59-
60-
<img src="img/hamming.png" height="40">
61-
62-
63-
## Installation
64-
PyPanda runs on Python 2.7. You can either run the pypanda script directly (see [Usage](#usage)) or install it on your system. We recommend the following commands to install pypandas on UNIX systems:
65-
#### Using a virtual environment
66-
Using [python virtual environments](http://docs.python-guide.org/en/latest/dev/virtualenvs/) is the cleanest installation method.
67-
68-
Cloning git and setting up a [python virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/):
69-
```no-highlight
70-
pip install --user pipenv #Make sure you have pipenv
71-
git clone https://github.com/aless80/pypanda.git
72-
cd pypanda
73-
```
74-
Creating a virtual environment and installing pypanda:
75-
```no-highlight
76-
virtualenv pypandaenv #virtual environment created in a folder inside the git folder
77-
source pypandaenv/bin/activate
78-
(pypandaenv)$ pip install -r requirements.txt
79-
(pypandaenv)$ python setup.py install --record files.txt
80-
```
81-
Uninstall pypanda from virtual environment:
82-
```no-highlight
83-
cat files.txt | xargs rm -rf
84-
```
85-
Complete removal of virtual environment and pypanda:
86-
```no-highlight
87-
(pypanda)$ deactivate #Quit virtual environment
88-
rm -rf pypandaenv
89-
```
90-
91-
#### Using pip
92-
Never use ~~sudo pip~~. Instead you can use pip on the user's install directory:
93-
```no-highlight
94-
git clone https://github.com/aless80/pypanda.git
95-
cd pypanda
96-
python setup.py install --user
97-
#to run from the command line you will need to make pypanda executable and add the bin directory to your PATH:
98-
cd bin
99-
chmod +x pypanda
100-
echo "$(pwd):PATH" >> ~/.bashrc
101-
source ~/.bashrc
102-
```
103-
104-
```no-highlight
105-
pip uninstall pypanda
106-
```
107-
To run pypanda from Windows (tested on Windows 10) install Git (https://git-scm.com/downloads) and Anaconda Python2.7 (https://www.continuum.io/downloads) and from the Anaconda prompt run:
108-
```no-highlight
109-
git clone https://github.com/aless80/pypanda.git
110-
cd pypanda
111-
python setup.py install
112-
```
113-
114-
## Usage
115-
#### Run from terminal
116-
pypanda (or pypuma) can be run directly from the terminal with the following options:
117-
```
118-
-h help
119-
-e, --expression: expression values
120-
-m, --motif: pair file of motif edges, or Pearson correlation matrix when not provided
121-
-p, --ppi: pair file of PPI edges
122-
-o, --output: output file
123-
-i, --mir: mir data miR file (only for pypuma)
124-
-r, --rm_missing
125-
-q, --lioness: output for Lioness single sample networks
126-
```
127-
To run pypanda on toy data:
128-
```
129-
python run_panda.py -e ./ToyData/ToyExpressionData.txt -m ./ToyData/ToyMotifData.txt -p ./ToyData/ToyPPIData.txt -o output_panda.txt
130-
```
131-
To reconstruct a single sample Lioness Pearson correlation network (this can take some time):
132-
```python
133-
python run_panda.py -e ./ToyData/ToyExpressionData.txt -m ./ToyData/ToyMotifData.txt -p ./ToyData/ToyPPIData.txt -o output_panda.txt -q output_lioness.txt
134-
```
135-
136-
To run pypuma on toy data:
137-
```python
138-
python run_puma.py -e ./ToyData/ToyExpressionData.txt -m ./ToyData/ToyMotifData.txt -p ./ToyData/ToyPPIData.txt -o output_puma.txt -i ./ToyData/ToyMiRList.txt
139-
```
140-
To reconstruct a single sample Lioness Pearson correlation network using pypuma (this can take some time):
141-
```python
142-
python run_puma.py -e ./ToyData/ToyExpressionData.txt -m ./ToyData/ToyMotifData.txt -p ./ToyData/ToyPPIData.txt -i ToyData/ToyMiRList.txt -o output_puma.txt -q output_lioness.txt
143-
```
144-
For pypuma see also [PyPuma](https://github.com/aless80/pypuma#installation).
145-
146-
#### Run from python
147-
Fire up your python shell or ipython notebook. Use the python installation in the virtual environment if you installed pypanda there.
148-
149-
Import the classes in the pypanda library:
150-
```python
151-
from pypanda.panda import Panda
152-
from pypuma.puma import Puma
153-
from pypanda.lioness import Lioness
154-
```
155-
Run the Panda algorithm, leave out motif and PPI data to use Pearson correlation network:
156-
```python
157-
panda_obj = Panda('ToyData/ToyExpressionData.txt', 'ToyData/ToyMotifData.txt', 'ToyData/ToyPPIData.txt', remove_missing=False)
158-
```
159-
Save the results:
160-
```python
161-
panda_obj.save_panda_results('Toy_Panda.pairs.txt')
162-
```
163-
Return a network plot:
164-
165-
```python
166-
panda_obj.top_network_plot(top=70, file='top_genes.png')
167-
```
168-
Calculate in- and outdegrees for further analysis:
169-
```python
170-
indegree = panda_obj.return_panda_indegree()
171-
outdegree = panda_obj.return_panda_outdegree()
172-
```
173-
To run the Lioness algorithm for single sample networks, first run panda (or puma) using the keep_expression_matrix flag, then use Lioness as follows:
174-
```python
175-
panda_obj = Panda('ToyData/ToyExpressionData.txt', 'ToyData/ToyMotifData.txt', 'ToyData/ToyPPIData.txt', remove_missing=False, keep_expression_matrix=True)
176-
lioness_obj = Lioness(panda_obj)
177-
```
178-
Save Lioness results:
179-
```python
180-
lioness_obj.save_lioness_results('Toy_Lioness.txt')
181-
```
182-
Return a network plot for one of the Lioness single sample networks:
183-
```python
184-
plot = AnalyzeLioness(lioness_obj)
185-
plot.top_network_plot(column= 0, top=100, file='top_100_genes.png')
186-
```
187-
188-
Run the Puma algorithm, leave out motif and PPI data to use Pearson correlation network:
189-
```python
190-
puma_obj = Puma('ToyData/ToyExpressionData.txt', 'ToyData/ToyMotifData.txt', 'ToyData/ToyPPIData.txt','ToyData/ToyMiRList.txt')
191-
```
192-
193-
## Toy data
194-
The example gene expression data that we have available here contains gene expression profiles for different samples in the columns. Of note, this is just a small subset of a larger gene expression dataset. We provided these "toy" data so that the user can test the method.
195-
196-
However, if you plan to model gene regulatory networks on your own dataset, you should use your own expression data as input.
197-
198-
## Results
199-
```
200-
Example Panda output:
201-
TF Gene Motif Force
202-
---------------------
203-
CEBPA AACSL 0.0 -0.951416589143
204-
CREB1 AACSL 0.0 -0.904241609324
205-
DDIT3 AACSL 0.0 -0.956471642313
206-
E2F1 AACSL 1.0 3.6853160511
207-
EGR1 AACSL 0.0 -0.695698519643
208-
209-
Example lioness output:
210-
Sample1 Sample2 Sample3 Sample4
211-
-------------------------------
212-
-0.667452814003 -1.70433776179 -0.158129613892 -0.655795512803
213-
-0.843366539284 -0.733709815256 -0.84849895139 -0.915217389738
214-
3.23445386464 2.68888472802 3.35809757371 3.05297381396
215-
2.39500370135 1.84608635425 2.80179804094 2.67540878165
216-
-0.117475863987 0.494923925853 0.0518448588965 -0.0584810456421
217-
218-
TF, Gene and Motif order is identical to the panda output file.
219-
```
16+
## Code of conduct
17+
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.

README.md.orig renamed to UserGuide.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
<<<<<<< HEAD
2-
# netZooPy
3-
=======
41
## Description
52
Forked from [https://github.com/QuackenbushLab/pypanda](https://github.com/QuackenbushLab/pypanda),
63
which was based on [https://github.com/davidvi/pypanda](https://github.com/davidvi/pypanda).
@@ -219,5 +216,4 @@ Sample1 Sample2 Sample3 Sample4
219216
-0.117475863987 0.494923925853 0.0518448588965 -0.0584810456421
220217
221218
TF, Gene and Motif order is identical to the panda output file.
222-
```
223-
>>>>>>> pypanda/devel-update
219+
```
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)