rhondabacher / SCnorm

Normalization for single cell RNA-seq data
47 stars 9 forks source link

Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : invalid 'x' #36

Open houruiyan opened 2 years ago

houruiyan commented 2 years ago

Hi, thank you very much for your great tool. I meet some trouble when I run this code. Hope to get your help. Thank you. pdf("MyNormalizedData_k_evaluation.pdf") DataNorm <- SCnorm(Data = kcadata, Conditions = Conditions, PrintProgressPlots = TRUE, FilterCellNum = 10, NCores=40, reportSF = TRUE,withinSample = genelength) dev.off()

However I got this error. Renaming the first element in assays(Data) to 'counts' Setting up parallel computation using 40 cores Using loess method described in ''GC-Content Normalization for RNA-Seq Data'', Risso et al. to perform within-sample normalization. For other options see the original publication and package EDASeq. Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : invalid 'x'

houruiyan commented 2 years ago

When I drop out the withinSample=genelength , the code can run smoothly. But when I also can run withinFactorMatrix <- plotWithinFactor(Data = kcadata, withinSample = genelength) smoothly. This suggest the genelength did not have question?

rhondabacher commented 2 years ago

Hi, Thanks for using SCnorm!

I used the built-in example data to test the code but I did not receive any error when running the following:

# Example test
data(ExampleSimSCData)
genelength <- runif(dim(ExampleSimSCData)[1], 0, 1)
names(genelength) <- rownames(ExampleSimSCData)
Conditions = rep(c(1, 2), each= 45)

DataNorm <- SCnorm(Data = ExampleSimSCData, Conditions = Conditions, 
                     PrintProgressPlots = TRUE, FilterCellNum = 10, 
                   reportSF = TRUE,withinSample = genelength)

Will you send the results of the output below for your data as that may help me identify why you're receiving that particular error? Thanks!

str(kcadata)
str(genelength)

As another note, I am not sure what type of data you have but it is generally not recommended to correct for gene-length with most single-cell RNA-seq datasets.