Skip to contents

Visualizes phenotype prediction scores in spatial coordinates and highlights spatial units with statistically significant scores based on permutation-derived null distributions.

Usage

PhenotypePlot(coordinate, prediction, permutation, size = 1, p = 0.01)

Arguments

coordinate

A data.frame or matrix with two columns (x, y). Row names should match prediction order.

prediction

A numeric vector of phenotype prediction scores for each spatial unit.

permutation

A numeric vector from the permutation null distribution.

size

Numeric; point size in the spatial plot. Default is 1.

p

Numeric; two-sided significance level (between 0 and 1). Default is 0.01.

Value

A combined ggplot2 visualization with spatial points and a legend, rendered using gridExtra::grid.arrange.

Details

Points with scores above the upper threshold (top 1 - p) are shown in shades of red, and those below the lower threshold (bottom p) in shades of blue. Non-significant points are shown in gray. A separate side legend visualizes the score gradient and labels for phenotype interpretation.

Author

Bin Duan

Examples

if (FALSE) { # \dontrun{
set.seed(123)
coords <- data.frame(x = runif(100), y = runif(100))
pred <- rnorm(100)
perm <- rnorm(1000)
PhenotypePlot(coords, pred, perm)
} # }