Skip to contents

A pre-generated example dataset for testing SVG detection methods. Contains 500 spots and 200 genes, with 50 known SVGs.

Format

A list with components:

counts

Integer matrix (200 genes × 500 spots) of raw counts

logcounts

Numeric matrix of log2(counts + 1)

spatial_coords

Numeric matrix (500 spots × 2) of x, y coordinates

gene_info

Data.frame with columns: gene, is_svg, pattern_type

Source

Simulated using simulate_spatial_data

Value

A list containing the example dataset (see Format section).

Examples

data(example_svg_data)
str(example_svg_data)
#> List of 5
#>  $ counts        : int [1:200, 1:500] 12 1 7 11 12 14 21 8 9 6 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:200] "gene_1" "gene_2" "gene_3" "gene_4" ...
#>   .. ..$ : chr [1:500] "spot_1" "spot_2" "spot_3" "spot_4" ...
#>  $ logcounts     : num [1:200, 1:500] 3.7 1 3 3.58 3.7 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:200] "gene_1" "gene_2" "gene_3" "gene_4" ...
#>   .. ..$ : chr [1:500] "spot_1" "spot_2" "spot_3" "spot_4" ...
#>  $ spatial_coords: num [1:500, 1:2] 0 4.08 8.16 12.24 16.33 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:500] "spot_1" "spot_2" "spot_3" "spot_4" ...
#>   .. ..$ : chr [1:2] "x" "y"
#>  $ gene_info     :'data.frame':	200 obs. of  3 variables:
#>   ..$ gene        : chr [1:200] "gene_1" "gene_2" "gene_3" "gene_4" ...
#>   ..$ is_svg      : logi [1:200] TRUE TRUE TRUE TRUE TRUE TRUE ...
#>   ..$ pattern_type: chr [1:200] "gradient" "gradient" "gradient" "gradient" ...
#>  $ params        :List of 7
#>   ..$ n_spots    : int 500
#>   ..$ n_genes    : num 200
#>   ..$ n_svg      : num 50
#>   ..$ grid_type  : chr "hexagonal"
#>   ..$ mean_counts: num 50
#>   ..$ dispersion : num 5
#>   ..$ seed       : num 42

# Run SVG detection
results <- CalSVG_MERINGUE(
    example_svg_data$counts,
    example_svg_data$spatial_coords
)
#> === CalSVG_MERINGUE ===
#>   Genes: 200
#>   Spots: 500
#>   Network: delaunay
#> Building spatial neighborhood network...
#>   Network: 1429 edges, avg 5.7 neighbors/spot
#> Computing Moran's I for each gene...
#>   Significant genes (p < 0.05): 54 raw, 50 adjusted
#> === Done ===

# Check accuracy
truth <- example_svg_data$gene_info$is_svg
detected <- results$p.adj < 0.05
table(truth, detected)
#>        detected
#> truth   FALSE TRUE
#>   FALSE   150    0
#>   TRUE      0   50