Skip to content

Commit

Permalink
don't convert if < 2 genes/features
Browse files Browse the repository at this point in the history
  • Loading branch information
allyhawkins committed Nov 6, 2023
1 parent ca04ccd commit e8bab59
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/sce_to_anndata.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ sce_to_anndata <- function(sce, anndata_file, x_assay_name = "counts") {
stop("Input SingleCellExperiment must contain at least 2 cells.")
}

if(nrow(sce) < 2){
stop("Input SingleCellExperiment must contain at least 2 genes or features.")
}

# check that filename is in the proper format for writing h5
if (!(stringr::str_ends(anndata_file, ".hdf5|.h5"))) {
stop("`anndata_file` must end in either '.hdf5' or '.h5'")
Expand Down

0 comments on commit e8bab59

Please sign in to comment.