galaxyproject / tools-iuc

Tool Shed repositories maintained by the Intergalactic Utilities Commission
https://galaxyproject.org/iuc
MIT License
160 stars 422 forks source link

Set dims in FindNeighbors call in Seurat.R #2983

Open hepcat72 opened 4 years ago

hepcat72 commented 4 years ago

I am working to get Seurat to work on some test data (albeit small) and I get the error:

Quitting from lines 112-117 (/galaxy/galaxy-app/database/jobs_directory/000/265/265717/working/Seurat.spin.Rmd) 
Error in FindNeighbors.Seurat(object = seuset) : 
  More dimensions specified in dims than have been computed

Which I think could be overcome if line 99 of the Seurat.R script was modified from:

seuset <- Seurat::FindNeighbors(object = seuset)

To:

seuset <- Seurat::FindNeighbors(object = seuset, dims = 1:numPCs)
bgruening commented 4 years ago

@mblue9 could you please look at this one? Thanks!

hepcat72 commented 4 years ago

Just FYI, I am able to get past this point by setting dims under the default of 1:10 to 1:6 when I work with Seurat in R Studio. Although I'm not using the R script from the tool wrapper. I'm following the steps in chapter 9 here.

My small dataset is a real dataset (mixed human/mouse) from our core that was 1 sample in one starting well (SPLiT-Seq data). The top line of the mtx is:

7 38526 194539

So there are only 7 cells.

hepcat72 commented 4 years ago

Also, it may be possible that once I get past this error, I could potentially run into another one. So I will try to take some time to run the Seurat.R script on my data to reveal all of them.

hepcat72 commented 4 years ago

OK. I ran through the Seurat.R script manually in R Studio and though I can get past the FindNeighbors step described above by using dims = 1:numPCs, I run into the same impasse I encountered when I was following the scrna tutorial I was using, which is:

seuset <- Seurat::RunTSNE(seuset, dims = 1:numPCs, resolution = resolution)

Error in .check_tsne_params(nrow(X), dims = dims, perplexity = perplexity,  : 
  perplexity is too large for the number of samples

So unless you know how one would address that (which I have not figured out), perhaps altering the FindNeighbors call is pointless. This dataset produced by our core may just be too small to run through Seurat?

hepcat72 commented 4 years ago

I discovered here that you can get through this step by supplying a value for perplexity, which enables me to view the tSNE plot in the subsequent step:

seuset <- Seurat::RunTSNE(seuset, dims = 1:numPCs, resolution = resolution, perplexity = 2)

However, I end up hitting another error 2 steps later:

> markers <- Seurat::FindAllMarkers(seuset, only.pos = TRUE, min.pct = min_pct, logfc.threshold = logfc_threshold)
Calculating cluster 0
Warning: No DE genes identified
Warning: The following tests were not performed: 
Warning: When testing 0 versus all:
    Cell group 2 is empty - no cells with identity class 
> 
> top10 <- dplyr::group_by(markers, cluster)
Error: Column `cluster` is unknown