Skip to content

Commit

Permalink
Updates to data files.
Browse files Browse the repository at this point in the history
  • Loading branch information
PratibhaPanwar committed Aug 28, 2024
1 parent 5e4020a commit b7317d8
Show file tree
Hide file tree
Showing 19 changed files with 194 additions and 44 deletions.
33 changes: 27 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Package
Title: clustSIGNAL: a spatial clustering method
Version: 0.1.0
Author: c(
person(given = "Pratibha", family = "Panwar", email = "[email protected]", role = c("cre", "aut")),
person(given = "Pratibha", family = "Panwar", email = "[email protected]", role = c("cre", "aut", "ctb")),
person(given = "Boyi", family = "Guo", email = "", role = "aut")),
person(given = "Haowen", family = "Zhao", email = "", role = "aut")),
person(given = "Stephanie", family = "Hicks", email = "", role = "aut")),
Expand All @@ -18,9 +18,30 @@ Description: clustSIGNAL: clustering of Spatially Informed Gene expression with
License: GPL-2
Encoding: UTF-8
LazyData: true
LazyDataCompression: xz
URL: https://sydneybiox.github.io/clustSIGNAL/, https://sydneybiox.github.io/clustSIGNAL/
BugReports: https://github.com/sydneybiox/clustSIGNAL/issues
biocViews: Clustering, Software
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Depends: R (>= 4.0.0), SpatialExperiment, doParallel
Imports: BiocNeighbors, bluster, scater, aricode, distances, cluster, ggplot2, patchwork, BiocStyle
Sugests: knitr, rmarkdown
VignetteBuilder: knitr, rmarkdown
URL: https://sydneybiox.github.io/clustSIGNAL/
Depends:
R (>= 4.0.0),
SpatialExperiment,
doParallel
Imports:
BiocNeighbors,
bluster,
scater,
aricode,
distances,
cluster,
ggplot2,
patchwork,
BiocStyle,
dplyr
Suggests:
knitr,
rmarkdown
VignetteBuilder:
knitr,
rmarkdown
2 changes: 1 addition & 1 deletion R/adaptiveSmoothing.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @export

