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

Error in SummarizedExperiment::SummarizedExperiment(assays = assay_mats, : the rownames and colnames of the supplied assay(s) must be NULL or identical to those of the SummarizedExperiment object (or derivative) to construct #96

Open
multimeric opened this issue Mar 8, 2023 · 2 comments

Comments

@multimeric
Copy link

I have a SOMA object that I created from AnnData. It seems (?) to be valid:

> soma$obs$to_dataframe() |> rownames() |> head()
Reading AnnotationDataframe into memory from 'file:///vast/scratch/users/milton.m/soma/obs'
[1] "exp1-human-102.TAATCAGCTTTCGGCCTTAC" "exp1-human-103.CGATTCGCTCGGCGTAACT"
[3] "exp1-human-105.TGTCCTTATTACCTCTATCT" "exp1-human-107.ATCAGTCATTGCTAACTTGC"
[5] "exp1-human-110.TTCTGGCCTGGCTCTCTAT"  "exp1-human-113.GTAGCGATTTGAGTCTGGC"
> soma$var$to_dataframe() |> rownames() |> head()
Reading AnnotationDataframe into memory from 'file:///vast/scratch/users/milton.m/soma/var'
[1] "5S_rRNA_ENSG00000276861" "5S_rRNA_ENSG00000277411"
[3] "5S_rRNA_ENSG00000277488" "5S_rRNA_ENSG00000285609"
[5] "5S_rRNA_ENSG00000285626" "5S_rRNA_ENSG00000285674"
> soma$X$get_member("data")$to_matrix() |> dim()
Reading AssayMatrix into memory from 'file:///vast/scratch/users/milton.m/soma/X/data'
[1]  1535 17832
> soma$X$get_member("data")$to_matrix() |> rownames() |> head()
Reading AssayMatrix into memory from 'file:///vast/scratch/users/milton.m/soma/X/data'
[1] "exp1-human-102.TAATCAGCTTTCGGCCTTAC" "exp1-human-103.CGATTCGCTCGGCGTAACT"
[3] "exp1-human-105.TGTCCTTATTACCTCTATCT" "exp1-human-107.ATCAGTCATTGCTAACTTGC"
[5] "exp1-human-110.TTCTGGCCTGGCTCTCTAT"  "exp1-human-113.GTAGCGATTTGAGTCTGGC"
> soma$X$get_member("data")$to_matrix() |> colnames() |> head()
Reading AssayMatrix into memory from 'file:///vast/scratch/users/milton.m/soma/X/data'
[1] "ABHD2"  "ABL1"   "ADAM10" "ADAM12" "ADAM19" "ADAM9"

However, when converting to SingleCellExperiment (or SummarizedExperiment, it fails:

> sce = soma$to_single_cell_experiment()
Reading AssayMatrix into memory from 'file:///vast/scratch/users/milton.m/soma/X/data'
Reading AnnotationDataframe into memory from 'file:///vast/scratch/users/milton.m/soma/obs'
Reading AnnotationDataframe into memory from 'file:///vast/scratch/users/milton.m/soma/var'
Error in SummarizedExperiment::SummarizedExperiment(assays = assay_mats,  :
  the rownames and colnames of the supplied assay(s) must be NULL or
  identical to those of the SummarizedExperiment object (or derivative)
  to construct
> se = soma$to_summarized_experiment()
Reading AssayMatrix into memory from 'file:///vast/scratch/users/milton.m/soma/X/data'
Reading AnnotationDataframe into memory from 'file:///vast/scratch/users/milton.m/soma/obs'
Reading AnnotationDataframe into memory from 'file:///vast/scratch/users/milton.m/soma/var'
Error in SummarizedExperiment::SummarizedExperiment(assays = assay_mats,  :
  the rownames and colnames of the supplied assay(s) must be NULL or
  identical to those of the SummarizedExperiment object (or derivative)
  to construct

Any ideas what is happening here? My feeling is there is just a small bug in the to_summarized_experiment() method.

@aaronwolen
Copy link
Member

I believe this error indicates that the order of either the sample or feature metadata table doesn't align with the assay matrix.
Does your dataset contain multiple assays (i.e., is there more than 1 array within /vast/scratch/users/milton.m/soma/X)?

Would it be possible to share the data you used so we can attempt to reproduce?

@multimeric
Copy link
Author

It contains only one assay, but conceivably the order of labels are wrong between two different sources. If this is the case, then it's because the Python anndata -> SOMA conversion is messing with the order somehow. What command should I run to try to diagnose this? I think sending the data would be difficult at this point.

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