scverse/anndataR

Decide on how to name conversion functions

Closed this issue · 5 comments

Currently: to_SingleCellExperiment, to_Seurat, to_InMemory

However, this mixes snake_case and CamelCase.

  • Option 1: to_SingleCellExperiment, to_Seurat, to_InMemory
  • Option 2: to_sce, to_seurat, to_inmemory
  • Option 3: to_single_cell_experiment, to_seurat, to_in_memory
  • ...?

Originally mentioned in #41

In addition, should conversion functions be part of the AbstractAnnData or separate functions?

  • Option A: to_sce(adata), to_seurat(adata), to_inmemory(adata)
  • Option B: adata$to_sce(), adata$to_seurat(), adata$to_inmemory()

Originally mentioned in #40

I would prefer 2B or 3B, namely:

adata$to_sce()
adata$to_seurat()
adata$to_inmemory()

Where these functions are implemented in the AbstractAnnData as:

    to_sce = function() {
      .to_sce(adata)
    },
    to_seurat = function() {
      .to_seurat(adata)
    },
    to_inmemory = function() {
      .to_inmemory(adata)
    },

With .to_sce contained in SingleCellExperiment.R, to_seurat contained in Seurat.R and .to_inmemory contained in InMemoryAnnData.R.

@mtmorgan @lazappi What are your thoughts on this?

I think there is a case for 1 because that is the capitalization for the classes that are being converted to. I'm not super fussed about A or B because I don't think normal users should ever really be using these functions directly.

Yeah I've come to feel that there isn't any value in using abbreviations for user-facing functions -- it's hard enough to know what a SingleCellExperiment is, what the heck is an 'sce'? But a compromise would be to have 3B implemented as

to_sce = function() {
  to_SingleCellExperiment(adata)
},
to_seurat = function() {
  to_Seurat(adata)
},
to_inmemory = function() {
  to_InMemoryAnnData(adata)
}

Shall we go for the following then?

In AbstractAnnData.R:

    to_SingleCellExperiment = function() {
      to_SingleCellExperiment(adata)
    },
    to_Seurat = function() {
      to_Seurat(adata)
    },
    to_InMemoryAnnData = function() {
      to_InMemoryAnnData(adata)
    },

With SingleCellExperiment.R:

#' ...
#' @export
to_SingleCellExperiment <- function(adata) { # nolint
  ...
}

#' ...
#' @export
from_SingleCellExperiment <- function(sce) { # nolint
  ...
}

# ... helper functions (not exported) ...

And so on.