Skip to content

Advice to adapt Iterative Clustering Workflow with Seurat v4.x (throws error)  #53

@kloot

Description

@kloot

Hi, I really like scClustViz' principle of using biologically relevant parameters to help select 'best' resolution - many thanks for developing and publishing clustViz!

I'm trying to adapt the Iterative Clustering workflow code (from README.md) to an object created with Seurat v4.4
It seems there are some differences in the (default) meta.data column names in the Seurat v4 object vs the Seurat version used in the published workflow (v2?) that create problems

Changing all occurrences of your_seurat_obj@ident to [email protected] works fine for the first iteration of the while{} loop. However the following code block (not executed on the first iteration) returns an error on the second iteration:

if (length(sCVdata_list) >= 1) {                                                                  
    temp_cl <- length(levels(Clusters(sCVdata_list[[length(sCVdata_list)]])))
    if (temp_cl == length(levels([email protected]))) {    ## throws ERROR
      temp_cli <- length(levels(interaction(
        Clusters(sCVdata_list[[length(sCVdata_list)]]),
        [email protected],
        drop=T
        )))
      if (temp_cli == length(levels([email protected]))) { 
        next 
        }
    }

At the point the error is thrown, the Seurat object's metadata slot contains:
SCT_snn_res.0.2 (resolution=0.2, created in the 1st iteration: 14 clusters in my example)
SCT_snn_res.0.4 (resolution=0.4, created in the 2nd iteration: 17 clusters in my example)

In the second line of the 'offending' codeblock (copied above), I do not understand what [email protected] refers to (its original version is seurat_resolution@ident, which is similarly unclear to me)

Would you be so kind to explain the logic of the two if conditions in the code block so that I can try to find the appropriate data from the Seurat object? Or ideally, let us now which Seurat v4 data should be used ;-)

Many thanks in advance!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions