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 pasmopy version #22

Merged
merged 8 commits into from
Oct 6, 2021
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
124 changes: 81 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,42 @@ R:

- [Integration of TCGA and CCLE data](#integration-of-tcga-and-ccle-data)

- [Construction of a comprehensive model of the ErbB signaling network](#construction-of-a-comprehensive-model-of-the-ErbB-signaling-network)
- [Download TCGA clinical/subtype information](#download-tcga-clinicalsubtype-information)

- [Select samples in reference to clinical or subtype data](#select-samples-in-reference-to-clinical-or-subtype-data)

- [Download TCGA gene expression data (HTSeq-Counts)](#download-tcga-gene-expression-data-htseq-counts)

- [Download CCLE transcriptomic data](#download-ccle-transcriptomic-data)

- [Merge TCGA and CCLE data](#merge-tcga-and-ccle-data)

- [Normalize RNA-seq counts data](#normalize-rna-seq-counts-data)

- [Construction of a comprehensive model of the ErbB signaling network](#construction-of-a-comprehensive-model-of-the-erbb-signaling-network)

- [From text into executable models](#from-text-into-executable-models)

- [Other tasks for incorporating gene expression levels](#other-tasks-for-incorporating-gene-expression-levels)

- [Individualization of the mechanistic model](#individualization-of-the-mechanistic-model)

- [Parameter estimation](#parameter-estimation)

- [Patient-specific simulations](#patient-specific-simulations)

- [Subtype classification based on the ErbB signaling dynamics](#subtype-classification-based-on-the-ErbB-signaling-dynamics)

- [Extraction of response characteristics from patient-specific simulations](#extraction-of-response-characteristics-from-patient-specific-simulations)

- [Model-based patient stratification](#model-based-patient-stratification)

- [Investigation of patient-specific pathway activities](#investigation-of-patient-specific-pathway-activities)

- [Sensitivity analysis](#sensitivity-analysis)

- [Drug response data analysis](#drug-response-data-analysis)

## Integration of TCGA and CCLE data

### Download TCGA clinical/subtype information
Expand All @@ -67,7 +95,7 @@ R:
outputSubtype("BRCA")
```

Output: `{TCGA Study Abbreviation}_clinic.csv` or `{TCGA Study Abbreviation}_subtype.csv`
Output: `<TCGA Study Abbreviation>_clinic.csv` or `<TCGA Study Abbreviation>_subtype.csv`

### Select samples in reference to clinical or subtype data

Expand Down Expand Up @@ -115,21 +143,23 @@ R:

Output : `totalreadcounts.csv`

### Normalization of RNA-seq counts data
### Normalize RNA-seq counts data

- Conduct noramlization of RNA-seq.
- You can specify min and max value for truncation of total read counts.
- If you do not want to specify values for truncation, please set `min = F` or `max = F`.
- If you do not want to specify values for truncation, please set `min=F` or `max=F`.

```R
normalization(min = 40000000, max = 140000000)
normalization(min=40000000, max=140000000)
```

Output : `TPM_RLE_postComBat_{TCGA}_{CCLE}.csv`
Output : `TPM_RLE_postComBat_<TCGA>_<CCLE>.csv`

## Construction of a comprehensive model of the ErbB signaling network

1. Use `pasmopy.Text2Model` to build a mechanistic model
### From text into executable models

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

```python
import os
Expand All @@ -140,11 +170,24 @@ R:
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

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`](models/breast/TCGA_3C_AALK_01A/name2idx/parameters.py)

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

from models import erbb_network

Expand Down Expand Up @@ -175,21 +218,10 @@ R:
}

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

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

```python
import shutil

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

1. Edit [`set_search_param.py`](models/breast/TCGA_3C_AALK_01A/set_search_param.py)

```python
Expand Down Expand Up @@ -261,7 +293,9 @@ R:

## Individualization of the mechanistic model

### Use time-course datasets to train kinetic constants and weighting factors
### Parameter estimation

Here, we use phospho-protein time-course datasets to train kinetic constants and weighting factors.

1. Build a mechanistic model to identify model parameters

Expand Down Expand Up @@ -312,10 +346,10 @@ R:
breast_cancer_models = []
path_to_models = os.path.join("models", "breast")
for model in os.listdir(path_to_models):
if os.path.isdir(os.path.join(path_to_models, model)) and (
model.startswith("TCGA_") or model.endswith("_BREAST")
):
breast_cancer_models.append(model)
if os.path.isdir(os.path.join(path_to_models, model)) and (
model.startswith("TCGA_") or model.endswith("_BREAST")
):
breast_cancer_models.append(model)
# Set optimized parameters
for model in breast_cancer_models:
shutil.copytree(
Expand All @@ -324,7 +358,7 @@ R:
)
```

### Execute patient-specific models
### Patient-specific simulations

- Use `pasmopy.PatientModelSimulations`

Expand Down Expand Up @@ -353,26 +387,30 @@ R:

## Subtype classification based on the ErbB signaling dynamics

1. Extract response characteristics from patient-specific simulations
### Extraction of response characteristics from patient-specific simulations

```python
simulations.subtyping(
fname=None,
dynamical_features={
"Phosphorylated_Akt": {"EGF": ["max"], "HRG": ["max"]},
"Phosphorylated_ERK": {"EGF": ["max"], "HRG": ["max"]},
"Phosphorylated_c-Myc": {"EGF": ["max"], "HRG": ["max"]},
}
)
```
- Execute `subtyping()`

```python
simulations.subtyping(
fname=None,
dynamical_features={
"Phosphorylated_Akt": {"EGF": ["max"], "HRG": ["max"]},
"Phosphorylated_ERK": {"EGF": ["max"], "HRG": ["max"]},
"Phosphorylated_c-Myc": {"EGF": ["max"], "HRG": ["max"]},
}
)
```

1. Visualize patient classification by executing [`brca_heatmap.R`](classification/brca_heatmap.R)
### Model-based patient stratification

```bash
$ cd classification
# $ Rscript brca_heatmap.R [n_cluster: int] [figsize: tuple]
$ Rscript brca_heatmap.R 6 8,5
```
- Run [`brca_heatmap.R`](classification/brca_heatmap.R)

```bash
$ cd classification
# $ Rscript brca_heatmap.R [n_cluster: int] [figsize: tuple]
$ Rscript brca_heatmap.R 6 8,5
```

## Investigation of patient-specific pathway activities

Expand Down
34 changes: 20 additions & 14 deletions drug_response/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CCLE drug response data analysis and visualization
## CCLE drug response data analysis and visualization

## Drug response data
### Drug response data

#### Description:

Expand All @@ -14,43 +14,49 @@

- Barretina, J., Caponigro, G., Stransky, N. _et al_. The Cancer Cell Line Encyclopedia enables predictive modelling of anticancer drug sensitivity. _Nature_ **483**, 603–607 (2012). https://doi.org/10.1038/nature11003

## Usage
1. Prepare sample.txt and gene.txt, which contain the names of the samples and genes, respectively.
### Usage

1. Prepare [`sample.txt`](data/sample.txt) and [`gene.txt`](data/gene.txt), which contain the names of the samples and genes, respectively.

1. Open R

```bash
$ R
```
```

1. Load CCLE_normalization.R
1. Load `CCLE_normalization.R`

```R
source("calc_erbb_ratio.R")
```

1. Read sample.txt and gene.txt
If you want data for a specific samples or genes, you will need to create a list of those samples as `sample.txt` or `gene.txt` and read it here.
1. Read [`sample.txt`](data/sample.txt) and [`gene.txt`](data/gene.txt)

If you want data for a specific samples or genes, you will need to create a list of those samples as [`sample.txt`](data/sample.txt) or [`gene.txt`](data/gene.txt) and read it here.

```R
gene <- scan("gene.txt", what="character")
#sample <- scan("sample.txt", what="character")
```

1. Create TPM/RLE normalized RNA-seq data matrix of selected samples and genes

```R
CCLEnormalization(gene, sample = NULL)
```
Output: CCLE_normalized.csv (TPM/RLE normalized RNA-seq data for specific samples or genes)

1. Calculate receotor ratio
Calculate EGFR/(ERBB2+ERBB3+ERBB4) using CCLE_normalized.csv.
If you want to run this coad, you need to prepare gene.txt containing the names of these 4 genes.
Output: [`CCLE_normalized.csv`](data/CCLE_normalized.csv) (TPM/RLE normalized RNA-seq data for specific samples or genes)

1. Calculate EGFR/(ERBB2+ERBB3+ERBB4) using [`CCLE_normalized.csv`](data/CCLE_normalized.csv)

If you want to run this code, you need to prepare `gene.txt` containing the names of these 4 genes.

```R
CCLE_normalized <- read.csv("CCLE_normalized.csv", row.names = 1)
receptor_ratio(data = CCLE_normalized, num = 30)
```
Output: "ErbB_expression_ratio.csv"


Output: [`ErbB_expression_ratio.csv`](data/ErbB_expression_ratio.csv)

1. Drug response analysis and visualization

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pasmopy
biomass==0.5.2
matplotlib
matplotlib>=3.0
numpy>=1.17
pandas>=0.23
seaborn>=0.11
Expand Down
5 changes: 2 additions & 3 deletions tests/test_patient_specific_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from typing import Callable, List

import numpy as np
from biomass import Model
from pasmopy import PatientModelSimulations, Text2Model
from pasmopy import Model, PatientModelSimulations, Text2Model
from pasmopy.preprocessing import WeightingFactors

from .C_erbb_network import *
Expand Down Expand Up @@ -68,7 +67,7 @@ def test_model_construction():
}

weighting_factors = WeightingFactors(model, gene_expression)
weighting_factors.add()
weighting_factors.add_to_params()
weighting_factors.set_search_bounds()
# Edit observable.py, update normalization
with open(
Expand Down
Loading