tidySingleCellExperiment
tidySingleCellExperiment copied to clipboard
Bug when using `joinFeatures` + `SingleCellExperiment` with 1 cell
There is some weird behaviour when using a SingleCellExperiment with one cell. Firstly, note that we have two .cell columns in the second example, and both of them become part of the full coldata:
This example works fine:
> tidySingleCellExperiment::pbmc_small[, 1:2] |> tidySingleCellExperiment::join_features("HLA-DRA")
# A SingleCellExperiment-tibble abstraction: 2 × 20
# Features=230 | Cells=2 | Assays=counts, logcounts
.cell .feat…¹ .abun…² .abun…³ orig.…⁴ nCoun…⁵ nFeat…⁶ RNA_s…⁷ lette…⁸ groups
<chr> <chr> <dbl> <dbl> <fct> <dbl> <int> <fct> <fct> <chr>
1 ATGCCA… HLA-DRA 0 0 Seurat… 70 47 0 A g2
2 CATGGC… HLA-DRA 1 4.78 Seurat… 85 52 0 A g1
# … with 10 more variables: RNA_snn_res.1 <fct>, file <chr>, ident <fct>,
# PC_1 <dbl>, PC_2 <dbl>, PC_3 <dbl>, PC_4 <dbl>, PC_5 <dbl>, tSNE_1 <dbl>,
# tSNE_2 <dbl>, and abbreviated variable names ¹.feature, ².abundance_counts,
# ³.abundance_logcounts, ⁴orig.ident, ⁵nCount_RNA, ⁶nFeature_RNA,
# ⁷RNA_snn_res.0.8, ⁸letter.idents
# ℹ Use `colnames()` to see all variable names
But as soon as we use one cell:
> tidySingleCellExperiment::pbmc_small[, 1] |> tidySingleCellExperiment::join_features("HLA-DRA")
New names:
• `.cell` -> `.cell...1`
• `.cell` -> `.cell...2`
tidySingleCellExperiment says: Key columns are missing. A data frame is returned for independent data analysis.
# A tibble: 1 × 35
.feature .abundance_…¹ .abun…² .cell…³ .cell…⁴ orig.…⁵ nCoun…⁶ nFeat…⁷ RNA_s…⁸
<chr> <dbl> <dbl> <chr> <chr> <fct> <dbl> <int> <fct>
1 HLA-DRA 0 0 .cell ATGCCA… Seurat… 70 47 0
# … with 26 more variables: letter.idents <fct>, groups <chr>,
# RNA_snn_res.1 <fct>, file <chr>, ident <fct>, PC_1 <dbl>, PC_2 <dbl>,
# PC_3 <dbl>, PC_4 <dbl>, PC_5 <dbl>, PC_6 <dbl>, PC_7 <dbl>, PC_8 <dbl>,
# PC_9 <dbl>, PC_10 <dbl>, PC_11 <dbl>, PC_12 <dbl>, PC_13 <dbl>,
# PC_14 <dbl>, PC_15 <dbl>, PC_16 <dbl>, PC_17 <dbl>, PC_18 <dbl>,
# PC_19 <dbl>, tSNE_1 <dbl>, tSNE_2 <dbl>, and abbreviated variable names
# ¹.abundance_counts, ².abundance_logcounts, ³.cell...1, ⁴.cell...2, …
# ℹ Use `colnames()` to see all variable names
> tidySingleCellExperiment::pbmc_small[, 1] |> tidySingleCellExperiment::join_features("HLA-DRA") |> colnames()
New names:
• `.cell` -> `.cell...1`
• `.cell` -> `.cell...2`
tidySingleCellExperiment says: Key columns are missing. A data frame is returned for independent data analysis.
[1] ".feature" ".abundance_counts" ".abundance_logcounts"
[4] ".cell...1" ".cell...2" "orig.ident"
[7] "nCount_RNA" "nFeature_RNA" "RNA_snn_res.0.8"
[10] "letter.idents" "groups" "RNA_snn_res.1"
[13] "file" "ident" "PC_1"
[16] "PC_2" "PC_3" "PC_4"
[19] "PC_5" "PC_6" "PC_7"
[22] "PC_8" "PC_9" "PC_10"
[25] "PC_11" "PC_12" "PC_13"
[28] "PC_14" "PC_15" "PC_16"
[31] "PC_17" "PC_18" "PC_19"
[34] "tSNE_1" "tSNE_2"
Thanks Michael. I will have a look.