Skip to content

Commit f99d92e

Browse files
authored
minor tweaks to sup fig 7 (#58)
1 parent bb49045 commit f99d92e

3 files changed

+174
-43
lines changed

7.figures/SupplementaryFigure_JUMPMitocheck_FeatureSpaceDifferences.ipynb

+144-27
Large diffs are not rendered by default.
Loading

7.figures/nbconverted/SupplementaryFigure_JUMPMitocheck_FeatureSpaceDifferences.r

+30-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ suppressPackageStartupMessages(library(patchwork))
33
suppressPackageStartupMessages(library(ggplot2))
44

55
# Load figure themes and colors
6-
source("figure_themes.R")
6+
source("figure_themes.r")
77

88
# Define function for loading data
99
load_process_data <- function(results_file_to_load, normalized_or_raw) {
@@ -129,18 +129,32 @@ areashape_boxplot <- (
129129

130130
areashape_boxplot
131131

132-
ks_zernike_highlight_df <- ks_test_df %>%
132+
head(ks_test_df)
133+
134+
ks_areashape_highlight_df <- ks_test_df %>%
133135
dplyr::mutate(
136+
areashape_or_not = ifelse(feature_group == "AreaShape", "AreaShape", "Other"),
134137
zernike_or_not = ifelse(measurement == "Zernike", "Zernike", "Other")
135138
)
136139

137-
ks_zernike_highlight_df$zernike_or_not <- factor(
138-
ks_zernike_highlight_df$zernike_or_not,
140+
ks_areashape_highlight_df$areashape_or_not <- factor(
141+
ks_areashape_highlight_df$areashape_or_not,
142+
levels = c("AreaShape", "Other")
143+
)
144+
145+
ks_areashape_highlight_df$zernike_or_not <- factor(
146+
ks_areashape_highlight_df$zernike_or_not,
139147
levels = c("Zernike", "Other")
140148
)
141149

150+
print(length(unique(
151+
ks_areashape_highlight_df %>%
152+
dplyr::filter(areashape_or_not == "AreaShape") %>%
153+
dplyr::pull(feature)
154+
)))
155+
142156
length(unique(
143-
ks_zernike_highlight_df %>%
157+
ks_areashape_highlight_df %>%
144158
dplyr::filter(zernike_or_not == "Zernike") %>%
145159
dplyr::pull(feature)
146160
))
@@ -152,10 +166,10 @@ custom_labeller <- function(value) {
152166

153167
variance_gg <- (
154168
ggplot(
155-
ks_zernike_highlight_df,
169+
ks_areashape_highlight_df,
156170
aes(x = mitocheck_variance, y = jump_variance)
157171
)
158-
+ geom_point(aes(color = feature_group), alpha = 0.01)
172+
+ geom_point(aes(color = areashape_or_not), alpha = 0.01)
159173
+ theme_bw()
160174
+ figure_theme
161175
+ theme(
@@ -186,18 +200,18 @@ variance_gg <- (
186200
variance_gg
187201

188202
custom_labeller <- function(value) {
189-
paste("AreaShape features with data type:", stringr::str_to_title(value))
203+
paste("Zernike features with data type:", stringr::str_to_title(value))
190204
}
191205

192-
variance_areashape_gg <- (
206+
variance_zernike_gg <- (
193207
ggplot(
194-
ks_zernike_highlight_df %>%
208+
ks_areashape_highlight_df %>%
195209
dplyr::filter(
196-
feature_group == "AreaShape"
210+
zernike_or_not == "Zernike"
197211
),
198212
aes(x = mitocheck_variance, y = jump_variance)
199213
)
200-
+ geom_point(alpha = 0.01, aes(color = zernike_or_not))
214+
+ geom_point(alpha = 0.01, color = "black")
201215
+ theme_bw()
202216
+ figure_theme
203217
+ theme(
@@ -223,16 +237,16 @@ variance_areashape_gg <- (
223237
)
224238
)
225239

226-
variance_areashape_gg
240+
variance_zernike_gg
227241

228242
sup_fig_gg <- (
229243
(
230244
full_summary_boxplot / areashape_boxplot
231245
) | (
232-
variance_gg / variance_areashape_gg
246+
variance_gg / variance_zernike_gg
233247
)
234-
) + plot_annotation(tag_levels = "A") + plot_layout(heights = c(1, 0.6))
248+
) + plot_annotation(tag_levels = list(c("A", "B", "C", ""))) + plot_layout(heights = c(1, 0.6))
235249

236-
ggsave(output_file, dpi = 500, height = 10, width = 13)
250+
ggsave(output_file, dpi = 500, height = 11, width = 13)
237251

238252
sup_fig_gg

0 commit comments

Comments
 (0)