davismcc/archive-scater

calculateQCMetrics() errors when fpkmData is supplied

Closed this issue · 3 comments

In the newest version of scater (1.3.28) I get the error below when the SCESet is created from fpkmData. This is the example from the scater vignette, with only countData to fpkmData change:

pd <- new("AnnotatedDataFrame", data = sc_example_cell_info)
rownames(pd) <- pd$Cell
gene_df <- data.frame(Gene = rownames(sc_example_counts))
rownames(gene_df) <- gene_df$Gene
fd <- new("AnnotatedDataFrame", data = gene_df)
example_sceset <- newSCESet(fpkmData = sc_example_counts, phenoData = pd, featureData = fd)
example_sceset <- calculateQCMetrics(example_sceset, feature_controls = 1:20)

Error in calculateQCMetrics(example_sceset, feature_controls = 1:20) :
need either is_exprs(object) or counts(object) to be defined,
e.g., use is_exprs(object) <- exprs(object) > 0.1

is_exprs(example_sceset) <- exprs(example_sceset) > 0
example_sceset <- calculateQCMetrics(example_sceset, feature_controls = 1:20)

Error in seq_len(nrow(target)) :
argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(nrow(target)) : first element used of 'length.out' argument

LTLA commented

The second error should be fixed in #76. The first error probably needs a bit of code at the front to indicate which values should be used, given the hierarchy specified in #77.

LTLA commented

The first error should be fixed in #80; nexprs will now "hunt" for an expression category to use if counts are not present, in the following hierarchy: tpm > cpm > fpkm > exprs

Aaron's previous commits fixed these errors (thanks, Aaron!). Looking into this now to close it off for Bioc submission I came across some bugs with total_counts and log10_total_counts being computed and added (possibly with NaN values) if counts were not supplied. I've removed this with a check on whether the count matrix is NULL - only if not are these added to the pData of the returned SCESet. I've also added some more tests for when using FPKM (only) in the object.