Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MAGE_2020_Marker-Gene-Benchmarking
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioCellGen-public
MAGE_2020_Marker-Gene-Benchmarking
Commits
20ea08d2
Commit
20ea08d2
authored
4 years ago
by
Jeffrey Pullin
Browse files
Options
Downloads
Patches
Plain Diff
Actually delete the file...
parent
ea4b53b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#6355
passed
4 years ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
analysis/process-pbmc3k.Rmd
+0
-112
0 additions, 112 deletions
analysis/process-pbmc3k.Rmd
with
0 additions
and
112 deletions
analysis/process-pbmc3k.Rmd
deleted
100644 → 0
+
0
−
112
View file @
ea4b53b9
---
title: "Process pbmc3k data"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r libraries}
library(TENxPBMCData)
library(scater)
library(scran)
library(EnsDb.Hsapiens.v86)
```
```{r set-seed}
set.seed(2332021)
```
```{r load-data}
pbmc3k <- TENxPBMCData(dataset = "pbmc3k")
counts(pbmc3k) <- as(counts(pbmc3k), "dgCMatrix")
```
```{r gene-annotation}
rownames(pbmc3k) <- uniquifyFeatureNames(
rowData(pbmc3k)$ENSEMBL_ID,
rowData(pbmc3k)$Symbol
)
# FIXME: Is this warning message safe to ignore?
location <- mapIds(
EnsDb.Hsapiens.v86,
keys = rowData(pbmc3k)$ENSEMBL_ID,
column = "SEQNAME", keytype = "GENEID"
)
```
The dataset is already filtered, so we don't perform cell detection.
```{r quality-control}
stats <- perCellQCMetrics(
pbmc3k,
subsets = list(Mito = which(location == "MT"))
)
high_mito <- isOutlier(stats$subsets_Mito_percent, type = "higher")
pbmc3k <- pbmc3k[, !high_mito]
# Remove genes with 0 counts.
zero_genes <- which(rowSums(counts(pbmc3k)) == 0)
pbmc3k <- pbmc3k[-zero_genes, ]
```
```{r normalization}
# Despite the name this is quite slow...
clusters <- quickCluster(pbmc3k)
pbmc3k <- computeSumFactors(pbmc3k, cluster = clusters)
pbmc3k <- logNormCounts(pbmc3k)
```
```{r variance-modelling}
dec_pbmc3k <- modelGeneVarByPoisson(pbmc3k)
# Select the top 10000 genes.
top_pbmc3k <- getTopHVGs(dec_pbmc3k, n = 10000)
pbmc3k <- pbmc3k[top_pbmc3k, ]
```
```{r dimensionality-reduction}
# Running PCA is slow.
pbmc3k <- runPCA(pbmc3k)
pbmc3k <- runTSNE(pbmc3k, dimred = "PCA")
pbmc3k <- runUMAP(pbmc3k, dimred = "PCA")
```
```{r plot-tsne}
plotTSNE(pbmc3k)
```
```{r plot-umap}
plotUMAP(pbmc3k)
```
```{r clustering}
# 15 is hand chose to give a clustering which 'looks right' on the tSNE plot.
g <- buildSNNGraph(pbmc3k, k = 15, use.dimred = "PCA")
clust <- igraph::cluster_walktrap(g)$membership
colLabels(pbmc3k) <- factor(clust)
```
````{r plot-tsne-with-clustering}
plotTSNE(pbmc3k, colour_by = "label")
```
```{r plot-umap-with-clustering}
plotUMAP(pbmc3k, colour_by = "label")
```
In the simulations we only use a subset of cells to estimate the splatter parameters, so that the variance is not overestimated because of clustering.
Here we select cluster 9.
```{r define-subset}
subset_ind <- colLabels(pbmc3k) == 9
pbmc3k_subset <- pbmc3k[, subset_ind]
```
```{r save-subset}
saveRDS(pbmc3k_subset, here::here("data", "pbmc3k.rds"))
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment