Development version distributed to lab members and collaborators for pre-release testing. The API is stable but not yet frozen; a formal 0.1.0 release will accompany the methods paper.
- Long-format sparse
data.tablestorage for cell-level ($cell.data) and edge-level ($edge.data) scores; memory footprint scales with dataset density rather than full matrix dimensions. score.normis proportional normalisation within cell (cell slot) or within edge (edge slot).$aggregationsslot holds named aggregation tables computed on demand; starts as an empty list and is populated byaggregate_NICHESObject()or the individualadd_neighborhood_edge_agg()andadd_neighborhood_composition()functions.- S3 methods:
print(),summary(),dim(),length(),[(edge subsetting). - Object attributes track
mode("spatial"or"nonspatial") andsample.col(name of the sample column, if any). - Neighborhood slots (
$neighborhood.cell.list,$neighborhood.edge.list,$neighborhood.meta) are always populated bycreate_NICHESObject()with fixed parameters (edge.filter.mode = "both_in_neighborhood",remove.autocrine = FALSE). Calladd_neighborhoods(overwrite = TRUE)to experiment with other combinations after construction.
- ConnectomeDB2025 is now the default database, bundled as pre-filtered
.rdaobjects for human, mouse, rat, and pig; no internet connection required. Callload_LRM_database()with no arguments to load human ConnectomeDB2025 pairs. - FANTOM5 bundled as pre-filtered
.rdaobjects for human, mouse, rat, and pig; no internet connection required. - OmniPath loaded for human, mouse, and rat (pig not supported by OmniPath).
Uses
OmnipathR::import_ligrecextra_interactions()when available, with a base-R REST fallback for resilience against upstream service outages (see Bug fixes below). - User-supplied data frames accepted directly with
ligand.colandreceptor.colarguments for non-standard column names.
create_Edgelist_Spatial()-- k-NN or radius-based spatial edges including autocrine self-loops; parallel via socket clusters.create_Edgelist_PseudoBulk()-- deterministic all-type-pairs edge list; no randomness.create_Edgelist_SamplingByType()-- type-stratified random sampling with reproducibleseedandmax.cellscap.
compute_CellToCell()-- universal per-edge LR scorer;"product"and"minimum"methods; multi-gene complexes handled via underscore delimiting (gene1_gene2). Returns a plain named list ($edges,$lr.meta) rather than a NICHESObject, to allow flexible downstream assembly.compute_PseudoBulk_Connectivity()-- type-pair aggregated scores returned as a plaindata.table; does not produce a NICHESObject.
- Single dispatcher routes to per-sample or single-sample internal branches
depending on
sample.col; the outer sample loop is always sequential while inner scoring uses the fulln.coresallocation. - Hard barcode-uniqueness error across samples; tip: prefix barcodes with
paste0(sample.id, "_", barcode)before calling. - Neighborhood slots are always populated at construction; no separate
add_neighborhoods()call required for the default configuration. - Two bundled datasets for immediate exploration and reproducible examples:
data(NICHESv2_inputs)(raw construction inputs) anddata(NICHESv2_example)(pre-built NICHESObject with neighborhood slots populated).
add_neighborhoods()/extract_neighborhoods()-- re-compute neighborhood slots with threeedge.filter.modeoptions:"both_in_neighborhood","any_in_neighborhood","central_cell_only". Useoverwrite = TRUEto replace the slots populated at construction.add_segmentation()-- attach ansfpolygon object to$segmentation; hard error on any missing barcode.add_cell_meta()-- fully replaces$cell.metawith the supplied table and rebuilds$edge.metaby default. The replacement is complete: columns present in the old$cell.metabut absent from the new table are dropped. The user is responsible for supplying all columns they wish to retain, including spatial coordinates. Hard error if any cell in$cell.listis missing from the new table.add_meta_column()-- appends or overwrites a single column in$cell.metafrom a named vector (names = cell barcodes) without disturbing other columns; emits a message if the column already exists; rebuilds$edge.metaby default.add_cell_rawcounts()-- adds acountcolumn to$cell.datafrom a user-supplied raw count matrix, for provenance. Non-negative integer checks are performed with warnings; pipeline continues regardless.merge_NICHESObjects()-- combine two or more NICHESObjects; hard errors on mode mismatch or duplicate barcodes; union strategy for gene and LRM lists.
extract_NICHESInputs_Seurat()-- compatible with Seurat V4 and V5; version detected by class inspection (inherits(assay, "Assay5")), not package version string.extract_NICHESInputs_AnnData()-- reads.h5adviarhdf5only; no Python, conda, basilisk, or zellkonverter required; requires R >= 4.2.
aggregate_NICHESObject()-- convenience wrapper that callsadd_neighborhood_edge_agg()and optionallyadd_neighborhood_composition()in one step; always fully recomputes and replaces both slots (Seurat convention).add_neighborhood_edge_agg()-- populates$aggregations$neighborhood.edge.agg: a sparse keyeddata.tableof per-(cell, LRM) directional scores classified into five categories (in, out, cross, self.autocrine, other.autocrine) with sum, mean, and conditional-mean statistics. Output table has 27 columns.add_neighborhood_composition()-- populates$aggregations$neighborhood.composition: a zero-filled keyeddata.tableof per-cell neighbor cell-type counts and proportions; spatial mode only.
"sampled"mode renamed to"nonspatial"across all functions, attributes, and documentation. Any code that checksattr(obj, "mode") == "sampled"must be updated to"nonspatial".Aggregate_CellToCell_Edges()removed. This legacy function has been deleted. Useaggregate_NICHESObject(),add_neighborhood_edge_agg(), andadd_neighborhood_composition()for all aggregation workflows.add_cell_meta()now fully replaces$cell.metarather than joining new columns onto the existing table. Code that relied on column preservation must be updated to supply a complete metadata table.load_LRM_database()default database changed from FANTOM5 to ConnectomeDB2025. Existing code that callsload_LRM_database()with no arguments will now load ConnectomeDB2025 human pairs instead of FANTOM5 human pairs. Passdb = "fantom5"explicitly to restore the previous behaviour.add_neighborhood_edge_agg():autocrinesplit intoself.autocrineandother.autocrine. The singleautocrinecategory has been replaced by two sub-categories.self.autocrinecaptures only the focal cell's own self-loop (count.self.autocrine is always 0 or 1 per (cell, LRM));other.autocrinecaptures self-loop edges of non-focal neighbor cells in the neighborhood. The output table now has 27 columns instead of 23. The following columns have been removed and must be updated in any downstream code:count.autocrine,score.autocrine.sum,score.autocrine.mean,score.autocrine.cmean.
- OmniPath loading no longer fails when ancillary services are down.
Ported from NICHESv1 (PR #72 / issue #70). Newer OmnipathR (>= ~3.17,
including 4.1.0) resolves the
organismargument throughOmnipathR::ncbi_taxid(), which builds an organism-name table by downloading and coalescing species lists from Ensembl, OMA, and UniProt. When one of those services is unreachable (e.g. omabrowser.org returning HTTP 502), that step aborts with"Can't combine..1and..3"even though the OmniPath interaction server itself is fine.load_LRM_database("omnipath")now first attempts the standard OmnipathR path (with its console logging muted) and, on failure, falls back to querying the OmniPath REST API directly with the known NCBI taxon id, bypassing the organism-name lookup. If both paths fail, an informative network error is raised. The fallback is base-R only (utils::download.file/utils::read.delim) and adds no new dependencies.
[.NICHESObjectdoes not propagate attributes. Subsetting a NICHESObject with[does not copymodeorsample.colattributes to the result. Fix is known and scheduled for 0.1.1.Aggregate_CellToCell_Edges()returning dense matrices is no longer a limitation -- the function has been removed and replaced with a sparse design inadd_neighborhood_edge_agg().
Development supported by the Raredon Lab, Yale University School of Medicine. NICHESv2 is the successor to the original NICHES package (Raredon et al.). Methods paper in preparation.