Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kloot opened this issue Oct 31, 2023 · 0 comments
Assignees

Comments

@kloot
Copy link

kloot commented Oct 31, 2023

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!

@innesbre innesbre self-assigned this Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants