Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
^demo-scripts$
^package management$
^LICENSE\.md$
^vignettes/articles$

26 changes: 25 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,31 @@
"Bash(Rscript --vanilla -e 'load\\(\"/Users/nw426/Documents/GitHub/NICHESv2-NW/data/NICHESv2_inputs.rda\"\\); print\\(NICHESv2_inputs$LRM.db[1:5,]\\); print\\(colnames\\(NICHESv2_inputs$LRM.db\\)\\); print\\(rownames\\(NICHESv2_inputs$count.mtx\\)[1:6]\\)')",
"Bash(rsync -a --delete --exclude .git --exclude demo-scripts --exclude working-scripts-* --exclude omnipathr-log --exclude .claude /Users/nw426/Documents/GitHub/NICHESv2-NW/ /private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/copy/NICHESv2/)",
"Bash(Rscript --vanilla -e 'devtools::document\\(\"/private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/copy/NICHESv2\", quiet=TRUE\\)')",
"Bash(bash /private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/verify.sh)"
"Bash(bash /private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/verify.sh)",
"Bash(Rscript --vanilla -e 'for \\(p in c\\(\"stxBrain.SeuratData\",\"ifnb.SeuratData\",\"SeuratData\"\\)\\) { d <- packageDescription\\(p\\); cat\\(\"=====\",p,\"\\\\n\"\\); for \\(f in c\\(\"Version\",\"License\",\"Title\",\"Description\",\"Author\",\"Maintainer\",\"URL\",\"Repository\",\"RemoteUrl\"\\)\\) if \\(!is.null\\(d[[f]]\\)\\) cat\\(f,\":\",d[[f]],\"\\\\n\"\\); pth <- system.file\\(package=p\\); print\\(list.files\\(pth\\)\\); lic <- list.files\\(pth, pattern=\"LICEN|COPY\", ignore.case=TRUE, full.names=TRUE\\); for \\(l in lic\\) { cat\\(\"--\",basename\\(l\\),\"\\\\n\"\\); cat\\(head\\(readLines\\(l,warn=FALSE\\),6\\),sep=\"\\\\n\"\\) } }; help_txt <- function\\(p, topic\\) { db <- tools::Rd_db\\(p\\); nm <- grep\\(topic, names\\(db\\), value=TRUE\\)[1]; if \\(is.na\\(nm\\)\\) { cat\\(\"no Rd for\",topic,\"\\\\n\"\\); return\\(invisible\\(\\)\\) }; out <- capture.output\\(tools::Rd2txt\\(db[[nm]], options=list\\(underline_titles=FALSE\\)\\)\\); cat\\(out, sep=\"\\\\n\"\\) }; help_txt\\(\"stxBrain.SeuratData\",\"stxBrain\"\\); help_txt\\(\"ifnb.SeuratData\",\"ifnb\"\\)')",
"Bash(Rscript --vanilla -e 'p <- \"ifnb.SeuratData\"; db <- tools::Rd_db\\(p\\); for \\(n in names\\(db\\)\\) { o <- capture.output\\(tools::Rd2txt\\(db[[n]], options=list\\(underline_titles=FALSE\\)\\)\\); cat\\(o, sep=\"\\\\n\"\\) }; cit <- system.file\\(\"CITATION\", package=p\\); cat\\(\"--- CITATION\\\\n\"\\); cat\\(readLines\\(cit, warn=FALSE\\), sep=\"\\\\n\"\\); print\\(list.files\\(system.file\\(\"extdata\", package=p\\)\\)\\)')",
"WebFetch(domain:www.10xgenomics.com)",
"WebFetch(domain:www.ncbi.nlm.nih.gov)",
"WebFetch(domain:www.nature.com)",
"WebFetch(domain:bioconductor.org)",
"WebFetch(domain:creativecommons.org)",
"Bash(curl -s -m 25 \"https://www.10xgenomics.com/support/software/space-ranger/latest/resources/citation-guidelines\" -o /dev/null -w \"%{http_code}\\\\n\")",
"Bash(curl -s -m 25 -L \"https://raw.githubusercontent.com/satijalab/seurat-data/master/README.md\")",
"Bash(curl -s -m 25 -I \"https://seurat.nygenome.org/src/contrib/PACKAGES\")",
"WebFetch(domain:www.ebi.ac.uk)",
"Bash(git -C /Users/nw426/Documents/GitHub/NICHESv2-NW show HEAD:vignettes/spatial.Rmd)",
"Bash(grep -v \"^$\")",
"Bash(git -C /Users/nw426/Documents/GitHub/NICHESv2-NW log --oneline -n 3)",
"Bash(git -C /Users/nw426/Documents/GitHub/NICHESv2-NW show 4bf87c9:vignettes/spatial.Rmd)",
"Bash(Rscript --vanilla /private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/cols.R)",
"Bash(xargs -n1 basename)",
"Bash(python3 -I - /private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/site/articles)",
"Bash(D=/Users/nw426/Desktop/NICHESv2; ls -la \"$D\" | cut -c30- | head -n 40; echo ---; du -sh \"$D\" 2>/dev/null | cut -f1; find \"$D\" -type f 2>/dev/null | wc -l; find \"$D\" -type f 2>/dev/null | sed -E 's/.*\\\\.\\([A-Za-z0-9]+\\)$/\\\\1/' | tr 'A-Z' 'a-z' | sort | uniq -c | sort -rn | head -n 20; echo ---dirs; find \"$D\" -maxdepth 2 -type d 2>/dev/null | sed \"s#$D#.#\" | head -n 40)",
"Bash(Rscript --vanilla -e 'cat\\(\"R\", as.character\\(getRversion\\(\\)\\), \"\\\\nknitr\", as.character\\(packageVersion\\(\"knitr\"\\)\\), \"\\\\nxfun\", as.character\\(packageVersion\\(\"xfun\"\\)\\), \"\\\\nrmarkdown\", as.character\\(packageVersion\\(\"rmarkdown\"\\)\\), \"\\\\n\"\\); ap <- available.packages\\(repos=\"https://cloud.r-project.org\"\\); print\\(ap[c\\(\"knitr\",\"xfun\",\"rmarkdown\"\\),c\\(\"Version\",\"Depends\"\\)]\\); b <- tryCatch\\(available.packages\\(type=\"binary\", repos=\"https://cloud.r-project.org\"\\), error=function\\(e\\) NULL\\); if\\(!is.null\\(b\\)\\) print\\(b[intersect\\(c\\(\"knitr\",\"xfun\"\\),rownames\\(b\\)\\),\"Version\"]\\); x <- body\\(knitr::kable\\); f <- ls\\(asNamespace\\(\"knitr\"\\)\\); hit <- f[sapply\\(f, function\\(n\\) {g <- get\\(n, asNamespace\\(\"knitr\"\\)\\); is.function\\(g\\) && any\\(grepl\\(\"xfun::attr\\\\\\\\\\(|attr\\\\\\\\s*=\\\\\\\\s*xfun\", deparse\\(g\\)\\)\\)}\\)]; print\\(hit\\)')",
"Bash(Rscript -e 'print\\(utils::packageVersion\\(\"pkgdown\"\\)\\); print\\(pkgdown:::package_mds\\); print\\(pkgdown:::build_home_md\\)')",
"Bash(Rscript -e 'a <- available.packages\\(repos=\"https://cloud.r-project.org\"\\); print\\(a[c\\(\"pkgdown\",\"knitr\",\"Seurat\",\"SeuratObject\"\\),\"Version\"]\\); for \\(p in c\\(\"Seurat\",\"SeuratObject\",\"SeuratData\",\"rmarkdown\",\"knitr\"\\)\\) cat\\(p, as.character\\(utils::packageVersion\\(p\\)\\), \"\\\\n\"\\); print\\(unname\\(sapply\\(\"repo\", function\\(x\\) getOption\\(\"SeuratData.repo.use\"\\)\\)\\)\\)')",
"Bash(Rscript -e 'library\\(SeuratData\\); print\\(getOption\\(\"SeuratData.repo.use\"\\)\\); print\\(utils::packageDescription\\(\"SeuratData\"\\)[c\\(\"Version\",\"RemoteType\",\"RemoteRepo\",\"RemoteUsername\",\"Repository\"\\)]\\)')",
"Bash(rsync -a --delete /private/tmp/claude-234134544/-Users-nw426-Documents-GitHub-NICHESv2-NW/8e8dd3a1-059b-4622-99f2-f5ba283c1906/scratchpad/siteci/ docs/)"
]
}
}
69 changes: 69 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# .github/workflows/pkgdown.yaml
#
# Builds the website and publishes it to the gh-pages branch on every push to
# main. The tutorials really run here, so each build installs SeuratData and
# downloads both public test datasets. A failed build publishes nothing, and the
# live site stays as it was.
#
# To test a build without publishing it, start this workflow by hand from the
# Actions tab on any other branch.

