Skip to content

Commit

Permalink
Merge branch 'release/3.0' into fix/FixedAssay
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Apr 11, 2019
2 parents 17df20f + c10d52e commit 16526d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
6 changes: 3 additions & 3 deletions R/integration.R
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ FilterAnchors <- function(
verbose = TRUE
) {
if (verbose) {
message("Filtering Anchors")
message("Filtering anchors")
}
assay <- assay %||% DefaultAssay(object = object)
features <- features %||% VariableFeatures(object = object)
Expand Down Expand Up @@ -1334,7 +1334,7 @@ FindAnchorPairs <- function(
k.anchor <- min(max.nn)
}
if (verbose) {
message("Finding mutual nearest neighborhoods")
message("Finding anchors")
}
if (is.null(x = cells1)) {
cells1 <- colnames(x = object)
Expand Down Expand Up @@ -1759,7 +1759,7 @@ ScoreAnchors <- function(
anchor.df$cell2 <- anchor.df$cell2 + offset
# make within dataset df
if (verbose) {
message("Extracting within-dataset neighbors!")
message("Extracting within-dataset neighbors")
}
total.cells <- offset + length(neighbors$cells2)
nn.m1 <- ConstructNNMat(nn.idx = neighbors$nnaa$nn.idx[,1:k.score], offset1 = 0, offset2 = 0, dims = c(total.cells, total.cells))
Expand Down
19 changes: 8 additions & 11 deletions R/preprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -1002,9 +1002,6 @@ SCTransform <- function(
)
}

# output will go into new assay
assay.out <- CreateAssayObject(counts = umi)

if (verbose) {
message('Determine variable features')
}
Expand All @@ -1014,7 +1011,6 @@ SCTransform <- function(
} else {
top.features <- names(x = feature.variance)[feature.variance >= variable.features.rv.th]
}
VariableFeatures(object = assay.out) <- top.features
if (verbose) {
message('Set ', length(x = top.features), ' variable features')
}
Expand All @@ -1033,17 +1029,17 @@ SCTransform <- function(
}
}

# put corrected umi counts in count slot
# create output assay and put (corrected) umi counts in count slot
if (do.correct.umi & residual.type == 'pearson') {
if (verbose) {
message('Place corrected count matrix in counts slot')
}
assay.out <- SetAssayData(
object = assay.out,
slot = 'counts',
new.data = vst.out$umi_corrected
)
assay.out <- CreateAssayObject(counts = vst.out$umi_corrected)
} else {
assay.out <- CreateAssayObject(counts = umi)
}
# set the variable genes
VariableFeatures(object = assay.out) <- top.features

# put log1p transformed counts in data
assay.out <- SetAssayData(
Expand Down Expand Up @@ -1088,7 +1084,8 @@ SCTransform <- function(
vst.out$y <- NULL
assay.out@misc <- list(vst.out = vst.out)
# also put gene attributes in meta.features
assay.out[[names(x = vst.out$gene_attr)]] <- vst.out$gene_attr
#assay.out[[names(x = vst.out$gene_attr)]] <- vst.out$gene_attr # use this when Paul has implemented automatic padding
assay.out@meta.features <- vst.out$gene_attr # hacky workaround to make vignettes compile

object[[new.assay.name]] <- assay.out
if (verbose) {
Expand Down

0 comments on commit 16526d8

Please sign in to comment.