andygxzeng / BoneMarrowMap

A single cell RNA-seq reference map of human hematopoietic development in the bone marrow, with balanced representation of hematopoietic stem and progenitor cells and differentiated populations
GNU General Public License v3.0
18 stars 3 forks source link

Fix issue with 1xn dummy count matrix not working with CreateSeuratObject #3

Closed adam-cornwell closed 10 months ago

adam-cornwell commented 10 months ago

With Seurat 5.0 at least, a single-row count matrix does not work for CreateSeuratObject(). Also simplified the creation of the matrix to avoid having to create it and then transpose. The matrix is changed to a sparse matrix by Seurat, so adding a row doesn't affect the memory profile much since it's all 0s. Tested with Seurat 5.0 in R 4.3.2

andygxzeng commented 10 months ago

Thanks so much Adam, really appreciate the PR I made a small tweak to your code to ensure it is still compatible with Seurat v4 (I haven't made the switch yet!)