Skip to content

Commit

Permalink
Merge branch 'develop' into feat/FindWeights
Browse files Browse the repository at this point in the history
  • Loading branch information
cdarby authored Aug 28, 2020
2 parents 9a5739f + 84f3206 commit ae03527
Show file tree
Hide file tree
Showing 38 changed files with 1,330 additions and 283 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/R_CMD_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- master
- develop
pull_request:

jobs:
r-cmd-check:

if: "!contains(github.event.head_commit.message, 'ci-skip')"

name: R CMD check
container:
image: satijalab/seurat:develop
runs-on: self-hosted

steps:
- uses: actions/checkout@v2

- name: Check
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: results
path: check
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Seurat
Version: 3.2.0.9901
Date: 2020-07-17
Version: 3.2.0.9017
Date: 2020-08-27
Title: Tools for Single Cell Genomics
Description: A toolkit for quality control, analysis, and exploration of single cell RNA sequencing data. 'Seurat' aims to enable users to identify and interpret sources of heterogeneity from single cell transcriptomic measurements, and to integrate diverse types of single cell data. See Satija R, Farrell J, Gennert D, et al (2015) <doi:10.1038/nbt.3192>, Macosko E, Basu A, Satija R, et al (2015) <doi:10.1016/j.cell.2015.05.002>, and Stuart T, Butler A, et al (2019) <doi:10.1016/j.cell.2019.05.031> for more details.
Authors@R: c(
Expand Down Expand Up @@ -43,6 +43,7 @@ Imports:
lmtest,
MASS,
Matrix (>= 1.2-14),
matrixStats,
miniUI,
patchwork,
pbapply,
Expand Down
23 changes: 23 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ S3method("DefaultAssay<-",Graph)
S3method("DefaultAssay<-",Seurat)
S3method("DefaultAssay<-",SpatialImage)
S3method("Idents<-",Seurat)
S3method("Index<-",Neighbor)
S3method("JS<-",DimReduc)
S3method("JS<-",JackStrawData)
S3method("Key<-",Assay)
Expand Down Expand Up @@ -41,6 +42,7 @@ S3method(.DollarNames,SeuratCommand)
S3method(AddMetaData,Assay)
S3method(AddMetaData,Seurat)
S3method(Cells,DimReduc)
S3method(Cells,Neighbor)
S3method(Cells,STARmap)
S3method(Cells,SlideSeq)
S3method(Cells,SpatialImage)
Expand All @@ -55,6 +57,7 @@ S3method(DefaultAssay,Graph)
S3method(DefaultAssay,Seurat)
S3method(DefaultAssay,SeuratCommand)
S3method(DefaultAssay,SpatialImage)
S3method(Distances,Neighbor)
S3method(Embeddings,DimReduc)
S3method(Embeddings,Seurat)
S3method(FindClusters,Seurat)
Expand Down Expand Up @@ -87,6 +90,8 @@ S3method(GetTissueCoordinates,VisiumV1)
S3method(HVFInfo,Assay)
S3method(HVFInfo,Seurat)
S3method(Idents,Seurat)
S3method(Index,Neighbor)
S3method(Indices,Neighbor)
S3method(IsGlobal,DimReduc)
S3method(IsGlobal,SpatialImage)
S3method(IsGlobal,default)
Expand Down Expand Up @@ -115,6 +120,7 @@ S3method(ReadH5AD,H5File)
S3method(ReadH5AD,character)
S3method(RenameCells,Assay)
S3method(RenameCells,DimReduc)
S3method(RenameCells,Neighbor)
S3method(RenameCells,STARmap)
S3method(RenameCells,Seurat)
S3method(RenameCells,SlideSeq)
Expand Down Expand Up @@ -169,7 +175,9 @@ S3method(WhichCells,Seurat)
S3method(WriteH5AD,Seurat)
S3method(as.CellDataSet,Seurat)
S3method(as.Graph,Matrix)
S3method(as.Graph,Neighbor)
S3method(as.Graph,matrix)
S3method(as.Neighbor,Graph)
S3method(as.Seurat,CellDataSet)
S3method(as.Seurat,SingleCellExperiment)
S3method(as.Seurat,loom)
Expand All @@ -184,6 +192,7 @@ S3method(as.sparse,data.frame)
S3method(as.sparse,matrix)
S3method(dim,Assay)
S3method(dim,DimReduc)
S3method(dim,Neighbor)
S3method(dim,STARmap)
S3method(dim,Seurat)
S3method(dim,SlideSeq)
Expand All @@ -209,6 +218,7 @@ S3method(subset,SpatialImage)
S3method(subset,VisiumV1)
export("DefaultAssay<-")
export("Idents<-")
export("Index<-")
export("JS<-")
export("Key<-")
export("Loadings<-")
Expand Down Expand Up @@ -252,6 +262,7 @@ export(DietSeurat)
export(DimHeatmap)
export(DimPlot)
export(DiscretePalette)
export(Distances)
export(DoHeatmap)
export(DotPlot)
export(ElbowPlot)
Expand All @@ -260,6 +271,7 @@ export(ExpMean)
export(ExpSD)
export(ExpVar)
export(ExportToCellbrowser)
export(FastRowScale)
export(FeatureLocator)
export(FeaturePlot)
export(FeatureScatter)
Expand Down Expand Up @@ -294,6 +306,8 @@ export(ISpatialDimPlot)
export(ISpatialFeaturePlot)
export(Idents)
export(Images)
export(Index)
export(Indices)
export(IntegrateData)
export(Intensity)
export(IsGlobal)
Expand All @@ -308,6 +322,7 @@ export(LabelPoints)
export(LinkedDimPlot)
export(LinkedFeaturePlot)
export(Load10X_Spatial)
export(LoadAnnoyIndex)
export(LoadSTARmap)
export(Loadings)
export(LocalStruct)
Expand All @@ -320,6 +335,7 @@ export(MetaFeature)
export(MinMax)
export(Misc)
export(MixingMetric)
export(Neighbors)
export(NoAxes)
export(NoGrid)
export(NoLegend)
Expand Down Expand Up @@ -367,6 +383,7 @@ export(RunUMAP)
export(SCTransform)
export(SVFInfo)
export(SampleUMI)
export(SaveAnnoyIndex)
export(ScaleData)
export(ScaleFactors)
export(ScoreJackStraw)
Expand All @@ -392,6 +409,7 @@ export(TSNEPlot)
export(Tool)
export(TopCells)
export(TopFeatures)
export(TopNeighbors)
export(TransferData)
export(UMAPPlot)
export(UpdateSeuratObject)
Expand All @@ -404,6 +422,7 @@ export(WhichCells)
export(WhiteBackground)
export(as.CellDataSet)
export(as.Graph)
export(as.Neighbor)
export(as.Seurat)
export(as.SingleCellExperiment)
export(as.loom)
Expand All @@ -415,6 +434,7 @@ exportClasses(DimReduc)
exportClasses(Graph)
exportClasses(IntegrationData)
exportClasses(JackStrawData)
exportClasses(Neighbor)
exportClasses(Seurat)
exportClasses(SeuratCommand)
exportClasses(SpatialImage)
Expand Down Expand Up @@ -579,6 +599,9 @@ importFrom(irlba,irlba)
importFrom(jsonlite,fromJSON)
importFrom(leiden,leiden)
importFrom(lmtest,lrtest)
importFrom(matrixStats,rowMeans2)
importFrom(matrixStats,rowSds)
importFrom(matrixStats,rowSums2)
importFrom(methods,"slot<-")
importFrom(methods,.hasSlot)
importFrom(methods,as)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [unreleased]
### Added
- Added support for nearest neighbor input and `return.model` parameter in `RunUMAP()`
- Enable named color vectors in `DoHeatmap()`
- Add `label.color` and `label.box` parameters to `DimPlot`
- Added `shuffle` and `seed` parameters to `DimPlot()` to help with overplotting.

### Changes
- Allow setting `slot` parameter in `RunUMAP`
- Added support for FIt-SNE v1.2+
- Fix for `Spatial*Plot` when running with interactive=TRUE
- Set max for number of items returned by `Top` and remove duplicate items when balanced=TRUE
- Fix logging bug when functions were run via `do.call()`
- Fix handling of weight.by.var parameter when approx=FALSE in `RunPCA()`


## [3.2.0] - 2020-07-15
### Added
Expand Down
14 changes: 9 additions & 5 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ RowMergeMatrices <- function(mat1, mat2, mat1_rownames, mat2_rownames, all_rowna
.Call('_Seurat_RowMergeMatrices', PACKAGE = 'Seurat', mat1, mat2, mat1_rownames, mat2_rownames, all_rownames)
}

LogNorm <- function(data, scale_factor, display_progress = TRUE) {
.Call('_Seurat_LogNorm', PACKAGE = 'Seurat', data, scale_factor, display_progress)
RowMergeMatricesList <- function(mat_list, mat_rownames, all_rownames) {
.Call('_Seurat_RowMergeMatricesList', PACKAGE = 'Seurat', mat_list, mat_rownames, all_rownames)
}

FastRowScale <- function(mat, scale = TRUE, center = TRUE, scale_max = 10, display_progress = TRUE) {
.Call('_Seurat_FastRowScale', PACKAGE = 'Seurat', mat, scale, center, scale_max, display_progress)
LogNorm <- function(data, scale_factor, display_progress = TRUE) {
.Call('_Seurat_LogNorm', PACKAGE = 'Seurat', data, scale_factor, display_progress)
}

Standardize <- function(mat, display_progress = TRUE) {
Expand Down Expand Up @@ -77,7 +77,11 @@ ReplaceColsC <- function(mat, col_idx, replacement) {
.Call('_Seurat_ReplaceColsC', PACKAGE = 'Seurat', mat, col_idx, replacement)
}

FindWeightsC <- function(cells2, distances, anchor_cells2, integration_matrix_rownames, cell_index, anchor_score, min_dist, sd, display_progress) {
GraphToNeighborHelper <- function(mat) {
.Call('_Seurat_GraphToNeighborHelper', PACKAGE = 'Seurat', mat)
}

FindWeightsC <- function(integration_matrix, cells2, distances, anchor_cells2, integration_matrix_rownames, cell_index, anchor_score, min_dist, sd, display_progress) {
.Call('_Seurat_FindWeightsC', PACKAGE = 'Seurat', cells2, distances, anchor_cells2, integration_matrix_rownames, cell_index, anchor_score, min_dist, sd, display_progress)
}

Expand Down
19 changes: 16 additions & 3 deletions R/clustering.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ FindNeighbors.default <- function(
searchtype = "standard",
eps = nn.eps,
metric = annoy.metric)
nn.ranked <- nn.ranked$nn.idx
nn.ranked <- Indices(object = nn.ranked)
} else {
if (verbose) {
message("Building SNN based on a provided distance matrix")
Expand Down Expand Up @@ -514,6 +514,8 @@ AnnoyNN <- function(data, query = data, metric = "euclidean", n.trees = 50, k,
k = k,
search.k = search.k,
include.distance = include.distance)
nn$idx <- idx
nn$alg.info <- list(metric = metric, ndim = ncol(x = data))
return(nn)
}

Expand Down Expand Up @@ -633,12 +635,13 @@ GroupSingletons <- function(ids, SNN, group.singletons = TRUE, verbose = TRUE) {
# @param query Data to query against data
# @param k Number of nearest neighbors to compute
# @param method Nearest neighbor method to use: "rann", "annoy"
# @param cache.index Store algorithm index with results for reuse
# @param ... additional parameters to specific neighbor finding method
#
NNHelper <- function(data, query = data, k, method, ...) {
NNHelper <- function(data, query = data, k, method, cache.index = FALSE, ...) {
args <- as.list(x = sys.frame(which = sys.nframe()))
args <- c(args, list(...))
return(
results <- (
switch(
EXPR = method,
"rann" = {
Expand All @@ -652,6 +655,16 @@ NNHelper <- function(data, query = data, k, method, ...) {
stop("Invalid method. Please choose one of 'rann', 'annoy'")
)
)
n.ob <- Neighbor(
nn.idx = results$nn.idx,
nn.dist = results$nn.dists,
alg.info = results$alg.info %||% list(),
cell.names = rownames(x = query)
)
if (isTRUE(x = cache.index) && !is.null(x = results$idx)) {
slot(object = n.ob, name = "alg.idx") <- results$idx
}
return(n.ob)
}

# Run Leiden clustering algorithm
Expand Down
Loading

0 comments on commit ae03527

Please sign in to comment.