on:
push:
branches: [main]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} # auto-generated per run

permissions:
contents: write # lets the last step publish

steps:
# Step 1: clone the repository onto the runner machine
- uses: actions/checkout@v4

# Step 2: install Pandoc (builds the pages) and R
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

# Step 3: install this package, everything in DESCRIPTION, and the tools
# the website needs. SeuratData isn't on CRAN, so it comes from GitHub.
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::pkgdown
local::.
github::satijalab/seurat-data

# Step 4: download the test datasets the tutorials use
- name: Install test datasets
run: SeuratData::InstallData(c("stxBrain", "ifnb"))
shell: Rscript {0}

# Step 5: build the site
# pkgdown turns every Markdown file in the top folder into a page, so
# the project notes in CLAUDE.md are removed from this checkout first.
- name: Build site
run: |
file.remove("CLAUDE.md")
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

# Step 6: publish, from main only
- name: Publish to gh-pages
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
folder: docs
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ Custom data frames are also accepted; must have `ligand` and `receptor` columns
- `inst/extdata/` — `NICHESv2_example.h5ad`, a small synthetic file used by the AnnData example
- `data-raw/` — scripts that build the bundled data files; excluded from package build
- `tests/testthat/` — one test file per source file; `helper-testutils.R` provides shared fixtures
- `vignettes/` — one vignette, `NICHESv2.Rmd`, which runs on bundled data
- `vignettes/` — one vignette, `NICHESv2.Rmd`, which runs on bundled data; `vignettes/articles/` holds the website pages and is excluded from the package build
- `.github/workflows/` — `R-CMD-check.yaml` runs the checks; `pkgdown.yaml` builds the website and publishes it from `main`, removing this file first because pkgdown turns top-level Markdown files into pages
- `demo-scripts/` — standalone R scripts demonstrating real-dataset usage (not part of the package build)
- `working-scripts-MSBR/` and `working-scripts-NW/` — exploratory and prototyping scripts; not part of the package
- `package management/` — design documents
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Description: Computes ligand-receptor (LR) signaling scores between pairs of
multi-gene complex ligands and receptors. Built-in loaders are provided for
the ConnectomeDB2025 (default), FANTOM5, and OmniPath LR databases.
License: MIT + file LICENSE
URL: https://github.com/RaredonLab/NICHESv2
URL: https://raredonlab.github.io/NICHESv2/,
https://github.com/RaredonLab/NICHESv2
BugReports: https://github.com/RaredonLab/NICHESv2/issues
Encoding: UTF-8
Language: en-US
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export(add_neighborhoods)
export(add_segmentation)
export(aggregate_NICHESObject)
export(compute_CellToCell)
export(compute_PseudoBulk_Connectivity)
export(create_Edgelist_PseudoBulk)
export(create_Edgelist_SamplingByType)
export(create_Edgelist_Spatial)
export(create_NICHESObject)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ First public release.
methods.
- `aggregate_NICHESObject()` summarizes each cell's neighborhood by LR pair and,
in spatial mode, by neighboring cell type.
- `compute_PseudoBulk_Connectivity()` scores each pair of cell types.
- `load_LRM_database()` provides ConnectomeDB2025 (default) and FANTOM5, both
bundled for human, mouse, rat and pig, and OmniPath for human, mouse and rat.
- `extract_NICHESInputs_Seurat()` and `extract_NICHESInputs_AnnData()` read
Expand All @@ -39,6 +38,9 @@ First public release.
- Mode `"sampled"` is now `"nonspatial"`.
- `Aggregate_CellToCell_Edges()` has been removed. Use
`aggregate_NICHESObject()`.
- `compute_PseudoBulk_Connectivity()` and `create_Edgelist_PseudoBulk()` have been
removed. To summarize by cell type, sum `$edge.data` using the cell types in
`$edge.meta`.
- `add_cell_meta()` now replaces `$cell.meta` in full. Use `add_meta_column()` to
change one column.
- The default database in `load_LRM_database()` is now ConnectomeDB2025.
Expand Down
25 changes: 9 additions & 16 deletions R/compute_CellToCell.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# compute_CellToCell.R ----------------------------------------------------
# Universal cell-to-cell ligand-receptor signal scoring engine.
# Accepts any edge list produced by create_Edgelist_Spatial(),
# create_Edgelist_PseudoBulk(), or create_Edgelist_SamplingByType().
# Accepts any edge list produced by create_Edgelist_Spatial() or
# create_Edgelist_SamplingByType().
# Supports single-gene and multi-gene complex ligands / receptors
# (underscore-delimited, e.g. "COL1A1_COL1A2"). Returns a plain
# 2-element list suitable for assembly into a NICHESObject via
Expand Down Expand Up @@ -54,11 +54,9 @@
#'
#' @description
#' Universal scoring engine for all NICHESv2 edge modes. For each edge and each
#' valid LR pair, computes a signal score. The edge list may come from any of
#' the three edgelist constructors -- spatial, pseudobulk, or type-sampled --
#' and the count matrix is expected to match accordingly (cell barcodes as
#' column names for spatial and nonspatial modes; cell type names for pseudobulk
#' mode).
#' valid LR pair, computes a signal score. The edge list may come from either
#' edgelist constructor -- spatial or type-sampled -- and the count matrix
#' column names must be the cell barcodes it uses.
#'
#' Supports \strong{multi-gene complexes}: a ligand or receptor represented as
#' \code{"gene1_gene2"} is split on \code{"_"} and all component expressions
Expand Down Expand Up @@ -99,13 +97,11 @@
#' \code{on.exit(stopCluster(cl))} so it is released even if scoring
#' errors midway.
#'
#' @param count.mtx Gene x cell (or gene x type for pseudobulk)
#' expression matrix (sparse \code{dgCMatrix} or dense). Row names = gene
#' symbols; column names = cell barcodes or cell type labels matching
#' @param count.mtx Gene x cell expression matrix (sparse \code{dgCMatrix}
#' or dense). Row names = gene symbols; column names = cell barcodes matching
#' \code{edge.list$from} / \code{$to}.
#' @param edge.list \code{data.table} from
#' \code{\link{create_Edgelist_Spatial}},
#' \code{\link{create_Edgelist_PseudoBulk}}, or
#' \code{\link{create_Edgelist_Spatial}} or
#' \code{\link{create_Edgelist_SamplingByType}}; or any \code{data.frame}
#' with \code{from} and \code{to} columns whose values match
#' \code{colnames(count.mtx)}. Coordinate columns
Expand Down Expand Up @@ -152,12 +148,9 @@
#' \code{\link{create_NICHESObject}} for the wrapped pipeline that
#' assembles a full \code{NICHESObject};
#' \code{\link{create_Edgelist_Spatial}},
#' \code{\link{create_Edgelist_PseudoBulk}},
#' \code{\link{create_Edgelist_SamplingByType}} for the edge-list
#' constructors;
#' \code{\link{load_LRM_database}} for the LR-database loader;
#' \code{\link{compute_PseudoBulk_Connectivity}} for type-averaged
#' connectivity in one call.
#' \code{\link{load_LRM_database}} for the LR-database loader.
#'
#' @examples
#' \donttest{
Expand Down
Loading
Loading