Open RobertAlpin opened 5 years ago
I also have the same error when I try to save Seurat object as loom file, but I don't have any message says "Execution halted". I have also checked if it is caused by non-unique gene symbols or cell names, but I get the same error after fixing that too. Additionally, I have an error while reading Seurat-created loom file in scanpy with a different dataset. https://github.com/theislab/scanpy/issues/598
Apologies, the "Execution halted" line is an artifact of the server I'm running this on. I'll edit the post to remove it to avoid future confusion.
I could successfully save loom file after running Seurat workflow. @RobertAlpin
Hi @RobertAlpin,
Sorry for the delay; could you provide the object, or a downsampled version of it, that I could test this on? I haven't seen this before, so I don't know where to begin.
I've cut down my expression matrix to the first 20 cells (or at least I hope I did,removing columns in R has been acting funny on me). The Seurat object was made from the larger version of this file.
I did some troubleshooting and it seems like the issue might be with needing the srobj$RNA@meta.features
table to have columns. I tested converting to loom, at each stage of the standard workflow:
pbmc <- NormalizeData(object = pbmc)
pbmc <- FindVariableFeatures(object = pbmc) # works with only this step done
pbmc <- ScaleData(object = pbmc)
pbmc <- RunPCA(object = pbmc)
pbmc <- FindNeighbors(object = pbmc)
pbmc <- FindClusters(object = pbmc)
pbmc <- RunTSNE(object = pbmc)
DimPlot(object = pbmc, reduction = "tsne")
And it works as soon as the variable features are selected.
The output then writes
Transposing input data: loom file will show input columns (cells) as rows and input rows (features) as columns
This is to maintain compatibility with other loom tools
|======================================================================| 100%
Adding: CellID
Adding: Gene
Adding a layer to norm_data (layer 1 of 1)
|======================================================================| 100%
Adding: vst_mean
Adding: vst_variance
Adding: vst_variance_expected
Adding: vst_variance_standardized
Adding: vst_variable
Adding: Selected
Adding: orig_ident
Adding: nCount_RNA
Adding: nFeature_RNA
Adding: ClusterID
Adding: ClusterName
No scaled data present, not adding scaled data, dimensional reduction information, or neighbor graphs
Thanks! It works! @BenjaminDoran
Hi @BenjaminDoran
Would please give an example of how to change the srobj$RNA@meta.features
to be a table? what kind of information do you add in? (I am using Seurat 3)
Thanks, HM
Just do:
srobj <- FindVariableFeatures(object = srobj)
Seurat's function adds the data
Thanks.. working for me. HM
Out of curiosity is there a way to get the as.loom() function to run without normalizing and finding the variable features in Seurat? I was hoping to export the .loom file to test it out in Scanpy and I would prefer to normalize the data with their function to keep any differences between the two from causing errors.
If not I can try doing so in Seurat and seeing what happens.
@BenjaminDoran @cakirb
Can you please provide more information on how you fixed the issue?
I am having the same problem. Getting an error when trying to convert an integrated Seurat object into a loom file:
I am using the code below to create the loom file:
singlecell.combined.loom <- as.loom(singlecell.combined, filename = "/PATH/singlecell.combined.loom", verbose = FALSE)
The output writes:
Transposing input data: loom file will show input columns (cells) as rows and input rows (features) as columns
This is to maintain compatibility with other loom tools
Adding: CellID
Adding: Gene
Error in attributes[[i]] : subscript out of bounds
@JoaoGabrielMoraes , it seems as simple as needing something in the VariableFeatures slot. When as.loom
does the conversion, it crashes if there's nothing found in that slot. So just run FindVariableFeatures and you're good to go. You could probably also just put a single gene name in there if you wanted.
I have the same concern as @ArcusGears . I would like to export the raw data and have it normalized by ScanPy. However, I suspect that Scanpy will use the raw data from the Loom object, and that "finding the variable features" is just a way to put something in there so that Loom does not crash.
Am I understanding correctly?
I'm not sure if this is a problem necessarily for Seurat or LoomR, but when I try to convert my seurat object to a loom file, I get the following output:
I suspected at first this might have been caused by create.names putting underscores in gene names (which Seurat should automatically be able to compensate for), but using gsub to remove those before creating a Seurat object didn't help. Does anyone know why I might be getting this error?
R is version 3.5.3. LoomR, Seurat are both the latest development versions and HDF5r is the most recent full release.