Skip to content

Commit

Permalink
subset data in usecase
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 4, 2024
1 parent 310c3ef commit 75fd179
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/_freeze/
/_book/
/_site/
/site_libs/
*.html

# Created by https://www.toptal.com/developers/gitignore/api/python,r
# Edit at https://www.toptal.com/developers/gitignore?templates=python,r
Expand Down
14 changes: 11 additions & 3 deletions notebooks/usecase.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,25 @@ adata

## 3. Subset data

Subset to a single small molecule and control for computational efficiency:
Since the dataset is large, we will subset the data to a single small molecule, control, and cell type.

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

We will also subset the genes to the top 2000 most variable genes.

```{python select_top_genes}
adata = adata[:, adata.var["highly_variable"]].copy()
```


## 4. Compute pseudobulk

Expand Down Expand Up @@ -135,7 +143,7 @@ storage.mode(count_data) <- "integer"
dds <- DESeq2::DESeqDataSetFromMatrix(
countData = count_data,
colData = pb_adata$obs,
design = ~ sm_name + cell_type + plate_name,
design = ~ sm_name + plate_name,
)
```

Expand Down

0 comments on commit 75fd179

Please sign in to comment.