Skip to content

Commit 537dc11

Browse files
committed
sample name changes for proportion figures
1 parent ab36022 commit 537dc11

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

code/07_annotation_and_characterization/11_sample_proportions_inhibitory.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ sce_macaque <- sce[,which(colData(sce)$species == "macaque")]
1919
colnames(colData(sce_macaque))
2020
sce_macaque$Sample_num
2121

22+
sce_macaque$Subregion <- as.character(sce_macaque$Subregion) # Convert to character
23+
sce_macaque$Subregion[sce_macaque$Subregion == "Accessory Basal"] <- "aBA" # Make the change
24+
sce_macaque$Subregion <- as.factor(sce_macaque$Subregion) # Convert back to factor if needed
25+
26+
2227
# read in new sample labels
2328
new_labels <- read.csv(here("raw-data","sampleinfo", "relabeling_macaque_metadata.csv"))
2429

@@ -60,7 +65,7 @@ colors <- pals::cols25()[1:18]
6065
celltype_colors <- setNames(colors, unique(df$CellType))
6166

6267
# Create the stacked bar plot with facet wrap for subregion
63-
png(here(plot_dir, "stackedbars_macaque_sample_by_celltype_subregion.png"), width = 8, height = 10, units = "in", res = 300)
68+
png(here(plot_dir, "stackedbars_macaque_sample_by_celltype_subregion.png"), width = 6, height = 10, units = "in", res = 300)
6469
ggplot(df, aes(x = Sample, y = Proportion, fill = CellType)) +
6570
geom_bar(stat = "identity") +
6671
labs(x = "Sample", y = "Proportion", fill = "Cell Type") +

code/07_annotation_and_characterization/12_sample_proportions_excitatory.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ sce_macaque <- sce[,which(colData(sce)$species == "macaque")]
1919
colnames(colData(sce_macaque))
2020
sce_macaque$Sample_num
2121

22+
sce_macaque$Subregion <- as.character(sce_macaque$Subregion) # Convert to character
23+
sce_macaque$Subregion[sce_macaque$Subregion == "Accessory Basal"] <- "aBA" # Make the change
24+
sce_macaque$Subregion <- as.factor(sce_macaque$Subregion) # Convert back to factor if needed
25+
2226
# read in new sample labels
2327
new_labels <- read.csv(here("raw-data","sampleinfo", "relabeling_macaque_metadata.csv"))
2428

@@ -62,7 +66,7 @@ colors <- colorRampPalette(brewer.pal(9, "Set1"))(nb.cols)
6266
celltype_colors <- setNames(colors, unique(df$CellType))
6367

6468
# Create the stacked bar plot with facet wrap for subregion
65-
png(here(plot_dir, "stackedbars_macaque_sample_by_excit_subregion.png"), width = 8, height = 10, units = "in", res = 300)
69+
png(here(plot_dir, "stackedbars_macaque_sample_by_excit_subregion.png"), width = 6, height = 10, units = "in", res = 300)
6670
ggplot(df, aes(x = Sample, y = Proportion, fill = CellType)) +
6771
geom_bar(stat = "identity") +
6872
labs(x = "Sample", y = "Proportion", fill = "Cell Type") +

0 commit comments

Comments
 (0)