-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrep_data_ex2.Rmd
43 lines (35 loc) · 1.63 KB
/
Prep_data_ex2.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
title: "Exercise 1"
output:
html_document:
number_sections: true
toc: true
---
This script was used to prepare the dataset for exercise 2
```{r, message=FALSE, warning=F, results=FALSE}
# Load the environment and libraries
renv::restore() # Run once, when you download a project folder and want to install all dependencies.
library(Seurat)
library(ggplot2)
library(dplyr)
```
# Load the data
```{r, message=FALSE, warning=F}
# Download data
download.file("https://www.dropbox.com/scl/fi/3ncxrapm374yk531m787f/Pre_P002_t.rds?rlkey=iv0afdro70cibv9wfa7ks67y4&dl=1",
file.path(path_data, "Pre_P002_t.rds"))
download.file("https://www.dropbox.com/scl/fi/i6g6jt2u65q028r3ndph3/P14_Post-Tx.rds?rlkey=5uq1svqljct67w3lrocfgknk4&dl=1",
file.path(path_data, "P14_Post-Tx.rds"))
obj.list <- list()
sample_study1 <- readRDS(file.path(path_data, "Pre_P002_t.rds"))
sample_study1 <- subset(sample_study1, downsample=500)
sample_study2 <- readRDS(file.path(path_data, "P14_Post-Tx.rds"))
sample_study2 <- subset(sample_study2, downsample=500)
obj.list[["study1_sample"]] <- sample_study1
obj.list[["study1_sample"]]$orig.ident <- "study1_sample"
obj.list[["study2_sample"]] <- sample_study2
obj.list[["study2_sample"]]$orig.ident <- "study2_sample"
obj.list[["study2_sample"]]@meta.data[["scGate_multi"]][which(obj.list[["study2_sample"]]@meta.data[["scGate_multi"]] == "CD8TIL")] <- "CD8T"
obj.list[["study2_sample"]]@meta.data[["scGate_multi"]][which(obj.list[["study2_sample"]]@meta.data[["scGate_multi"]] == "Bcell.NonGerminalCenter")] <- "Bcell"
saveRDS(obj.list, file=file.path(path_data, "samples_from_other_studies.rds"))
```