Skip to content

Commit 035a60d

Browse files
committed
updated paths in sc_atac
1 parent bee5cae commit 035a60d

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

Sessions/adv_tuesday/sc_atac.qmd

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,27 +128,42 @@ The data are named `8k_mouse_cortex_ATACv2_nextgem_Chromium_Controller*` and are
128128

129129
#### Load the raw data
130130
```{r load_other_data}
131+
raw_atac2 <-
132+
Read10X_h5(paste0(data_directory,
133+
"8k_mouse_cortex_ATACv2_nextgem_Chromium_Controller_raw_peak_bc_matrix.h5"))
131134
132135
```
133136

134137
#### Create a chromatin assay object
135138
```{r create_chromatin_object_ex}
139+
chrom_obj2 <-
140+
CreateChromatinAssay(counts = raw_atac2,
141+
fragments = paste0(data_directory,
142+
"8k_mouse_cortex_ATACv2_nextgem_Chromium_Controller_fragments.tsv.gz"),
143+
sep = c(":", "-"),
144+
min.cells = 10,
145+
min.features = 200)
136146
147+
rm(raw_atac2)
137148
```
138149

139150
#### Make a Seurat object
140151
```{r create_seurat_object_ex}
152+
seurat_obj2 <-
153+
CreateSeuratObject(counts = chrom_obj2,
154+
assay = "peaks")
141155
156+
rm(chrom_obj2)
142157
```
143158

144159
#### How many cells are in the sample?
145160
```{r}
146-
161+
length(Cells(seurat_obj2))
147162
```
148163

149164
#### How many peaks are in the sample?
150165
```{r}
151-
166+
length(rownames(seurat_obj2))
152167
```
153168

154169
#### Look at the first 50 rows for the first 3 cells
@@ -326,7 +341,7 @@ seurat_obj <-
326341
nucleosome_signal < 4 &
327342
TSS.enrichment > 1 &
328343
percent_mito < 10)
329-
qs::qsave(seurat_obj, "Sessions/adv_tuesday/Chromium_X_filtered.qs")
344+
qs::qsave(seurat_obj, "output/rdata/Chromium_X_filtered.qs")
330345
```
331346

332347

@@ -366,7 +381,7 @@ For ATAC, we do a couple of things differentially than GEX data.
366381
- The reduction is named "lsi"
367382

368383
```{r}
369-
seurat_obj <- qs::qread("Sessions/adv_tuesday/Chromium_X_filtered.qs")
384+
seurat_obj <- qs::qread("output/rdata/Chromium_X_filtered.qs")
370385
371386
seurat_obj <-
372387
seurat_obj %>%
@@ -386,7 +401,7 @@ DimPlot(seurat_obj,
386401
reduction = "umap_atac",
387402
label = TRUE)
388403
389-
qs::qsave(seurat_obj, "Sessions/adv_tuesday/Chromium_X_processed.qs")
404+
qs::qsave(seurat_obj, "output/rdata/Chromium_X_processed.qs")
390405
```
391406

392407
## Assigning cell types
@@ -414,15 +429,15 @@ seurat_obj <-
414429
scale.factor = median(seurat_obj$nCount_RNA))
415430
DefaultAssay(seurat_obj) <- "RNA"
416431
417-
qs::qsave(seurat_obj, "Sessions/adv_tuesday/Chromium_X_gene_activity.qs")
432+
qs::qsave(seurat_obj, "output/rdata/Chromium_X_gene_activity.qs")
418433
```
419434

420435
## Find commonalities between datasets
421436
Puts the data into a common space to find anchors between the datasets.
422437
"cca" in this context is canonical correlation analysis. It finds linear combinations of the variables in the two datasets that have maximal correlation with each other. This is useful for finding commonalities between datasets.
423438
https://en.wikipedia.org/wiki/Canonical_correlation
424439
```{r transfer_anchors}
425-
seurat_obj <- qs::qread("Sessions/adv_tuesday/Chromium_X_gene_activity.qs")
440+
seurat_obj <- qs::qread("output/rdata/Chromium_X_gene_activity.qs")
426441
427442
anchors <-
428443
FindTransferAnchors(reference = ref_data,

0 commit comments

Comments
 (0)