Package: Battlefield 1.1.0

Jean-Philippe Villemin

Battlefield: Swiss-army toolkit for selecting niche fronts and invasive margins in spatial transcriptomics data

Battlefield is a Swiss-army toolkit originally developed to define and extract spatial spots from specific tissue regions—such as front regions, niche borders, invasive margins, and cluster interfaces—using spatial transcriptomics data or clustered tissue maps. It has since been extended to support trajectory selection and layer inspection, and now provides a collection of low-level utilities for spatial transcriptomics analysis. These utilities are primarily intended to be reused within higher-level analytical packages. It is designed to work with sequencing-based platforms such as Visium at several resolutions and Visium HD(binned).

Authors:Jean-Philippe Villemin [aut, cre], European Research Council [fnd]

Battlefield_1.1.0.tar.gz
Battlefield_1.1.0.zip(r-4.7)Battlefield_1.1.0.zip(r-4.6)Battlefield_1.1.0.zip(r-4.5)
Battlefield_1.1.0.tgz(r-4.6-any)Battlefield_1.1.0.tgz(r-4.5-any)
Battlefield_1.1.0.tar.gz(r-4.7-any)Battlefield_1.1.0.tar.gz(r-4.6-any)
Battlefield_1.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
Battlefield/json (API)
NEWS

# Install 'Battlefield' in R:
install.packages('Battlefield', repos = c('https://bioc.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/zhefrench/battlefield/issues

Pkgdown/docs site:https://zhefrench.github.io

Datasets:

On BioConductor:Battlefield-1.1.0(bioc 3.24)Battlefield-1.0.0(bioc 3.23)

sequencingsoftwaretranscriptomicsspatial

4.68 score 12 scripts 88 downloads 31 exports 32 dependencies

Last updated from:69a79b679b. Checks:1 NOTE, 9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
bioc-checksNOTE193
linux-devel-x86_64OK338
source / vignettesOK333
linux-release-x86_64OK376
macos-release-arm64OK273
macos-oldrel-arm64OK186
windows-develOK376
windows-releaseOK384
windows-oldrelOK345
wasm-releaseOK189

Exports:add_borders_to_speadd_layers_to_speadd_trajectories_to_speadjacent_endpointbresenham_linebuild_all_bordersbuild_all_coresbuild_one_linebuild_one_trajectorybuild_similar_trajectoriesclosest_spotcompute_centroidscount_all_inlaidscount_all_neighborhoodscount_inlaidcount_neighborhoodcreate_all_layerscreate_cluster_layersdetect_grid_typedirected_cluster_interface_pairsestimate_spot_spacingfilter_out_by_endpoint_clustersget_inlaid_spotsget_neighborhood_paramsget_neighborhood_spotspoint_segment_distance_vecremove_used_pointsselect_border_spotsselect_core_spotsshift_pointunit_normal_left

Dependencies:abindBiobaseBiocGenericscliDelayedArraydplyrgenericsGenomicRangesglueIRangeslatticelifecyclemagrittrMatrixMatrixGenericsmatrixStatspillarpkgconfigR6RANNrlangS4ArraysS4VectorsSeqinfoSparseArraySummarizedExperimenttibbletidyselectutf8vctrswithrXVector

Battlefield

Rendered fromBattlefield-Main.Rmdusingknitr::rmarkdownon May 29 2026.

Last update: 2026-02-27
Started: 2026-01-02

Readme and manuals

Help Manual

Help pageTopics
Add border or core spot selections to SpatialExperiment colDataadd_borders_to_spe
Add layer classifications to SpatialExperiment colDataadd_layers_to_spe
Add trajectory information to SpatialExperiment colDataadd_trajectories_to_spe
Pick a point adjacent to a selected endpoint, on a given side of a segmentadjacent_endpoint
Rasterize a line between two points using Bresenham's algorithmbresenham_line
Build border spots for all oriented cluster pairsbuild_all_borders
Build core spots for all oriented cluster pairsbuild_all_cores
Build a single line of spots along a segmentbuild_one_line
Select spots near a segment and order them along the segmentbuild_one_trajectory
Build parallel spot lines around a central segmentbuild_similar_trajectories
Find the closest spot to a target pointclosest_spot
Compute cluster centroids (mean x/y per cluster)compute_centroids
Count inlaid composition for all clusterscount_all_inlaids
Count neighborhood composition for all clusterscount_all_neighborhoods
Count inlaid composition within a source clustercount_inlaid
Count annotated spot types in the neighborhood of a cluster or pointcount_neighborhood
Create and visualize layers for multiple clusterscreate_all_layers
Create layer classification for spots in a clustercreate_cluster_layers
Detect the grid type (square vs hexagonal) from spatial coordinatesdetect_grid_type
Build all oriented cluster pairs (A -> B) and their directed_pair labelsdirected_cluster_interface_pairs
Estimate spot spacing from nearest-neighbor distancesestimate_spot_spacing
Filter lines by endpoint cluster membershipfilter_out_by_endpoint_clusters
Get inlaid spots within a source clusterget_inlaid_spots
Suggest neighborhood parameters based on detected grid typeget_neighborhood_params
Get neighborhood spots around a target cluster or pointget_neighborhood_spots
Point-to-segment distance (vectorized)point_segment_distance_vec
Remove rows whose rounded (x, y) coordinates have already been usedremove_used_points
Select border spots from cluster A that touch cluster B (and flag junctions)select_border_spots
Select core (non-interface) spots for a directed pairselect_core_spots
Shift a point along a given direction vectorshift_point
Compute the left unit normal of the directed segment A->Bunit_normal_left
Simulated Visium SpatialExperiment datasetvisium_simulated_spe
Simulated VisiumHD 16 µm binned SpatialExperiment datasetvisiumHD_16um_simulated_spe
Simulated VisiumHD 8 µm binned SpatialExperiment datasetvisiumHD_8um_simulated_spe