DoubletFinder icon indicating copy to clipboard operation
DoubletFinder copied to clipboard

Error in doubletFinder_v3 call (reuse.pANN != FALSE; argument is of length zero)

Open errcricket opened this issue 2 years ago • 1 comments

Hello and thank you for making this tool!

I have automated the data cleaning process and I have run into an error while using DoubletFinder. Below is a portion of the code:

183    pann_data = colnames([email protected])[grepl("pANN", colnames([email protected]))]
184    annotations <- [email protected]$seurat_clusters
185    homotypic.prop <- modelHomotypic(annotations)
186    nExp_poi <- round(doublet_rate*nrow([email protected]))
187    nExp_poi.adj <- round(nExp_poi*(1-homotypic.prop))
188    seurat_object <- doubletFinder_v3(seurat_object, PCs = 1:components, pN = pN, pK = pk_value, nExp = nExp_poi, reuse.pANN = FALSE, sct = FALSE)
189    seurat_object <- doubletFinder_v3(seurat_object, PCs = 1:components, pN = pN, pK = pk_value, nExp = nExp_poi.adj, reuse.pANN = pann_data, sct = FALSE)

I use grepl to search through the meta.data fields for a slot containing the pANN values (line 183, e.g. "pANN_0.25_0.005_0"), assign it to a variable, and use it during the second doubletFinder_v3 call (line 189). I think the command is not recognizing the variable.

Error:

Error in if (reuse.pANN != FALSE) { : argument is of length zero
Calls: run_doubletfinder -> doubletFinder_v3
Execution halted

I can successfully run line 188 or line 189 (and change line 189 to reuse.pANN = FALSE).

Two questions:

  1. Although I have not tried it, if I set reuse.pANN to FALSE in lines 188-9, would the pANN values be identical between the two runs?
  2. Do you have a work-around that would make the variable recognizable (all my fingers are crossed)?

Many thanks in advance.

errcricket avatar Apr 27 '22 12:04 errcricket

Hi @errcricket hmmm.... are you sure pann_data is being set correctly? Because it is internal to the function you may need to 'get' it from the global environment (https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/get)

chris-mcginnis-ucsf avatar Aug 18 '23 23:08 chris-mcginnis-ucsf