-
Notifications
You must be signed in to change notification settings - Fork 13
GiottoVisuals 0.2.14 #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GiottoVisuals 0.2.14 #122
Conversation
make aes_string2() an exported function
replace deprecated readGiottoInstructions() -> instructions()
Make changes recommended by BiocCheck::BiocCheck()
harmonize a param and refactor
run devtools::document
|
Caution Review failedThe pull request is closed. WalkthroughBumps package to 0.2.14 and R >= 4.5.0, exports Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant API as spatInSituPlotPoints
participant PL as Plot Assembler
participant IMG as .sissp_image
participant POL as .sissp_polygon
participant PTS as .sissp_points
participant THEME as .theme_remove_axes
participant ASPECT as .aspect_ratio
U->>API: call spatInSituPlotPoints(..., spat_enr_name, show_axes)
API->>PL: compute plot_order & prepare args
PL->>IMG: add image layer (if present)
PL->>POL: add polygon layer (if present)
PL->>PTS: add points layer (if present)
PL->>THEME: if show_axes == FALSE -> remove axes
PL->>ASPECT: apply aspect ratio handling
PL->>API: return assembled ggplot
API-->>U: ggplot object
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
man/ridgePlot.Rd (1)
98-100: Parameter name mismatch:scale_axisvsaxis_scaleThe usage block defines
scale_axis, but the argument section documentsaxis_scale. This inconsistency can confuse users and tools relying on docs. Please align the argument name in the\item{}block with the actual parameter (scale_axis) and regenerate the Rd.R/gg_annotation_raster.R (1)
136-155: Name collision betweenextargument andext()function will cause runtime error in default caseThe parameter
ext = NULLshadows theext()function from terra. When.guess_plot_extent()is called without anextargument (the default), control reaches line 145 and attempts to callext(gobject, ...)whereextresolves to the NULL parameter, not the global function.Per R's scoping rules, parameter names unconditionally mask identically named objects in outer scopes, and the actual call site at R/gg_info_layers.R:1473 does not supply an
extargument, confirming this code path is exercised.The fix is to namespace the
ext()function calls explicitly:.guess_plot_extent <- function( gobject, spat_unit = NULL, spat_loc_name = NULL, ext = NULL, ...) { - if (!is.null(ext)) ext <- ext(ext) # normalize to `SpatExtent` class + if (!is.null(ext)) ext <- terra::ext(ext) # normalize to `SpatExtent` class # if ext already given, directly return if (inherits(ext, "SpatExtent")) { return(ext) } # find extent from one of poly, spatlocs, points, in that order of pref - e <- ext( + e <- terra::ext( gobject, spat_unit = spat_unit, all_data = FALSE, verbose = FALSE, name = list(spatlocs = spat_loc_name), ... )man/spatInSituPlotPoints.Rd (1)
216-223: Fix example argument nameThe examples still pass
spat_enr_names, but the function now acceptsspat_enr_name. Running this example will throwunused argument 'spat_enr_names'. Please update the example call to match the new argument name.- spat_enr_names = "cluster_metagene", + spat_enr_name = "cluster_metagene",R/vis_spatial_in_situ.R (1)
79-87: Example still usesspat_enr_nameswhile the argument is nowspat_enr_nameThe public signature of
spatInSituPlotPoints()takesspat_enr_name(Line 120), but the example above still calls the function withspat_enr_names = "cluster_metagene"(Lines 79–87). That mismatch will cause an “unused argumentspat_enr_names” error when running examples.Please update the example (and any other user-facing docs) to use
spat_enr_nameso that examples remain runnable and consistent with the API.Also applies to: 120-121
🧹 Nitpick comments (9)
DESCRIPTION (1)
3-3: R version bump is correct, but CI runner must be updatedRequiring R (>= 4.5.0) is consistent with the 0.2.14 bump, but the current R-CMD-check job runs R 4.4.3, so installation fails before checks run. Consider updating the Actions workflow (or Bioc config) to use an R 4.5.x image so this PR can go green without loosening the dependency.
Also applies to: 26-26
R/aux_defaults.R (1)
429-431: Refactor of gradient helpers is formatting-onlyThe multi-line signatures for
.evaluate_color_gradient_divergent()and.evaluate_color_gradient_sequential()preserve argument order and are called with named parameters, so there’s no behavioral change—just improved readability.Also applies to: 476-478
man/spatDeconvPlot.Rd (1)
65-66: Minor wording nit inpie_scaledescriptionTo avoid the “mapping exists” grammar hiccup, consider rephrasing as e.g. “amount to scale the pie size if no radius mapping exists”. Purely a doc polish; behavior is unaffected.
man/spatDimPlot.Rd (1)
195-196: Rd line-wrapping changes only; semantics unchangedThe new line breaks for
spat_center_point_border_strokeanddim_background_colorkeep the same parameter meaning and just improve readability. If you touch this file again, you might consider correcting “border strike size” → “border stroke size”, but that’s purely editorial.Also applies to: 243-244
R/aux_output.R (1)
78-107: Commented-out helper and#.marker can be cleaned up or removedThe modified
plot_output_handler_read()block is entirely commented out, and the#.prefix on continuation lines (e.g., Line 100) looks like an editing artifact. It has no runtime impact but may confuse future readers.If this helper is not going to be revived soon, consider either deleting the block or cleaning up the comments (including the
#.prefix) to keep the file tidy.NEWS.md (1)
1-11: Consider adding a release date to the 0.2.14 header for consistencyPrevious sections include a date in the header (e.g.,
0.2.13 (2025/09/30)), whileGiottoVisuals 0.2.14currently omits it. Adding the date would keep the NEWS format consistent and make it easier to track releases chronologically.R/gg_settings.R (1)
29-40: Axis-removal helper looks good; ensureunit()is properly imported
.theme_remove_axes()correctly strips axes and panel border and zeros out margins, which fits the newshow_axesflow.One small thing to double-check:
unit()is used without namespace. Please ensuregrid::unitis imported in NAMESPACE (or callgrid::unit(...)) so this helper works without relying on accidental namespace leakage.R/vis_spatial_in_situ.R (2)
145-155: Newshow_axesparam and per-element plotting helpers look correct; consider guarding against emptyfeatsThe refactor that:
- Introduces
show_axeswith a default ofTRUEvia%null%(Line 213),- Builds a
plot_orderstack based onshow_image,show_polygon,plot_last, andfeats(Lines 215–225) with an early return when there is nothing to plot (Lines 226–229),- And delegates to
.sissp_image(),.sissp_polygon(), and.sissp_points()(Lines 232–303 and 343–517),is a nice cleanup and makes the rendering order explicit. The
show_axeshandling and subsequent.theme_remove_axes()call also align with the new helper.One edge case:
plot_orderuses!is.null(feats)as the condition for adding"points", sofeats = character(0)would still trigger the points branch and run.sissp_points(). Depending on howcombineFeatureData()/combineFeatureOverlapData()behave with an empty feature set, that may yield confusing warnings or errors.If empty
featsis not meaningful, consider normalizing it toNULLup front or adding alength(feats) > 0check when constructingplot_orderto avoid surprising behavior.Also applies to: 213-229, 232-303, 343-517
305-317: Centralized aspect ratio handling via.aspect_ratio()– verify behavior forcoord_fix_ratiovalues
spatInSituPlotPoints(),.spatInSituPlotHex_single(), and.spatInSituPlotDensity_single()now all delegate coordinate ratio handling to.aspect_ratio(plot, coord_fix_ratio)instead of managingcoord_fixeddirectly.This centralization is good for consistency and matches the NEWS entry about restoring
coord_fix_ratio = TRUEbehavior, but it does shift responsibility to.aspect_ratio. Please verify that.aspect_ratio:
- Correctly interprets
coord_fix_ratio = TRUEvs numeric ratios vsNULL,- Plays well with downstream theme settings and xlim/ylim,
- And preserves previous default behavior for existing callers.
If these semantics are already covered by tests, that’s sufficient; otherwise adding a small test matrix around typical
coord_fix_ratiosettings would be helpful.Also applies to: 327-328, 627-629, 897-899
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (24)
DESCRIPTION(2 hunks)NAMESPACE(1 hunks)NEWS.md(1 hunks)R/aux_defaults.R(2 hunks)R/aux_output.R(1 hunks)R/aux_visuals.R(4 hunks)R/gg_annotation_raster.R(1 hunks)R/gg_info_layers.R(0 hunks)R/gg_param.R(2 hunks)R/gg_settings.R(1 hunks)R/plot_dotplot.R(2 hunks)R/plot_ridge.R(2 hunks)R/plot_sankey.R(1 hunks)R/vis_spatial_gg.R(16 hunks)R/vis_spatial_in_situ.R(9 hunks)man/aes_string2.Rd(0 hunks)man/combine_aes.Rd(1 hunks)man/dot-spatInSituPlotDensity_single.Rd(1 hunks)man/gg_param.Rd(1 hunks)man/ridgePlot.Rd(2 hunks)man/spatDeconvPlot.Rd(1 hunks)man/spatDimPlot.Rd(2 hunks)man/spatFeatPlot2D.Rd(1 hunks)man/spatInSituPlotPoints.Rd(2 hunks)
💤 Files with no reviewable changes (2)
- man/aes_string2.Rd
- R/gg_info_layers.R
🧰 Additional context used
🪛 GitHub Actions: R-CMD-check-bioc
man/spatDimPlot.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/gg_settings.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/gg_annotation_raster.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/aux_defaults.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/dot-spatInSituPlotDensity_single.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/plot_dotplot.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/gg_param.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/spatInSituPlotPoints.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/ridgePlot.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/spatDeconvPlot.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/plot_sankey.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/vis_spatial_in_situ.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/aux_visuals.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/aux_output.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/combine_aes.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/gg_param.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/vis_spatial_gg.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
man/spatFeatPlot2D.Rd
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
DESCRIPTION
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
R/plot_ridge.R
[error] 1-1: R CMD build failed: this R is version 4.4.3, package 'GiottoVisuals' requires R >= 4.5.0. Package installation failed.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: macOS-latest (4.4)
- GitHub Check: windows-latest (4.4)
- GitHub Check: ubuntu-latest (4.4)
🔇 Additional comments (8)
R/plot_sankey.R (1)
249-253: No behavior change in+method; formatting onlyThe updated
stop()line keeps the same error text and control flow; change is purely stylistic and looks fine.man/ridgePlot.Rd (1)
56-57: Doc formatting changes look goodThe wrapped
ridge_alphadescription and the added comma in the example keep semantics the same and improve readability; no issues here.Also applies to: 116-116
NAMESPACE (1)
7-7: Exportingaes_string2aligns with NEWS and docsAdding
export(aes_string2)matches the documented intent to make this helper public; namespace wiring looks consistent. Just ensure downstream packages/scripts expecting it to be internal are aware of the new public API.man/dot-spatInSituPlotDensity_single.Rd (1)
32-33: Low-level density plot description: OKThe wrapped description for
.spatInSituPlotDensity_single()keeps the meaning intact and doesn’t affect usage; looks fine.man/spatFeatPlot2D.Rd (1)
124-125:scale_alpha_with_expressiondoc wrapping is fineThe updated line break for
scale_alpha_with_expressionkeeps the description clear and consistent with the parameter’s behavior.R/plot_ridge.R (1)
15-16: Roxygen/doc tweaks forridge_alphaand examples look goodThe clarified
ridge_alphadescription and minor example formatting (trailing comma onexpression_values) are syntactically valid and align with the existing function defaults and behavior.Also applies to: 38-39
man/gg_param.Rd (1)
83-85: Example formatting change is purely cosmeticMoving the comment onto its own line above
p_nest_subimproves readability without affecting the example’s behavior.R/plot_dotplot.R (1)
253-265: Signature and data.table formatting changes preserve behaviorThe
.dplot_singleargument list, thedsize/dcolsummaries, and the cluster reordering logic are all semantically unchanged; only line breaks/indentation moved. No functional regressions detected.Also applies to: 286-288
for spat in situ, spatplot and spatfeatplot 2d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
R/vis_spatial_in_situ.R (3)
213-229: Behavior change when nothing is selected to plotThe new
plot_orderconstruction and early return whenlength(plot_order) == 0Lis a nice guard against doing unnecessary work. However, this also means the function now returnsinvisible(NULL)when there is nothing to draw, instead of an empty ggplot (if that was the previous behavior).If callers expect a ggplot object even in degenerate cases (e.g. for piping or type checks), consider returning an empty
ggplot2::ggplot()instead ofinvisible(), or documenting thatNULLis returned when no elements are requested.
326-328: Centralizing coord ratio via.aspect_ratio()Replacing any direct coord-fixed usage here with
.aspect_ratio(plot, coord_fix_ratio)aligns this function with the new centralized aspect-ratio handling. Assuming.aspect_ratio()is implemented to no-op onNULLand apply the appropriate coord transform for non-NULLratios, this is a nice normalization.Please just confirm that
.aspect_ratio()preserves the previous default behavior whencoord_fix_ratio = 1.
343-371:.sissp_image: cropping behavior with partial limitsThe helper correctly derives an
extonly when bothxlimandylimare provided and otherwise delegates extent choice toplot_spat_image_layer_ggplot. Given thatxlim/ylimare still applied later at the ggplot scale level, the behavior is coherent.If you want image-level cropping to respect a single-sided limit (only
xlimor onlyylim), you might consider extending theextconstruction to handle those partial cases; otherwise, the current implementation is fine and safe.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
R/plot_ridge.R(2 hunks)R/vis_spatial_in_situ.R(10 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- R/plot_ridge.R
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: windows-latest (4.4)
- GitHub Check: ubuntu-latest (4.4)
- GitHub Check: macOS-latest (4.4)
- GitHub Check: R CMD Check
- GitHub Check: windows-latest (4.4)
- GitHub Check: ubuntu-latest (4.4)
- GitHub Check: macOS-latest (4.4)
🔇 Additional comments (7)
R/vis_spatial_in_situ.R (7)
79-87: Roxygen example update matchesspat_enr_nameAPIThe example now uses
spat_enr_name = "cluster_metagene", which aligns with the function signature and enrichment handling in this file. No issues here.
103-155: Public API additions (spat_enr_name,show_axes) look consistentAdding
spat_enr_nameto the signature and wiring it into the polygon path, plus exposingshow_axeshere and using it later for theme control, is coherent with the documented behavior and examples. Assuming the shared roxygen templates (plot_spatenr_params, etc.) document these arguments, the surface looks good.
232-303: Modular per-element helpers are cleanly wiredThe closures
img_fun,poly_fun, andpt_funpre-binding the relevant arguments into.sissp_image,.sissp_polygon, and.sissp_pointsmakeplot_order-based assembly straightforward and more maintainable. The element selection viaswitch(elem, ...)and sequential accumulation intoplotis clear and idiomatic for this use case.No functional issues stand out in this block.
305-317:show_axeshandling is straightforward and backward-compatible by defaultPassing axis/theme parameters via
gg_theme_argsand only applying.theme_remove_axes(plot)when!show_axesis a simple and clear way to gate axis removal. Withshow_axesnormalized earlier (show_axes <- show_axes %null% TRUE), existing callers that didn’t know about this parameter will continue to see axes, while users can explicitly turn them off.Looks good.
373-454:.sissp_polygon: enrichment wiring and polygon assembly look correct
- Defaulting
polygon_feat_typeandfeat_typeviaset_default_spat_unit()/set_default_feat_type()is consistent with the rest of the file.combineCellData(..., remove_background_polygon, xlim, ylim)followed byrbindlistproduces a single polygon table suitable for plotting.- The enrichment path where
polygon_fillis not already present and you fetch viaspatValues(..., spat_enr_name = spat_enr_name, ...), then merge bycell_IDand rename topoly_ID, lines up with the exposedspat_enr_nameparameter and the downstreamplot_cell_polygon_layer()call.This helper is cohesive and appears functionally sound.
628-629: Hexbin aspect ratio now uses.aspect_ratio()Switching to
.aspect_ratio(plot, coord_fix_ratio)in.spatInSituPlotHex_single()matches the new pattern established above and in the density helper. This should make future aspect-ratio changes easier to maintain from a single place.Assuming
.aspect_ratio()faithfully reproduces the oldcoord_fixedsemantics for non-NULLratios, this looks correct.
814-815: Density helper docs and aspect ratio update are aligned
- The roxygen description tweak for
.spatInSituPlotDensity_single()is fine.- Using
.aspect_ratio(plot, coord_fix_ratio)in place of inline coord handling brings the density path in line with the rest of the API.Same as for hexbin, just confirm that
.aspect_ratio()behaves as expected acrosscoord_fix_ratio = NULLand non-NULLcases.Also applies to: 898-899
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
man/ridgePlot.Rd(2 hunks)man/spatInSituPlotPoints.Rd(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- man/ridgePlot.Rd
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: ubuntu-latest (4.4)
- GitHub Check: windows-latest (4.4)
- GitHub Check: macOS-latest (4.4)
- GitHub Check: R CMD Check
- GitHub Check: windows-latest (4.4)
- GitHub Check: ubuntu-latest (4.4)
🔇 Additional comments (2)
man/spatInSituPlotPoints.Rd (2)
218-218: LGTM!The example has been correctly updated to use the renamed parameter
spat_enr_name, ensuring consistency with the function signature.
24-24: Verify that all references to the old parameter name have been updated.The parameter has been renamed from
spat_enr_names(plural) tospat_enr_name(singular), which is a breaking API change. Ensure that all code, documentation, and examples using the old name have been updated.Run the following script to check for any remaining references to the old parameter name:
| ylim = NULL, | ||
| remove_background_polygon = TRUE, | ||
| spat_enr_names = NULL, | ||
| spat_enr_name = NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document the missing parameters in the arguments section.
Both spat_enr_name (line 24) and show_axes (line 49) are present in the function signature but lack corresponding \item{} entries in the arguments section (lines 62-176). All public parameters should be documented for users to understand their purpose and usage.
Add documentation entries for these parameters. For example:
+\item{spat_enr_name}{name of spatial enrichment results to use for polygon fill}
+
+\item{show_axes}{logical. Whether to display plot axes. When NULL (default),
+axes behavior is determined by theme settings}Also applies to: 49-49
Summary by CodeRabbit
New Features
Bug Fixes
Changes
✏️ Tip: You can customize this high-level summary in your review settings.