-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path02_IdentifyHumanBarcodes.R
32 lines (24 loc) · 1.81 KB
/
02_IdentifyHumanBarcodes.R
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
library(Seurat)
obj <- readRDS(file = "01_output/CellTagInt_Barnyard_UMAP.Rds")
human <- subset(obj, idents = c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "11", "14", "15", "16", "18", "19", "20"))
barcodes <- data.frame(barcodes = colnames(human))
for (i in 1:length(barcodes$barcodes)){
barcodes$arm[i] <- as.character(unlist(strsplit(as.character(barcodes$barcodes[i]), split = "_", fixed = TRUE))[1])
barcodes$newbarcodes[i] <- as.character(unlist(strsplit(as.character(barcodes$barcodes[i]), split = "_", fixed = TRUE))[2])
barcodes$transfer[i] <- as.character(unlist(strsplit(as.character(barcodes$barcodes[i]), split = "-", fixed = TRUE))[1])
}
DMSO_barcodes <- subset(barcodes, arm == "DMSO")
NM002_barcodes <- subset(barcodes, arm == "NM002")
DMSO_barcodes2 <- DMSO_barcodes[,c("newbarcodes")]
write.table(DMSO_barcodes2, file = "02_output/DMSO_hu_barcodes.tsv", sep = "\t", col.names = FALSE, row.names = FALSE, quote = FALSE)
NM002_barcodes2 <- NM002_barcodes[,c("newbarcodes")]
write.table(NM002_barcodes2, file = "02_output/NM002_hu_barcodes.tsv", sep = "\t", col.names = FALSE, row.names = FALSE, quote = FALSE)
write.csv(DMSO_barcodes, file = "02_output/DMSO_hu_barcodes.csv", row.names = FALSE)
write.csv(NM002_barcodes, file = "02_output/NM002_hu_barcodes.csv", row.names = FALSE)
################################################################################
################################################################################
################################################################################
print("Pipeline successfully completed...")
################################################################################
################################################################################
################################################################################