This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Seurat v5 subsetting object based on gene counts

Hi there,

I am fairly new to the single cell field and accidentally updated Seurat to V5 which doesn't seem to be compatible with my code.

I am using sorted cells and subset each individual object based on expression of particular genes to remove any contaminating cells as below:

T1.data <- Read10X(data.dir = "TY01")  
meta_rownames <- colnames(T1.data) 
ty01_metadata <- aux_metadata[rep(seq_len(nrow(aux_metadata["TY01",])), each = length(meta_rownames)) * which(row.names(aux_metadata) == "TY01"),] 
row.names(ty01_metadata) <- meta_rownames 
TY01 <- CreateSeuratObject(counts = T1.data, project = "TY01", meta.data = ty01_metadata)

TY01 = subset(TY01, subset = CD3E < 1 & CD3D)

In seurat V5 I now get this error and am unsure how to resolve it:

Warning: No layers found matching search pattern provided
Error in FetchData.Assay5(object = object[[DefaultAssay(object = object)]],  : 
  layer "data" is not found in the object

If I proceed without subsetting based on gene counts and run standard preprocessing, I now get a strange error when I try to run FindAllMarkers as below:

  all.markers <- FindAllMarkers(object = PBMC.FILTERED)
    Calculating cluster 0
    Calculating cluster 1
    Calculating cluster 2
    Calculating cluster 3
    Calculating cluster 4
    Calculating cluster 5
    Calculating cluster 6
    Calculating cluster 7
    Calculating cluster 8
    Calculating cluster 9
    Calculating cluster 10
    Calculating cluster 11
    Calculating cluster 12
    Warning: No DE genes identified
    Warning: The following tests were not performed: 
    Warning: When testing 0 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 1 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 2 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 3 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 4 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 5 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 6 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 7 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 8 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 9 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 10 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 11 versus all:
        data layers are not joined. Please run JoinLayers
    Warning: When testing 12 versus all:
        data layers are not joined. Please run JoinLayers

This is not resolved by running JoinLayers.

Anyone have any idea what might be going on? Thank you!

seuratv5 seurat single-cell

1 answer

As an update I was able to revert to Seurat v 4.4.0 but had some issues with Matrix and Irlba as R wasn't recognising gfortran anymore.

The below fixed this and I was able to rerun all of my code again with the old Seurat https://stackoverflow.com/questions/69639782/installing-gfortran-on-macbook-with-apple-m1-chip-for-use-in-r

Log in to answer this question.