#### Smoothing
adaptiveSmoothing <- function(spe, nnCells, NN, kernel, spread) {
adaptiveSmoothing <- function(spe, nnCells, NN = 30, kernel = "G", spread = 0.05) {
ed = unique(spe$entropy)
gXc = as(logcounts(spe), "sparseMatrix")
if (kernel == "G") {
Expand Down
4 changes: 3 additions & 1 deletion R/clustering.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#' A function containing two steps used at different times in the clustSIGNAL workflow. An initial non-spatial clustering and sub-clustering step (reclust = FALSE) is used to generate groups of ‘putative cell types’, whereas a later non-spatial clustering step (reclust = TRUE) is used to cluster adaptively smoothed gene expression data.
#'
#' @param spe SpatialExperiment object. For reclust = FALSE, the object should contain logcounts and PCA, but for reculst = TRUE, the object should contain smoothed gene expression.
#' @param dimRed a character indicating the name of the reduced dimensions to use from the SpatialExperiment object (i.e., from reducedDimNames(spe)). Default value is 'PCA'.
#' @param reclust a logical parameter handled within the method.
#' @param ... additional parameters for TwoStepParam clustering methods. Include parameters like k for number of nearest neighbours and cluster.fun for selecting community detection method. Default values k = 5, cluster.fun = "louvain".
#'
#' @return SpatialExperiment object containing 'putative cell type' group allotted to each cell (reclust = FALSE) or clusters generated from smoothed data (reclust = TRUE).
#'
Expand All @@ -22,7 +24,7 @@
#' @export

#### Non-spatial clustering
nsClustering <- function(spe, dimRed, reclust, ...) {
nsClustering <- function(spe, dimRed = "PCA", reclust, ...) {
# number of centers = 1/5th of total cells in sample
clustVal <- min(as.integer(ncol(spe) / 5), 50000)
if (reclust == FALSE) {
Expand Down
53 changes: 53 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#' Mouse Embryo Data as SpatialExperiment object
#'
#' This dataset contains spatial transcriptomics data from 3 mouse embryos, with
#' 351 genes and a total of 57536 cells. For running vignettes and examples, we subset
#' the data by selecting only embryo 2 and removed all cells that were annotated
#' as 'low quality'. After subsetting, we have 14,185 cells from embryo 2 and 351
#' genes.
#'
#'
#' @name mEmbryo2
#' @aliases nnCells me_data me_expr regXclust
#' @docType data
#' @format
#' \code{me_expr} a gene expression matrix with normalised counts, where rows indicate
#' genes and columns indicate cells.
#' \code{me_data} a data frame of cell metadata including cell IDs, sample IDs,
#' cell type annotations, and x-y coordinates of cells.
#' \code{nnCells} a matrix where each row corresponds to a cell in spe object,
#' and the columns correspond to the nearest neighbors.
#' \code{regXclust} a list where each element corresponds to a cell in spe object,
#' and contains the cluster composition proportions.
#' @usage load("mEmbryo2.RData")
#' @source Integration of spatial and single-cell transcriptomic data elucidates mouse
#' organogenesis, \emph{Nature Biotechnology}, 2022.
#' Webpage: \url{https://www.nature.com/articles/s41587-021-01006-2}
#' @keywords datasets
NULL


#' Mouse Hypothalamus Data as SpatialExperiment object
#'
#' This dataset contains spatial transcriptomics data from 181 mouse hypothalamus
#' samples embryos, 155 genes and a total of 1,027,080 cells. For running the
#' vignettes, we subset the data by selecting only 3 samples - Animal 1 Bregma -0.09
#' and Animal 7 Bregmas 0.16 and -0.09, removed all cells that were annotated
#' as 'ambiguous', and removed 20 genes that were assessed using a different technology.
#' After subsetting, we have 15,848 cells from 3 mouse brain samples and 135 genes.
#'
#'
#' @name mHypothal
#' @aliases mh_data mh_expr
#' @docType data
#' @format
#' \code{mh_expr} a gene expression matrix with normalised counts, where rows indicate
#' genes and columns indicate cells.
#' \code{mh_data} a data frame of cell metadata including cell IDs, sample IDs,
#' cell type annotations, and x-y coordinates of cells.
#' @usage load("mHypothal.RData")
#' @source Molecular, Spatial and Functional Single-Cell Profiling of the
#' Hypothalamic Preoptic Region, \emph{Science}, 2018.
#' Webpage: \url{https://www.science.org/doi/10.1126/science.aau5324}
#' @keywords datasets
NULL
2 changes: 1 addition & 1 deletion R/entropyMeasure.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @export

#### Domainness measure
entropyMeasure <- function(spe, cells, regXclust, threads) {
entropyMeasure <- function(spe, cells, regXclust, threads = 1) {
cellsList <- as.vector(spe[[cells]])
cl <- parallel::makeCluster(threads)
doParallel::registerDoParallel(cl)
Expand Down
2 changes: 1 addition & 1 deletion R/neighborDetect.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @export

#### Region description + sorting
neighbourDetect <- function(spe, samples, NN, cells, sort) {
neighbourDetect <- function(spe, samples, NN = 30, cells, sort = TRUE) {
samplesList <- unique(spe[[samples]])
nnCells <- matrix(nrow = 0, ncol = NN + 1)
nnClusts <- matrix(nrow = 0, ncol = NN)
Expand Down
Binary file added data/mEmbryo2.RData
Binary file not shown.
Binary file added data/mHypothal.RData
Binary file not shown.
Binary file removed data/mouseEmbryo2.rda
Binary file not shown.
Binary file removed data/mousePH_subset.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/adaptiveSmoothing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions man/clustSIGNAL.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/entropyMeasure.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions man/mEmbryo2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions man/mHypothal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/neighbourDetect.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/nsClustering.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b7317d8

Please sign in to comment.