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

Bug when using joinFeatures + SingleCellExperiment with 1 cell #60

Open
multimeric opened this issue Apr 20, 2023 · 1 comment
Open
Assignees

Comments

@multimeric
Copy link

multimeric commented Apr 20, 2023

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 ATGCCAHLA-DRA       0    0    Seurat70      47 0       A       g2
2 CATGGCHLA-DRA       1    4.78 Seurat85      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   ATGCCASeurat70      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"
@multimeric multimeric changed the title Bug when using joinFeatures + SingleCellExperiment with ` row Bug when using joinFeatures + SingleCellExperiment with 1 cell Apr 20, 2023
@stemangiola
Copy link
Owner

Thanks Michael. I will have a look.

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

3 participants