Skip to content

Commit

Permalink
Merge branch 'develop' into fix/FeatureScatter_cells
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwbutler committed Apr 10, 2020
2 parents 3cd92a3 + daaadf5 commit 25f00bd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Seurat
Version: 3.1.4.9025
Date: 2020-04-09
Version: 3.1.4.9027
Date: 2020-04-10
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. Please note: SDMTools is available is available from the CRAN archives with install.packages("https://cran.rstudio.com//src/contrib/Archive/SDMTools/SDMTools_1.1-221.2.tar.gz", repos = NULL); it is not in the standard repositories.
Authors@R: c(
Expand Down
6 changes: 6 additions & 0 deletions R/objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,12 @@ RenameAssays <- function(object, ...) {
DefaultAssay(object = object) <- new
}
Key(object = object[[new]]) <- old.key
# change assay used in any dimreduc object
for (i in Reductions(object = object)) {
if (DefaultAssay(object = object[[i]]) == old) {
DefaultAssay(object = object[[i]]) <- new
}
}
object[[old]] <- NULL
}
return(object)
Expand Down
10 changes: 8 additions & 2 deletions R/preprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ ReadAlevin <- function(base.path) {
#' will be prefixed with the name.
#' @param gene.column Specify which column of genes.tsv or features.tsv to use for gene names; default is 2
#' @param unique.features Make feature names unique (default TRUE)
#' @param strip.suffix Remove trailing "-1" if present in all cell barcodes.
#'
#' @return If features.csv indicates the data has multiple data types, a list
#' containing a sparse matrix of the data from each type will be returned.
Expand All @@ -857,7 +858,12 @@ ReadAlevin <- function(base.path) {
#' seurat_object[['Protein']] = CreateAssayObject(counts = data$`Antibody Capture`)
#' }
#'
Read10X <- function(data.dir = NULL, gene.column = 2, unique.features = TRUE) {
Read10X <- function(
data.dir = NULL,
gene.column = 2,
unique.features = TRUE,
strip.suffix = FALSE
) {
full.data <- list()
for (i in seq_along(along.with = data.dir)) {
run <- data.dir[i]
Expand Down Expand Up @@ -888,7 +894,7 @@ Read10X <- function(data.dir = NULL, gene.column = 2, unique.features = TRUE) {
}
data <- readMM(file = matrix.loc)
cell.names <- readLines(barcode.loc)
if (all(grepl(pattern = "\\-1$", x = cell.names))) {
if (all(grepl(pattern = "\\-1$", x = cell.names)) & strip.suffix) {
cell.names <- as.vector(x = as.character(x = sapply(
X = cell.names,
FUN = ExtractField,
Expand Down
9 changes: 8 additions & 1 deletion man/Read10X.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat/test_load_10X.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ test_that("Cell Ranger 3.0 Data Parsing", {
expect_is(test.data, "list")
expect_equal(ncol(test.data$`Gene Expression`), .5 * ncol(test.data2$`Gene Expression`))
expect_equal(ncol(test.data$`Antibody Capture`), .5 * ncol(test.data2$`Antibody Capture`))
expect_equal(colnames(test.data2[[1]])[6], "2_AAAGTAGCACAGTCGC")
expect_equal(colnames(test.data2[[1]])[6], "2_AAAGTAGCACAGTCGC-1")
expect_equal(test.data$`Gene Expression`[2,2], 1000)
})

# Tests of Pre-3.0 Data
test.data3 <- Read10X("../testdata/")
test_that("Read10X creates sparse matrix", {
expect_is(test.data3, "dgCMatrix")
expect_equal(colnames(test.data3)[1], "ATGCCAGAACGACT")
expect_equal(colnames(test.data3)[1], "ATGCCAGAACGACT-1")
expect_equal(rownames(test.data3)[1], "MS4A1")
})

Expand Down

0 comments on commit 25f00bd

Please sign in to comment.