Search
Question: weights must be finite positive value
0
gravatar for nonCodingGene
3 months ago by
nonCodingGene10 wrote:

I'm using edgeR and an error for which I have not found a solution just appeared.

design <- model.matrix(~Cell.type, data = colData(summ.exp_norm))
dge$weights <- zinb.weights
dge <- estimateDisp(dge, design)

Error in .compressWeights(y, weights) :  weights must be finite positive values

 

As you can se no weight is out the rang 0-1 or infinite.

> sum(is.infinite(dge$weights))
[1] 0

 

Where can the error be?

Thanks

 

 

ADD COMMENTlink modified 3 months ago by Aaron Lun21k • written 3 months ago by nonCodingGene10

Why do you think is.infinite will tell you if any values are less than zero? Or for that matter, within the range 0-1?

ADD REPLYlink modified 3 months ago • written 3 months ago by James W. MacDonald48k

Sorry, I forgot to show that also tested for max(dge$weights) and min(dge$weights), and values where 1 and 0.

ADD REPLYlink written 3 months ago by nonCodingGene10

Well, the test is

check.range <- suppressWarnings(range(weights))
    if (any(is.na(check.range)) || check.range[1] <= 0) {
        stop("weights must be finite positive values")
    }
   

So really it's saying you have either negative or NA values. This comes after running makeCompressedMatrix, so you might see if there are any NA values after that step with your weights matrix.

ADD REPLYlink written 3 months ago by James W. MacDonald48k
sumis.na(dge$weights))
outputs 0
ADD REPLYlink modified 3 months ago • written 3 months ago by nonCodingGene10
0
gravatar for Aaron Lun
3 months ago by
Aaron Lun21k
Cambridge, United Kingdom
Aaron Lun21k wrote:

Pretty simple, really. If min(dge$weights) is zero, that's not positive.

ADD COMMENTlink written 3 months ago by Aaron Lun21k

Oh yeah, <= 0 ...

ADD REPLYlink written 3 months ago by James W. MacDonald48k

What can be the source of this and how can I solve it?

I'm using edgeR for scRNA-seq, in order to manage droputs I use zinbwave

Just in case I've checked whether one condition has a gene for which its counts are all 0, and this does not happens.

This is how I calculate weights:

 zinb <- zinbFit(summ.exp_norm, K=2, epsilon=1000)
 zinb.weights <- computeObservationalWeights(zinb, assay(summ.exp_norm))
ADD REPLYlink modified 3 months ago • written 3 months ago by nonCodingGene10

You'll have to take that up with the zinbwave authors.

ADD REPLYlink written 3 months ago by Aaron Lun21k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 200 users visited in the last hour