Skip to content

Commit

Permalink
[r] hotfix for release directory JSON parsing problem (#649)
Browse files Browse the repository at this point in the history
Our way of converting the release directory JSON to a convenient data frame was too brittle for recent updates to release_directory.json. Fix by switching from `rbind` to the more flexible `dplyr::bind_rows`. (Our package already transitively depended on dplyr via Seurat and others.)
  • Loading branch information
mlin authored Jul 26, 2023
1 parent e9f5d9a commit 6065e1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/r/cellxgene.census/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RoxygenNote: 7.2.3
Additional_repositories: https://tiledb-inc.r-universe.dev
Imports:
aws.s3,
dplyr,
httr,
jsonlite,
methods,
Expand Down
1 change: 1 addition & 0 deletions api/r/cellxgene.census/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export(get_source_h5ad_uri)
export(new_SOMATileDBContext_for_census)
export(open_soma)
importFrom(aws.s3,save_object)
importFrom(dplyr,bind_rows)
importFrom(httr,build_url)
importFrom(httr,parse_url)
importFrom(jsonlite,fromJSON)
Expand Down
3 changes: 2 additions & 1 deletion api/r/cellxgene.census/R/release_directory.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ get_census_version_description <- function(census_version) {
#' @return Data frame of available cell census releases, including location and
#' metadata.
#' @importFrom jsonlite fromJSON
#' @importFrom dplyr bind_rows
#' @export
#'
#' @examples
Expand All @@ -50,7 +51,7 @@ get_census_version_directory <- function() {
raw <- simple_rapply(raw, function(x) ifelse(is.null(x), "", x))

# Convert nested list to data frame
df <- do.call(rbind, lapply(raw, as.data.frame))
df <- do.call(dplyr::bind_rows, lapply(raw, as.data.frame))
rownames(df) <- names(raw)
return(df)
}
Expand Down
6 changes: 4 additions & 2 deletions api/r/cellxgene.census/man/get_seurat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6065e1d

Please sign in to comment.