Closed hchintalapudi closed 3 years ago
Your error message is:
Error: No features to use in finding transfer anchors. To troubleshoot, try explicitly providing features to the features parameter and ensure that they are present in both reference and query assays.
Did you check the feature names in the assays and make sure there are common features present?
Also, please format your code in future so that it's readable: https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks
Hi @timoast , Apologies, I was in a hurry. I reformatted everything properly.
I checked like this:
table(Annotation(combined.2)$gene_name %in% rownames(all.integrated))
FALSE TRUE
212522 1183354
I don't understand why this is giving me an error:
gene.activities <- GeneActivity(combined.2, features = VariableFeatures(all.integrated))
Extracting gene coordinates
Error in SingleFeatureMatrix(fragment = fragments[[x]], features = features, :
No matching chromosomes found in fragment file.
I checked the 'Annotation()' obj and one of the fragment files and the chr names seem to be uniform.
Not using the 'features' argument makes it work and then I get in to the issue of not finding 'TransferAnchors'
table(Annotation(combined.2)$gene_name %in% rownames(all.integrated))
This does not check for common features between the two different assays. The gene annotation information stored in the chromatin assay is a separate thing to the features in the assay itself.
The GeneActivity()
function error message should give you a clue here: "No matching chromosomes found in fragment file." This suggests that the chromosome names in the gene annotation you're using are different to the chromosome names in the fragment file. They need to match for GeneActivity()
to work properly.
I'd suggest looking at the number of genes in common between the gene.activities
matrix that you generate and the all.integrated
object.
Thanks for your comment.
gene.activities <- GeneActivity(combined.2)
table(rownames(gene.activities) %in% rownames(all.integrated))
FALSE TRUE
5513 18959
I see that majority are common.
*Update on this (05/06/21): I've had success in running RNA+ATAC integration in the past, but not on merged/integrated objects, only on single replicate samples. So I tried to see what was different. I notice that my single sample seurat obj shows variable features:
rna
An object of class Seurat
29701 features across 1184 samples within 2 assays
Active assay: SCT (13293 features, 3000 variable features)
1 other assay present: RNA
But my integrated obj doesn't:
all.integrated
An object of class Seurat
38576 features across 8687 samples within 3 assays
Active assay: RNA (19363 features, 0 variable features)
2 other assays present: SCT, integrated
3 dimensional reductions calculated: pca, umap, tsne
And that's why I get these error messages:
gene.activities <- GeneActivity(combined.2, features = VariableFeatures(all.integrated))
Extracting gene coordinates
Error in SingleFeatureMatrix(fragment = fragments[[x]], features = features, :
No matching chromosomes found in fragment file.
transfer.anchors <- FindTransferAnchors(
+ reference = all.integrated,
+ reference.assay = 'RNA',
+ query.assay = 'RNA',
+ query = combined.2,
+ reduction = 'cca',
+ features = VariableFeatures(all.integrated)
+ )
Error: No features to use in finding transfer anchors. To troubleshoot, try explicitly providing features to the features parameter and ensure that they are present in both reference and query assays.
So I tried to supply the features to the 'FindTransferAnchors' function like so:
transfer.anchors <- FindTransferAnchors(
+ reference = all.integrated,
+ reference.assay = 'RNA',
+ query.assay = 'RNA',
+ query = combined.2,
+ reduction = 'cca',
+ features = all.integrated@assays$integrated@var.features
+ )
And I had success with integration:
Warning: 9 features of the features specified were not present in both the reference query assays.
Continuing with remaining 2991 features.
Running CCA
Merging objects
Finding neighborhoods
Finding anchors
Found 18543 anchors
Filtering anchors
Retained 1762 anchors
Hi @timoast, Can you tell me why this is happening? Just curious.
Thanks a lot!
Another question about ScATAC data: My merged object shows clusters that do not overlap at all. The samples of similar groups are more like 'biological replicates' and we did not significant batch effects, so it was concerning to see this. (FYI CellRanger peak calling was done sample wise and not aggregated) I tried tweaking the dimensions but it didn't affect the UMAPs much.
Do you have any opinion on this? Is Integration the way to go here? tmp.1.pdf tmp.2.pdf tmp.3_dims2:5.pdf
Thank you!
FYI CellRanger peak calling was done sample wise and not aggregated
It's essential that a common set of peaks are used when merging or integrating multiple datasets. See the merge vignette for more information. If you quantify the same peak set across the different datasets prior to merging and still observe a batch effect, you could try using integration (vignette here)
Hi, I have ScRNA and ScATAC data from same experiment (not multiomic) and I followed the merge vignette to merge the 5 samples (2 groups) based on intersecting peaks as shown in the vignette. Coming to the ScRNA data, I have similar 5 samples and I SCtransformed them, integrated them and then annotated the clusters. I'm looking to integrate both the integrated RNA object and merged ATAC object and co-embed them as shown here: https://satijalab.org/seurat/articles/atacseq_integration_vignette.html#co-embedding-scrna-seq-and-scatac-seq-datasets
However, I get an error:
Here's my merge code for ATAC data:
Some additional & relevant info:
One of the fragment files:
The chromosome names match in both, also tried changing seqlevelsStyle(annotations) to 'NCBI' but I don't see any change. Some tips would be appreciated!
my code for RNA integration:
Many thanks for the amazing tools developed.