Skip to content

Commit

Permalink
Fix bug introduced in 0.1.2 plus suppress new cds warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hpliner committed Feb 12, 2019
1 parent f2e1024 commit d04a89b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: garnett
Type: Package
Title: Automated cell type classification
Version: 0.1.2
Version: 0.1.3
Author: c(
person("Hannah", "Pliner", email = "[email protected]", role = c("aut", "cre")),
person("Cole", "Trapnell", email = "[email protected]", role = c("aut")))
Expand Down
8 changes: 4 additions & 4 deletions R/classify_cells.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ classify_cells <- function(cds,
sf <- pData(cds)$Size_Factor
pd <- new("AnnotatedDataFrame", data = pData(cds))
fd <- new("AnnotatedDataFrame", data = fData(cds))
cds <- newCellDataSet(as(exprs(cds), "dgCMatrix"),
cds <- suppressWarnings(newCellDataSet(as(exprs(cds), "dgCMatrix"),
phenoData = pd,
featureData = fd)
featureData = fd))
pData(cds)$Size_Factor <- sf
}

Expand All @@ -116,8 +116,8 @@ classify_cells <- function(cds,
fd <- new("AnnotatedDataFrame", data = fData(cds))
temp <- exprs(cds)
temp@x <- temp@x / rep.int(pData(cds)$Size_Factor, diff(temp@p))
norm_cds <- newCellDataSet(temp,
phenoData = pd, featureData = fd)
norm_cds <- suppressWarnings(newCellDataSet(temp,
phenoData = pd, featureData = fd))

if (.hasSlot(classifier, "gene_id_type")) {
classifier_gene_id_type <- classifier@gene_id_type
Expand Down
8 changes: 4 additions & 4 deletions R/train_cell_classifier.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ train_cell_classifier <- function(cds,
sf <- pData(cds)$Size_Factor
pd <- new("AnnotatedDataFrame", data = pData(cds))
fd <- new("AnnotatedDataFrame", data = fData(cds))
cds <- newCellDataSet(as(exprs(cds), "dgCMatrix"),
cds <- suppressWarnings(newCellDataSet(as(exprs(cds), "dgCMatrix"),
phenoData = pd,
featureData = fd)
featureData = fd))
pData(cds)$Size_Factor <- sf
}

Expand All @@ -161,8 +161,8 @@ train_cell_classifier <- function(cds,
fd <- new("AnnotatedDataFrame", data = fData(cds))
temp <- exprs(cds)
temp@x <- temp@x / rep.int(pData(cds)$Size_Factor, diff(temp@p))
norm_cds <- newCellDataSet(temp,
phenoData = pd, featureData = fd)
norm_cds <- suppressWarnings(newCellDataSet(temp,
phenoData = pd, featureData = fd))
orig_cds <- cds
if(cds_gene_id_type != classifier_gene_id_type) {
norm_cds <- cds_to_other_id(norm_cds, db=db, cds_gene_id_type,
Expand Down
14 changes: 6 additions & 8 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ cds_to_other_id <- function(cds,

pd = new("AnnotatedDataFrame", data = pData(cds))
fd = new("AnnotatedDataFrame", data = fdata)
cds = newCellDataSet(matrix,
cds = suppressWarnings(newCellDataSet(matrix,
phenoData=pd,
featureData=fd,
expressionFamily=cds@expressionFamily,
lowerDetectionLimit=cds@lowerDetectionLimit)
lowerDetectionLimit=cds@lowerDetectionLimit))

return(cds)
}
Expand Down Expand Up @@ -270,9 +270,9 @@ check_markers <- function(cds,
if (!is(exprs(cds), "dgCMatrix")) {
pd <- new("AnnotatedDataFrame", data = pData(cds))
fd <- new("AnnotatedDataFrame", data = fData(cds))
cds <- newCellDataSet(as(exprs(cds), "dgCMatrix"),
cds <- suppressWarnings(newCellDataSet(as(exprs(cds), "dgCMatrix"),
phenoData = pd,
featureData = fd)
featureData = fd))
pData(cds)$Size_Factor <- sf
}

Expand All @@ -291,8 +291,8 @@ check_markers <- function(cds,
orig_cds <- cds
temp <- exprs(cds)
temp@x <- temp@x / rep.int(pData(cds)$Size_Factor, diff(temp@p))
cds <- newCellDataSet(temp,
phenoData = pd, featureData = fd)
cds <- suppressWarnings(newCellDataSet(temp,
phenoData = pd, featureData = fd))

pData(cds)$Size_Factor <- sf

Expand Down Expand Up @@ -477,8 +477,6 @@ check_marker_conversion <- function(parse_list,
marker_file_gene_id_type,
cds_gene_id_type)
bad_convert <- sum(is.na(gene_table$fgenes))
} else {
gene_table$cds <- gene_table$fgenes
}

gene_table$in_cds <- gene_table$fgenes %in% possible_genes
Expand Down

0 comments on commit d04a89b

Please sign in to comment.