Skip to content

Commit

Permalink
disable execution cache, subset before pseudobulk
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 3, 2024
1 parent 5a3f8f7 commit 98ff23d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
1 change: 0 additions & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ format:
# cache computations
execute:
freeze: auto
cache: true
24 changes: 17 additions & 7 deletions notebooks/usecase.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,21 @@ adata <- read_h5ad("usecase_data/sc_counts_reannotated_with_counts.h5ad")
adata
```

## 3. Subset data

## 3. Compute pseudobulk
Subset to a single small molecule and control for computational efficiency:

```{python select_sm_celltype}
sm_name = "Belinostat"
control_name = "Dimethyl Sulfoxide"
adata = adata[
adata.obs["sm_name"].isin([sm_name, control_name])
]
```


## 4. Compute pseudobulk

```{python import_pandas}
import pandas as pd
Expand Down Expand Up @@ -97,7 +110,7 @@ Store to disk:
pb_adata.write_h5ad("usecase_data/pseudobulk.h5ad")
```

## 4. Compute DE
## 5. Compute DE

```{r load_pbdata}
library(anndata)
Expand All @@ -118,13 +131,10 @@ Create DESeq dataset:
count_data <- t(pb_adata$X)
storage.mode(count_data) <- "integer"
# subset to small molecule and control
ix <- pb_adata$obs$sm_name %in% c(sm_name, control_name)
# create dataset
dds <- DESeq2::DESeqDataSetFromMatrix(
countData = count_data[, ix],
colData = pb_adata$obs[ix, ],
countData = count_data,
colData = pb_adata$obs,
design = ~ sm_name + cell_type + plate_name,
)
```
Expand Down

0 comments on commit 98ff23d

Please sign in to comment.