Skip to content

Commit 692eeb2

Browse files
docs(panel): sync parameter descriptions (#7)
* Update PCA count type options * Require PCA count type selection * Update PCA point size default * Update PCA label controls * Update vendored MOSuite plotting defaults * Revert "Update vendored MOSuite plotting defaults" This reverts commit 35f0257. * Sync MOSuite subtree to FigOutSync * chore(syncweaver): update MOSuite source to main _commit message is ai-generated_ * fix(pca): expose 2D PCA transform controls * docs(pca): clarify log transform guidance * docs(panel): sync parameter descriptions _commit message is ai-generated_ * docs(changelog): add PR entry * test: add syncweaver lock coverage * test: remove syncweaver lock tests * Update CHANGELOG.md * test: add script to test w/ podman * chore: bump MOSuite to v0.4.1 * test: remove redundant param tests --------- Co-authored-by: Kelly Sovacool <kelly.sovacool@nih.gov> Co-authored-by: Kelly Sovacool, PhD <kelly-sovacool@users.noreply.github.com>
1 parent 68932bb commit 692eeb2

4 files changed

Lines changed: 62 additions & 67 deletions

File tree

‎.codeocean/app-panel.json‎

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@
3636
"category": "EzTg1ivlFDHEy9PI",
3737
"name": "Count type",
3838
"param_name": "count_type",
39-
"description": "Type of counts to use (e.g., filt, norm)",
39+
"description": "The type of counts to use when plotting a multiOmicDataSet.",
4040
"type": "list",
4141
"value_type": "string",
42-
"default_value": "filt",
42+
"default_value": null,
43+
"required": true,
4344
"extra_data": [
4445
"raw",
4546
"clean",
4647
"filt",
47-
"norm"
48+
"norm",
49+
"batch"
4850
]
4951
},
5052
{
5153
"id": "group_colname_id",
5254
"category": "EzTg1ivlFDHEy9PI",
5355
"name": "Group column name",
5456
"param_name": "group_colname",
55-
"description": "Column name for sample groups",
57+
"description": "The column from the sample metadata containing the sample group information. This is usually a column showing to which experimental treatments each sample belongs, such as WildType, Knockout, Tumor, Normal, Before, or After.",
5658
"type": "text",
5759
"value_type": "string",
5860
"default_value": "Group"
@@ -62,7 +64,7 @@
6264
"category": "EzTg1ivlFDHEy9PI",
6365
"name": "Label column name",
6466
"param_name": "label_colname",
65-
"description": "Column name for sample labels",
67+
"description": "The column from the sample metadata containing the sample labels as you wish them to appear on the PCA plot. This can be the same Sample Names Column. You may select a different column with shorter labels for display on the figure. The selected column should contain unique names for each sample.",
6668
"type": "text",
6769
"value_type": "string",
6870
"default_value": "Label"
@@ -72,7 +74,7 @@
7274
"category": "7Rr6IxOMDucKMImp",
7375
"name": "Sub count type",
7476
"param_name": "sub_count_type",
75-
"description": "Sub count type if count_type is a list",
77+
"description": "Used when count_type refers to a list of count matrices.",
7678
"type": "text",
7779
"value_type": "string"
7880
},
@@ -81,7 +83,7 @@
8183
"category": "EzTg1ivlFDHEy9PI",
8284
"name": "Sample ID column name",
8385
"param_name": "sample_id_colname",
84-
"description": "Column name for sample IDs",
86+
"description": "The column from the sample metadata containing the sample names. The names in this column must exactly match the names used as sample column names in the input counts matrix.",
8587
"type": "text",
8688
"value_type": "string"
8789
},
@@ -90,7 +92,7 @@
9092
"category": "7Rr6IxOMDucKMImp",
9193
"name": "Samples to rename",
9294
"param_name": "samples_to_rename",
93-
"description": "Samples to rename in format old:new,old2:new2",
95+
"description": "Rename samples manually for display on the PCA plot. Use the format old_name:new_name.",
9496
"type": "text",
9597
"value_type": "string"
9698
},
@@ -99,7 +101,7 @@
99101
"category": "7Rr6IxOMDucKMImp",
100102
"name": "Principal components",
101103
"param_name": "principal_components",
102-
"description": "Principal components to plot (comma-separated, e.g., 1,2)",
104+
"description": "Vector with numbered principal components to plot. Use two principal components for a 2D PCA plot.",
103105
"type": "text",
104106
"value_type": "string",
105107
"default_value": "1,2"
@@ -109,7 +111,7 @@
109111
"category": "7Rr6IxOMDucKMImp",
110112
"name": "Feature ID column name",
111113
"param_name": "feature_id_colname",
112-
"description": "Column name for feature IDs",
114+
"description": "The column from the counts data containing the Feature IDs, usually Gene or Protein ID. This is usually the first column of the input counts matrix. Only columns of text type from the input counts matrix are available to select for this parameter.",
113115
"type": "text",
114116
"value_type": "string"
115117
},
@@ -118,7 +120,7 @@
118120
"category": "FvI4Z2eb9sjL47Jt",
119121
"name": "Legend position",
120122
"param_name": "legend_position",
121-
"description": "Position of the legend",
123+
"description": "Passed to legend.position in ggplot2::theme().",
122124
"type": "list",
123125
"value_type": "string",
124126
"default_value": "top",
@@ -129,36 +131,31 @@
129131
"right"
130132
]
131133
},
134+
{
135+
"id": "legend_font_size_id",
136+
"category": "FvI4Z2eb9sjL47Jt",
137+
"name": "Legend font size",
138+
"param_name": "legend_font_size",
139+
"description": "Font size for the PCA legend text. When no value is supplied, the size is scaled automatically based on the number and length of legend labels.",
140+
"type": "text",
141+
"value_type": "string"
142+
},
132143
{
133144
"id": "point_size_id",
134145
"category": "FvI4Z2eb9sjL47Jt",
135146
"name": "Point size",
136147
"param_name": "point_size",
137-
"description": "Size of points in plot",
148+
"description": "Size for ggplot2::geom_point().",
138149
"type": "text",
139150
"value_type": "string",
140-
"default_value": "3"
141-
},
142-
{
143-
"id": "add_label_id",
144-
"category": "FvI4Z2eb9sjL47Jt",
145-
"name": "Add labels",
146-
"param_name": "add_label",
147-
"description": "Whether to add labels to points",
148-
"type": "list",
149-
"value_type": "string",
150-
"default_value": "TRUE",
151-
"extra_data": [
152-
"TRUE",
153-
"FALSE"
154-
]
151+
"default_value": "5"
155152
},
156153
{
157154
"id": "label_font_size_id",
158155
"category": "FvI4Z2eb9sjL47Jt",
159156
"name": "Label font size",
160157
"param_name": "label_font_size",
161-
"description": "Font size for labels",
158+
"description": "Font size for text labels on the PCA plot.",
162159
"type": "text",
163160
"value_type": "string",
164161
"default_value": "3"
@@ -168,7 +165,7 @@
168165
"category": "FvI4Z2eb9sjL47Jt",
169166
"name": "Label offset X",
170167
"param_name": "label_offset_x_",
171-
"description": "X-axis offset for labels",
168+
"description": "Horizontal offset for text labels on the PCA plot.",
172169
"type": "text",
173170
"value_type": "string",
174171
"default_value": "2"
@@ -178,17 +175,31 @@
178175
"category": "FvI4Z2eb9sjL47Jt",
179176
"name": "Label offset Y",
180177
"param_name": "label_offset_y_",
181-
"description": "Y-axis offset for labels",
178+
"description": "Vertical offset for text labels on the PCA plot.",
182179
"type": "text",
183180
"value_type": "string",
184181
"default_value": "2"
185182
},
183+
{
184+
"id": "log_transform_id",
185+
"category": "7Rr6IxOMDucKMImp",
186+
"name": "Log transform counts",
187+
"param_name": "log_transform",
188+
"description": "Apply log(x + pseudocount) to sample count columns before PCA. Use this for count-like data such as raw, clean, filt, or CPM-like counts; leave FALSE for already normalized/log-scale or batch-corrected values to avoid double transformation.",
189+
"type": "list",
190+
"value_type": "string",
191+
"default_value": "FALSE",
192+
"extra_data": [
193+
"TRUE",
194+
"FALSE"
195+
]
196+
},
186197
{
187198
"id": "interactive_plots_id",
188199
"category": "FvI4Z2eb9sjL47Jt",
189200
"name": "Interactive plots",
190201
"param_name": "interactive_plots",
191-
"description": "Whether to create interactive plots",
202+
"description": "Set to TRUE to make the PCA plot interactive with plotly.",
192203
"type": "list",
193204
"value_type": "string",
194205
"default_value": "FALSE",
@@ -202,7 +213,7 @@
202213
"category": "FvI4Z2eb9sjL47Jt",
203214
"name": "Color values",
204215
"param_name": "color_values",
205-
"description": "Comma-separated group colors. Defaults to the MOSuite palette.",
216+
"description": "Vector of colors as hex values or names recognized by R. Unnamed colors are assigned by factor level order when the grouping column is a factor; otherwise, they follow the order in which groups first appear in the metadata column.",
206217
"help_text": "Use color names or hex codes. Supplied colors are used first; if there are more groups than colors, additional colors are generated from the MOSuite palette, with random colors only if that palette is too short.",
207218
"type": "text",
208219
"value_type": "string",

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Development version
44

5+
- Sync Code Ocean app panel parameter descriptions with MOSuite package documentation for MOSuite v0.4.1 (#7, @phoman14).
56
- Align the PCA color defaults with MOSuite package defaults (#2, @phoman14).
67
- Document that color palettes fall back to random colors only when too few colors are provided (#2, @phoman14).
78
- Improved the Code Ocean parameter UI for the plot pca 2D capsule (#1, @phoman14).

‎code/main.R‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ parser$add_argument(
6262
default = "top",
6363
help = "Position of the legend"
6464
)
65+
parser$add_argument(
66+
"--legend_font_size",
67+
type = "double",
68+
default = NULL,
69+
help = "Font size for legend text"
70+
)
6571
parser$add_argument(
6672
"--point_size",
6773
type = "double",
6874
default = 3,
6975
help = "Size of points in plot"
7076
)
71-
parser$add_argument(
72-
"--add_label",
73-
type = "logical",
74-
default = TRUE,
75-
help = "Whether to add labels to points"
76-
)
7777
parser$add_argument(
7878
"--label_font_size",
7979
type = "double",
@@ -92,6 +92,12 @@ parser$add_argument(
9292
default = 2,
9393
help = "Y-axis offset for labels"
9494
)
95+
parser$add_argument(
96+
"--log_transform",
97+
type = "logical",
98+
default = FALSE,
99+
help = "Log-transform counts before PCA"
100+
)
95101
parser$add_argument(
96102
"--interactive_plots",
97103
type = "logical",
@@ -124,11 +130,12 @@ plot_pca_2d(
124130
group_colname = args$group_colname,
125131
label_colname = args$label_colname,
126132
legend_position = args$legend_position,
133+
legend_font_size = args$legend_font_size,
127134
point_size = args$point_size,
128-
add_label = args$add_label,
129135
label_font_size = args$label_font_size,
130136
label_offset_x_ = args$label_offset_x_,
131137
label_offset_y_ = args$label_offset_y_,
138+
log_transform = args$log_transform,
132139
interactive_plots = args$interactive_plots,
133140
color_values = parse_optional_vector(args$color_values)
134141
)

‎tests/testthat/test-main.R‎

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,18 @@ test_that("Code Ocean panel uses named parameters accepted by main.R", {
1414
)
1515
})
1616

17-
test_that("2D PCA capsule keeps expected PCA parameter contract", {
17+
test_that("2D PCA capsule keeps expected PCA parameter defaults", {
1818
main_lines <- read_repo_file("code", "main.R")
1919
panel_lines <- read_repo_file(".codeocean", "app-panel.json")
2020

21-
shared_pca_args <- c(
22-
"count_type",
23-
"sub_count_type",
24-
"feature_id_colname",
25-
"sample_id_colname",
26-
"samples_to_rename",
27-
"group_colname",
28-
"label_colname",
29-
"principal_components",
30-
"point_size",
31-
"label_font_size",
32-
"color_values"
33-
)
34-
two_dimensional_args <- c(
35-
"legend_position",
36-
"add_label",
37-
"label_offset_x_",
38-
"label_offset_y_",
39-
"interactive_plots"
40-
)
41-
42-
expect_same_values(
43-
extract_main_arguments(main_lines),
44-
c(shared_pca_args, two_dimensional_args),
45-
info = "2D PCA main.R should expose shared PCA args plus 2D-specific controls"
46-
)
4721
expect_match(paste(main_lines, collapse = "\n"), "plot_pca_2d\\(")
4822
expect_equal(
4923
extract_panel_default(panel_lines, "principal_components"),
5024
"1,2"
5125
)
52-
expect_equal(extract_panel_default(panel_lines, "add_label"), "TRUE")
26+
expect_equal(extract_panel_default(panel_lines, "label_colname"), "Label")
27+
expect_true(is.na(extract_panel_default(panel_lines, "legend_font_size")))
28+
expect_equal(extract_panel_default(panel_lines, "log_transform"), "FALSE")
5329
expect_equal(extract_panel_default(panel_lines, "interactive_plots"), "FALSE")
5430
})
5531

0 commit comments

Comments
 (0)