Open NoemieL opened 10 months ago
Hello Noemie,
it seems that one of the samples is failing the pre-filtering with scGate (i.e. the detection of CD8 T cells before projection into the reference). Perhaps you can try to identify which sample is causing the error? One way to do this is to split the dataset by sample and projecting them one by one. If there is anything special about that sample, i.e. very few cells, we can narrow down the source of the error.
Best -m
Hello Massimo,
Thanks for your quick reply. In the meantime, I've tried a few other things and if I set DefaultAssay(merged_seurat.SCT2)="RNA" instead of integrated, it works. Is it correct to do this?
> DefaultAssay(merged_seurat.SCT2)="integrated"
> merged_seurat.SCT2 <- ProjecTILs.classifier(merged_seurat.SCT2v, CD8T_human_ref,ncores = 12, split.by = "patients")
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 1. Consider reviewing signatures or model layout...
### Detected a total of 2181 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "2181 out of 2181 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 2. Consider reviewing signatures or model layout...
### Detected a total of 3316 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "3316 out of 3316 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 2. Consider reviewing signatures or model layout...
### Detected a total of 4003 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "4003 out of 4003 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 1. Consider reviewing signatures or model layout...
### Detected a total of 4710 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "4710 out of 4710 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 2. Consider reviewing signatures or model layout...
### Detected a total of 3302 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "3302 out of 3302 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 1. Consider reviewing signatures or model layout...
### Detected a total of 2233 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "2233 out of 2233 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 1. Consider reviewing signatures or model layout...
### Detected a total of 4288 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "4288 out of 4288 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay integrated for query"
Pre-filtering cells with scGate...
|===============================================================================================================================================| 100%
Error: BiocParallel errors
1 remote errors, element index: 3
0 unevaluated and other errors
first remote error: BiocParallel errors
1 remote errors, element index: 1
0 unevaluated and other errors
first remote error: dim(X) must have a positive length
In addition: Warning message:
stop worker failed:
wrong args for environment subassignment
> DefaultAssay(merged_seurat.SCT2)="RNA"
> merged_seurat.SCT2 <- ProjecTILs.classifier(merged_seurat.SCT2, CD8T_human_ref,ncores = 12, split.by = "patients")
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 3. Consider reviewing signatures or model layout...
### Detected a total of 2181 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "2181 out of 2181 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 1. Consider reviewing signatures or model layout...
### Detected a total of 4710 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "4710 out of 4710 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 3. Consider reviewing signatures or model layout...
### Detected a total of 4288 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "4288 out of 4288 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 2. Consider reviewing signatures or model layout...
### Detected a total of 5086 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "5086 out of 5086 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 3. Consider reviewing signatures or model layout...
### Detected a total of 6318 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "6318 out of 6318 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 8751 non-pure cells for selected signatures - 99.82% cells marked for removal (active.ident)
[1] "8751 out of 8767 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
Alignment failed due to: Error in irlba(A = t(x = object), nv = npcs, ...): max(nu, nv) must be strictly less than min(nrow(A), ncol(A))
Warning: alignment of query dataset failed - Trying direct projection...
[1] "DIRECTLY projecting query onto Reference PCA space"
[1] "DIRECTLY projecting query onto Reference UMAP space"
Warning: Not all features provided are in this Assay object, removing the following feature(s): CXCL13, GPR15, H1-4, WARS1, CARS1, H2AZ1, H1-10, H1-3, H1-2, POLR1F, H2AC6, H4C3, MIDEAS, H2AJ, H4C8, H2AC11
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 3519 non-pure cells for selected signatures - 87.91% cells marked for removal (active.ident)
[1] "3519 out of 4003 ( 88% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=12s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=06s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 2691 non-pure cells for selected signatures - 81.15% cells marked for removal (active.ident)
[1] "2691 out of 3316 ( 81% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=15s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 2788 non-pure cells for selected signatures - 84.43% cells marked for removal (active.ident)
[1] "2788 out of 3302 ( 84% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=19s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=06s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 2. Consider reviewing signatures or model layout...
### Detected a total of 2233 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "2233 out of 2233 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 7014 non-pure cells for selected signatures - 97.28% cells marked for removal (active.ident)
[1] "7014 out of 7210 ( 97% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=06s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 4449 non-pure cells for selected signatures - 98.63% cells marked for removal (active.ident)
[1] "4449 out of 4511 ( 99% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=17s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=04s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
Warning, all cells were removed at level 3. Consider reviewing signatures or model layout...
### Detected a total of 8580 non-pure cells for selected signatures - 100.00% cells marked for removal (active.ident)
[1] "8580 out of 8580 ( 100% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Warning! Skipping query - all cells were removed by cell filter
|===============================================================================================================================================| 100%
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 6513 non-pure cells for selected signatures - 80.43% cells marked for removal (active.ident)
[1] "6513 out of 8098 ( 80% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=14s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
| | 0%[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
### Detected a total of 11532 non-pure cells for selected signatures - 82.33% cells marked for removal (active.ident)
[1] "11532 out of 14007 ( 82% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
Preparing PCA embeddings for objects...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09s
Projecting corrected query onto Reference PCA space
Projecting corrected query onto Reference UMAP space
|===============================================================================================================================================| 100%
Creating slots functional.cluster and functional.cluster.conf in query object
> table(merged_seurat.SCT2$functional.cluster, useNA = "ifany")
CD8.CM CD8.EM CD8.MAIT CD8.NaiveLike CD8.TEMRA CD8.TEX CD8.TPEX <NA>
405 1011 19 2722 1668 125 7 80653
Hello Noemie,
I would definitely recommend NOT to use the integrated assay for your query data. ProjecTILs is already taking care of the batch effect correction by projecting each sample separetely, so I'd recommend using the uncorrected RNA assay for the query (or alternatively SCT if you believe that is a better normalization). Besides, the 'integrated' assay by default will only contain the variable genes for the query; that may also limit the ability of the method to align the query and the reference.
Best -massimo
Hello Massimo,
I see thank you for this clarification! Should I also used the RNA assay for the reference, in your tutorial Exhausted CD8 T cells are associated with ICB responsiveness in breast cancer they are set up at integrated DefaultAssay(ref.cd4) <- "integrated"
. Thanks for your help.
Best Noemie
Hello, Thank you for this excellent software. I am trying to compare ProjecTILs annotation with Azimuth. I have a large dataset from bone marrow aspirations and would like to annotate all the immune cells present. I used SCTransform to prepare the data. When I try to annotate my full dataset for T cells with ProjecTIL references, I got the following error only with CD8 T cell references, but not with CD4 T cells or MoMac references:
I have no problem when I perform a subset of my data to keep only the T cells based on azimuth annotation. I can't figure out how to solve the problem in the whole data set. Could you please help me?
Thanks Noémie