Skip to content

Commit

Permalink
sample name changes for proportion figures
Browse files Browse the repository at this point in the history
  • Loading branch information
MicTott committed Oct 16, 2024
1 parent ab36022 commit 537dc11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ sce_macaque <- sce[,which(colData(sce)$species == "macaque")]
colnames(colData(sce_macaque))
sce_macaque$Sample_num

sce_macaque$Subregion <- as.character(sce_macaque$Subregion) # Convert to character
sce_macaque$Subregion[sce_macaque$Subregion == "Accessory Basal"] <- "aBA" # Make the change
sce_macaque$Subregion <- as.factor(sce_macaque$Subregion) # Convert back to factor if needed


# read in new sample labels
new_labels <- read.csv(here("raw-data","sampleinfo", "relabeling_macaque_metadata.csv"))

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

# Create the stacked bar plot with facet wrap for subregion
png(here(plot_dir, "stackedbars_macaque_sample_by_celltype_subregion.png"), width = 8, height = 10, units = "in", res = 300)
png(here(plot_dir, "stackedbars_macaque_sample_by_celltype_subregion.png"), width = 6, height = 10, units = "in", res = 300)
ggplot(df, aes(x = Sample, y = Proportion, fill = CellType)) +
geom_bar(stat = "identity") +
labs(x = "Sample", y = "Proportion", fill = "Cell Type") +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ sce_macaque <- sce[,which(colData(sce)$species == "macaque")]
colnames(colData(sce_macaque))
sce_macaque$Sample_num

sce_macaque$Subregion <- as.character(sce_macaque$Subregion) # Convert to character
sce_macaque$Subregion[sce_macaque$Subregion == "Accessory Basal"] <- "aBA" # Make the change
sce_macaque$Subregion <- as.factor(sce_macaque$Subregion) # Convert back to factor if needed

# read in new sample labels
new_labels <- read.csv(here("raw-data","sampleinfo", "relabeling_macaque_metadata.csv"))

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

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

0 comments on commit 537dc11

Please sign in to comment.