Skip to content

initial implementation of from_Seurat - #64

Merged
rcannood merged 15 commits into
mainfrom
implement_from_seurat
May 16, 2023
Merged

rcannood merged 15 commits into
mainfrom
implement_from_seurat

Conversation

@rcannood

@rcannood rcannood commented May 4, 2023

Copy link
Copy Markdown
Member

Closes #60

@rcannood

rcannood commented May 5, 2023

Copy link
Copy Markdown
Member Author

The PR currently contains code to check whether there are conflicts in the var keys.

  # detect conflicting var keys
  var_keys_checker <- do.call(rbind, lapply(names(seurat_obj@assays), function(assay_name) {
    var_keys <- colnames(seurat_obj@assays[[assay_name]]@meta.features)
    if (length(var_keys) > 0) {
      data.frame(
        assay = assay_name,
        var_key = var_keys
      )
    } else {
      NULL
    }
  }))
  duplicated_var_keys <- unique(var_keys_checker$var_key[duplicated(var_keys_checker$var_key)])
  var_keys_checker$conflict <- var_keys_checker$var_key %in% duplicated_var_keys
  var_keys_checker$renamed_var_key <- ifelse(
    var_keys_checker$conflict,
    paste0(var_keys_checker$assay, "_", var_keys_checker$var_key),
    var_keys_checker$var_key
  )

I'm thinking if the var keys are the same across assays, they can be stored in the AnnData. However, if there are conflicts, we should throw an error saying that MuData should be used instead.

@rcannood

rcannood commented May 8, 2023

Copy link
Copy Markdown
Member Author

Will need to be updated based on our discussion in #72

@rcannood
rcannood marked this pull request as ready for review May 16, 2023 17:50
@rcannood

Copy link
Copy Markdown
Member Author

to_Seurat needs more unit tests, but the PR is already ready to be merged :)

@rcannood
rcannood merged commit b9502ef into main May 16, 2023
lazappi added a commit that referenced this pull request May 22, 2023
* origin/main: (23 commits)
  initial implementation of from_Seurat (#64)
  only check size when the names are already defined
  todo: add back obs_names and var_names length check
  update roxygen
  move required args to the front
  Update R/HDF5-read.R
  fix lint issues
  update tests
  refactor code to assume obs_names and var_names are defined
  Style and lint
  Add rhdf5 package skipe to HDF5 tests
  Add 1D sparse array to example.h5ad
  Remove requireNamespace("rhdf5")
  Fix bug in read_h5ad_string_array()
  Add support for reading H5AD rec arrays
  Covert 1D string arrays to vectors in read_h5ad_string_array()
  Update tests to use example.h5ad
  wip changes for #76
  Remove Krumsiek augemented dataset
  Reduce example H5AD to 50 cells x 100 genes
  ...
@rcannood
rcannood deleted the implement_from_seurat branch July 5, 2023 10:37
lazappi added a commit that referenced this pull request Jul 5, 2023
* main: (26 commits)
  add gthb pat
  Update HDF5 writing functions and implement data frame writing (#85)
  remove shape trackstatus for now
  initial implementation of from_Seurat (#64)
  only check size when the names are already defined
  todo: add back obs_names and var_names length check
  update roxygen
  move required args to the front
  Update R/HDF5-read.R
  fix lint issues
  update tests
  refactor code to assume obs_names and var_names are defined
  Style and lint
  Add rhdf5 package skipe to HDF5 tests
  Add 1D sparse array to example.h5ad
  Remove requireNamespace("rhdf5")
  Fix bug in read_h5ad_string_array()
  Add support for reading H5AD rec arrays
  Covert 1D string arrays to vectors in read_h5ad_string_array()
  Update tests to use example.h5ad
  ...
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

Successfully merging this pull request may close these issues.

Implement from_Seurat and to_Seurat

1 participant