Skip to content

Commit

Permalink
Numerical ordering of PCs in scree plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Vera N. Karlbauer committed Nov 4, 2023
1 parent 7a5fffb commit db6fd31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions scripts/10_correction_batch_effects_unfiltered.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if (correction_variable_1 == "PLEASE FILL IN"){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -237,7 +237,7 @@ if (correction_variable_2 == "PLEASE FILL IN"){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -396,7 +396,7 @@ if (correction_variable_3 == "PLEASE FILL IN"){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down
16 changes: 8 additions & 8 deletions scripts/8_removal_of_outliers_detect_batch_effects.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ variance_explained <- data.frame(PC = paste0("PC",1:ncol(PCs)),
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -209,7 +209,7 @@ saveRDS(PCA_object, paste0(user_choices$project_name, "/reports/PCA_object_filte
pdf(paste0(user_choices$project_name, "/reports/PCA_screeplot_filtered.pdf"))
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -252,7 +252,7 @@ if(!identical(extreme_outliers_filtered %>% pull(personid),character(0))){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -344,7 +344,7 @@ if(!identical(extreme_outliers_filtered %>% pull(personid),character(0))){
pdf(paste0(user_choices$project_name, "/reports/PCA_screeplot_filtered_no_outliers.pdf"))
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -463,7 +463,7 @@ variance_explained <- data.frame(PC = paste0("PC",1:ncol(PCs)),
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -555,7 +555,7 @@ saveRDS(PCA_object, paste0(user_choices$project_name, "/reports/PCA_object_unfil
pdf(paste0(user_choices$project_name, "/reports/PCA_screeplot_unfiltered.pdf"))
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -599,7 +599,7 @@ if(!identical(extreme_outliers_unfiltered %>% pull(personid),character(0))){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -691,7 +691,7 @@ if(!identical(extreme_outliers_unfiltered %>% pull(personid),character(0))){
pdf(paste0(user_choices$project_name, "/reports/PCA_screeplot_unfiltered_no_outliers.pdf"))
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down
6 changes: 3 additions & 3 deletions scripts/9_correction_batch_effects_filtered.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if (correction_variable_1 == "PLEASE FILL IN"){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -247,7 +247,7 @@ if (correction_variable_2 == "PLEASE FILL IN"){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down Expand Up @@ -406,7 +406,7 @@ if (correction_variable_3 == "PLEASE FILL IN"){
variance_explained %>%
dplyr::slice(1:10) %>%
ggplot(aes(x = PC, y = var_explained, group = 1)) +
ggplot(aes(x = factor(PC, level = PC), y = var_explained, group = 1)) +
geom_point() +
geom_line() +
geom_text(aes(label = cumm_var_explained), vjust = 1.5) +
Expand Down

0 comments on commit db6fd31

Please sign in to comment.