Skip to content

Commit

Permalink
nicer error message when anndata already has a field named 'gene' at …
Browse files Browse the repository at this point in the history
…the 'var' slot
  • Loading branch information
aviezerl committed May 1, 2024
1 parent 5cd5a94 commit 1cfb2d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/import.R
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ import_dataset <- function(project,
)
serialize_shiny_data(qc_stats, "qc_stats", dataset = dataset, cache_dir = cache_dir)

if (has_name(adata$var, "gene")){
cli::cli_abort("A column named {.field 'gene'} already exists in the var slot of the anndata object. Please rename it to avoid conflicts.")
}

gene_qc <- adata$var %>%
rownames_to_column("gene") %>%
select(gene) %>%
Expand Down

0 comments on commit 1cfb2d0

Please sign in to comment.