@@ -16,9 +16,32 @@ sce <- readRDS(here(processed_dir, "sce_excit_final_subclusters_annotated.rds"))
1616
1717# subset to different species
1818sce_macaque <- sce [,which(colData(sce )$ species == " macaque" )]
19+ colnames(colData(sce_macaque ))
20+ sce_macaque $ Sample_num
21+
22+ # read in new sample labels
23+ new_labels <- read.csv(here(" raw-data" ," sampleinfo" , " relabeling_macaque_metadata.csv" ))
24+
25+ # add new Sample_num coldata that's Sample1 - Sample 35 --- to new_labels
26+ new_labels $ Sample_num <- paste0(" Sample" , 1 : 35 )
27+
28+ # make new coldata for "$Sample_num _ ONPRC.ID _ Region _ Dorsal.Ventral" to new_labels
29+ new_labels $ Final <- paste0(new_labels $ Sample_num , " _" , new_labels $ ONPRC.ID , " _" , new_labels $ Region , " _" , new_labels $ Dorsal.Ventral )
30+
31+
32+ # now merge this to sce_macaque coldata using new_label$Current.Label.in.Metadata to match with sce_macaque$Sample
33+ sce_macaque $ Sample <- factor (sce_macaque $ Sample )
34+ new_labels $ Current.Label.in.Metadata <- factor (new_labels $ Current.Label.in.Metadata )
35+ new_coldata <- merge(colData(sce_macaque ), new_labels , by.x = " Sample" , by.y = " Current.Label.in.Metadata" , all = TRUE )
36+
37+ # now replace coldata in sce_macaque with new_coldata
38+ colData(sce_macaque ) <- new_coldata
39+
40+
41+ library(dplyr )
1942
2043# Create the table
21- celltype_table <- table(sce_macaque $ fine_celltype , sce_macaque $ Sample , sce_macaque $ Subregion )
44+ celltype_table <- table(sce_macaque $ fine_celltype , sce_macaque $ Final , sce_macaque $ Subregion )
2245
2346# Convert the table to a data frame
2447df <- as.data.frame(celltype_table )
@@ -52,6 +75,13 @@ dev.off()
5275
5376
5477
78+
79+
80+
81+
82+
83+
84+
5585# ======= Baboon samples ========
5686
5787# subset to different species
0 commit comments