Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs #36

Merged
merged 3 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 121 additions & 117 deletions docs/getting-started/construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,132 +11,136 @@ nav_order: 2

1. Use [**pasmopy.Text2Model**](https://pasmopy.readthedocs.io/en/latest/model_development.html) to build a mechanistic model

```python
import os
```python
import os

from pasmopy import Text2Model
from pasmopy import Text2Model


Text2Model(os.path.join("models", "erbb_network.txt")).convert()
```
Text2Model(os.path.join("models", "erbb_network.txt")).convert()
```

1. Rename `erbb_network/` to CCLE_name or TCGA_ID, e.g., `MCF7_BREAST` or `TCGA_3C_AALK_01A`

```python
import shutil
```python
import shutil

shutil.move(
os.path.join("models", "erbb_network"),
os.path.join("models", "breast", "TCGA_3C_AALK_01A")
)
```
shutil.move(
os.path.join("models", "erbb_network"),
os.path.join("models", "breast", "TCGA_3C_AALK_01A")
)
```

## Other tasks for incorporating gene expression levels

1. Add weighting factors for each gene (prefix: `"w_"`) to `name2idx/parameters.py`

```python
from pasmopy import Model
from pasmopy.preprocessing import WeightingFactors

from models import erbb_network


model = Model(erbb_network.__package__).create()

gene_expression = {
"ErbB1": ["EGFR"],
"ErbB2": ["ERBB2"],
"ErbB3": ["ERBB3"],
"ErbB4": ["ERBB4"],
"Grb2": ["GRB2"],
"Shc": ["SHC1", "SHC2", "SHC3", "SHC4"],
"RasGAP": ["RASA1", "RASA2", "RASA3"],
"PI3K": ["PIK3CA", "PIK3CB", "PIK3CD", "PIK3CG"],
"PTEN": ["PTEN"],
"SOS": ["SOS1", "SOS2"],
"Gab1": ["GAB1"],
"RasGDP": ["HRAS", "KRAS", "NRAS"],
"Raf": ["ARAF", "BRAF", "RAF1"],
"MEK": ["MAP2K1", "MAP2K2"],
"ERK": ["MAPK1", "MAPK3"],
"Akt": ["AKT1", "AKT2"],
"PTP1B": ["PTPN1"],
"GSK3b": ["GSK3B"],
"DUSP": ["DUSP5", "DUSP6", "DUSP7"],
"cMyc": ["MYC"],
}

weighting_factors = WeightingFactors(model, gene_expression)
weighting_factors.add_to_params()
weighting_factors.set_search_bounds()
```

1. Edit `set_search_param.py`

```python
import os

import numpy as np

from pasmopy import Individualization

from . import __path__
from .name2idx import C, V
from .set_model import initial_values, param_values


incorporating_gene_expression_levels = Individualization(
parameters=C.NAMES,
species=V.NAMES,
transcriptomic_data=os.path.join("transcriptomic_data", "TPM_RLE_postComBat_BRCA_BREAST.csv"),
gene_expression={
"ErbB1": ["EGFR"],
"ErbB2": ["ERBB2"],
"ErbB3": ["ERBB3"],
"ErbB4": ["ERBB4"],
"Grb2": ["GRB2"],
"Shc": ["SHC1", "SHC2", "SHC3", "SHC4"],
"RasGAP": ["RASA1", "RASA2", "RASA3"],
"PI3K": ["PIK3CA", "PIK3CB", "PIK3CD", "PIK3CG"],
"PTEN": ["PTEN"],
"SOS": ["SOS1", "SOS2"],
"Gab1": ["GAB1"],
"RasGDP": ["HRAS", "KRAS", "NRAS"],
"Raf": ["ARAF", "BRAF", "RAF1"],
"MEK": ["MAP2K1", "MAP2K2"],
"ERK": ["MAPK1", "MAPK3"],
"Akt": ["AKT1", "AKT2"],
"PTP1B": ["PTPN1"],
"GSK3b": ["GSK3B"],
"DUSP": ["DUSP5", "DUSP6", "DUSP7"],
"cMyc": ["MYC"],
},
read_csv_kws={"index_col": "Description"}
)

...

def update(self, indiv):
x = param_values()
y0 = initial_values()

for i, j in enumerate(self.idx_params):
x[j] = indiv[i]
for i, j in enumerate(self.idx_initials):
y0[j] = indiv[i + len(self.idx_params)]

# As maximal transcription rate
x[C.V291] = incorporating_gene_expression_levels.as_reaction_rate(
__path__[0].split(os.sep)[-1], x, "V291", "DUSP"
)
x[C.V310] = incorporating_gene_expression_levels.as_reaction_rate(
__path__[0].split(os.sep)[-1], x, "V310", "cMyc"
)
# As initial conditions
y0 = incorporating_gene_expression_levels.as_initial_conditions(
__path__[0].split(os.sep)[-1], x, y0
)

...
```
```python
from pasmopy import Model
from pasmopy.preprocessing import WeightingFactors

from models import erbb_network


model = Model(erbb_network.__package__).create()

gene_expression = {
"ErbB1": ["EGFR"],
"ErbB2": ["ERBB2"],
"ErbB3": ["ERBB3"],
"ErbB4": ["ERBB4"],
"Grb2": ["GRB2"],
"Shc": ["SHC1", "SHC2", "SHC3", "SHC4"],
"RasGAP": ["RASA1", "RASA2", "RASA3"],
"PI3K": ["PIK3CA", "PIK3CB", "PIK3CD", "PIK3CG"],
"PTEN": ["PTEN"],
"SOS": ["SOS1", "SOS2"],
"Gab1": ["GAB1"],
"RasGDP": ["HRAS", "KRAS", "NRAS"],
"Raf": ["ARAF", "BRAF", "RAF1"],
"MEK": ["MAP2K1", "MAP2K2"],
"ERK": ["MAPK1", "MAPK3"],
"Akt": ["AKT1", "AKT2"],
"PTP1B": ["PTPN1"],
"GSK3b": ["GSK3B"],
"DUSP": ["DUSP5", "DUSP6", "DUSP7"],
"cMyc": ["MYC"],
}

weighting_factors = WeightingFactors(model, gene_expression)
weighting_factors.add_to_params()
weighting_factors.set_search_bounds()
```

1. Edit `SearchParam` class

```python
import os

import numpy as np

from pasmopy import Individualization

from . import __path__
from .name2idx import C, V
from .set_model import initial_values, param_values


incorporating_gene_expression_levels = Individualization(
parameters=C.NAMES,
species=V.NAMES,
transcriptomic_data=os.path.join("transcriptomic_data", "TPM_RLE_postComBat_BRCA_BREAST.csv"),
gene_expression={
"ErbB1": ["EGFR"],
"ErbB2": ["ERBB2"],
"ErbB3": ["ERBB3"],
"ErbB4": ["ERBB4"],
"Grb2": ["GRB2"],
"Shc": ["SHC1", "SHC2", "SHC3", "SHC4"],
"RasGAP": ["RASA1", "RASA2", "RASA3"],
"PI3K": ["PIK3CA", "PIK3CB", "PIK3CD", "PIK3CG"],
"PTEN": ["PTEN"],
"SOS": ["SOS1", "SOS2"],
"Gab1": ["GAB1"],
"RasGDP": ["HRAS", "KRAS", "NRAS"],
"Raf": ["ARAF", "BRAF", "RAF1"],
"MEK": ["MAP2K1", "MAP2K2"],
"ERK": ["MAPK1", "MAPK3"],
"Akt": ["AKT1", "AKT2"],
"PTP1B": ["PTPN1"],
"GSK3b": ["GSK3B"],
"DUSP": ["DUSP5", "DUSP6", "DUSP7"],
"cMyc": ["MYC"],
},
read_csv_kws={"index_col": "Description"}
)

...

class SearchParam(object):

...

def update(self, indiv):
x = param_values()
y0 = initial_values()

for i, j in enumerate(self.idx_params):
x[j] = indiv[i]
for i, j in enumerate(self.idx_initials):
y0[j] = indiv[i + len(self.idx_params)]

# As maximal transcription rate
x[C.V291] = incorporating_gene_expression_levels.as_reaction_rate(
__path__[0].split(os.sep)[-1], x, "V291", "DUSP"
)
x[C.V310] = incorporating_gene_expression_levels.as_reaction_rate(
__path__[0].split(os.sep)[-1], x, "V310", "cMyc"
)
# As initial conditions
y0 = incorporating_gene_expression_levels.as_initial_conditions(
__path__[0].split(os.sep)[-1], x, y0
)

...
```
52 changes: 32 additions & 20 deletions docs/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,41 @@ The following packages are required for transcriptomic data integration, paramet

### Python:

- [pasmopy==0.1.0](https://github.com/pasmopy/pasmopy)
- [biomass>=0.5.2,<0.6](https://github.com/biomass-dev/biomass)
- matplotlib==3.3.4
- numpy==1.19.2
- pandas==1.2.4
- seaborn==0.11.2
- scipy==1.6.0
```
$ pip install -r requirements.txt
```

> - [pasmopy==0.1.0](https://github.com/pasmopy/pasmopy)
> - [biomass>=0.5.2,<0.6](https://github.com/biomass-dev/biomass)
> - [matplotlib==3.3.4](https://matplotlib.org)
> - [numpy==1.19.2](https://numpy.org)
> - [pandas==1.2.4](https://pandas.pydata.org)
> - [seaborn==0.11.2](https://seaborn.pydata.org)
> - [scipy==1.6.0](https://scipy.org)

### Julia:

- [BioMASS.jl==0.5.0](https://github.com/biomass-dev/BioMASS.jl)
```shell
$ julia
julia> ] add BioMASS @0.5.0
```

> - [BioMASS.jl==0.5.0](https://github.com/biomass-dev/BioMASS.jl)

### R:

- TCGAbiolinks
- sva
- biomaRt
- ComplexHeatmap
- viridisLite
- dplyr
- edgeR
- sva
- tibble
- data.table
- stringr
- biomaRt
```shell
$ R
> source("install_requirements.R")
```

> - [TCGAbiolinks](https://bioconductor.org/packages/release/bioc/html/TCGAbiolinks.html)
> - [sva](https://bioconductor.org/packages/release/bioc/html/sva.html)
> - [biomaRt](https://bioconductor.org/packages/release/bioc/html/biomaRt.html)
> - [ComplexHeatmap](https://www.bioconductor.org/packages/release/bioc/html/ComplexHeatmap.html)
> - [viridisLite](https://github.com/sjmgarnier/viridisLite)
> - [dplyr](https://dplyr.tidyverse.org)
> - [edgeR](https://bioconductor.org/packages/release/bioc/html/edgeR.html)
> - [tibble](https://tibble.tidyverse.org)
> - [data.table](https://github.com/Rdatatable/data.table)
> - [stringr](https://stringr.tidyverse.org)