madsen-lab / valiDrops

16 stars 5 forks source link

Error in UseMethod("vcov") #17

Open ashipde opened 4 months ago

ashipde commented 4 months ago

With valiDrops 0.1.0 in R 4.3.2, x86_64-apple-darwin20, I get this error with one of 12 samples of my snRNA seq. experiment. The sample's data is not of good quality (~150 median features/cell, as against 300+ for others).

> temp <- valiDrops(counts)
Step 1: Filtering on the barcode-rank plot.
Error in UseMethod("vcov") : 
  no applicable method for 'vcov' applied to an object of class "NULL"
In addition: Warning messages:
1: In min(rmse[, 2]) : no non-missing arguments to min; returning Inf
2: In min(rmse[rmse[, 2] <= min(rmse[, 2]) * factor, 3]) :
  no non-missing arguments to min; returning Inf
ashipde commented 4 months ago

For this particular sample, the issue was avoided with alpha = 0.01. Setting type = 'Genes' and/or factor = 1 did not help.

Sandman-1 commented 4 months ago

Hello! I managed to fix this. It was a grep error in the source code where the loop didn't search for the right message provided by the segmented package when ranking barcodes. I also added the control parameter with QUANT = TRUE in the expression filter script to avoid a similar error regarding breakpoints. Please see my patch and/or commits to the main branch.

ashipde commented 4 months ago

Thank you! I will try the updated software. Separately, can one in general use valiDrops as a one-stop solution for snRNA seq. data? I have been using cellbender to remove ambient RNA and cell-free drops, then a couple of doublet finder softwares to remove multiplets cells, and then removing cells with high mitochondrial RNA content. Should one use ambient RNA removers before and doublet finders after using validDrops?

Sandman-1 commented 4 months ago

Just updated it yet again to have decreased breakpoint intervals and more iterations in the seg.control function. This should be the final one! It’s version 1.0.1 on the main branch in my fork.

I’m using valiDrops to remove bad cells/nuclei and following it up with SoupX to remove ambient RNA. Then I’m converting Seurat objects to h5ad files so I can use RADO to remove doublets in Python. Let me know if you have any questions.

Best, Sandman

ashipde commented 4 months ago

Thank you... version 1.1.0 does not raise this issue.

Sandman-1 commented 4 months ago

Yup! There are several possibilities to incur errors in valiDrops, but it is a good package. The forked version I released a few hours earlier today (1.1.0) covers every error I have experienced. It even skips stage 3 filtering if a suitable breakpoint cannot be fit to the linear model, so you don’t have to rerun the command and specify skipping of stage 3 yourself. I am looping the command over thousands of samples and am no longer experiencing errors now. You can imagine how frustrating it must have been when I was getting errors.

All the best with your work!

ashipde commented 4 months ago

Thank you again for fixing/improving the software. May be I am wrong but it looks like the original developer no longer seems interested in the software. I had almost given up on using valiDrops – unmaintained software == unreliable software.

JesperGrud commented 2 months ago

Hi both. Unfortunately, the funding environment isn't great for supporting continued development of scientific software. We do have some, but low bandwidth, for supporting updating the valiDrops.

@Sandman-1 I have made a pull request from your fork of valiDrops and will review the code before pushing it to main. Thank you for contributing to the software.