Skip to content

Commit

Permalink
remove read_h5ad_* rd of functions that are not exported (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood authored Sep 18, 2023
1 parent 43f68c1 commit fc08613
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 346 deletions.
31 changes: 30 additions & 1 deletion R/read_h5ad_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' @param name Name of the element within the H5AD file
#'
#' @return A named list with names type and version
#'
#' @noRd
read_h5ad_encoding <- function(file, name) {
attrs <- rhdf5::h5readAttributes(file, name)

Expand Down Expand Up @@ -37,8 +39,9 @@ read_h5ad_encoding <- function(file, name) {
#' Encoding is automatically determined from the element using
#' `read_h5ad_encoding` and used to select the appropriate reading function.
#'
#'
#' @return Value depending on the encoding
#'
#' @noRd
read_h5ad_element <- function(file, name, type = NULL, version = NULL, ...) {
if (is.null(type)) {
encoding_list <- read_h5ad_encoding(file, name)
Expand Down Expand Up @@ -77,6 +80,8 @@ read_h5ad_element <- function(file, name, type = NULL, version = NULL, ...) {
#' @param version Encoding version of the element to read
#'
#' @return a matrix or a vector if 1D
#'
#' @noRd
read_h5ad_dense_array <- function(file, name, version = "0.2.0") {
version <- match.arg(version)
# TODO: ideally, native = TRUE should take care of the row order and column order,
Expand Down Expand Up @@ -118,6 +123,8 @@ read_h5ad_csc_matrix <- function(file, name, version) {
#'
#' @return a sparse matrix/DelayedArray???, or a vector if 1D
#' @importFrom Matrix sparseMatrix
#'
#' @noRd
read_h5ad_sparse_array <- function(file, name, version = "0.1.0",
type = c("csr_matrix", "csc_matrix")) {
version <- match.arg(version)
Expand Down Expand Up @@ -168,6 +175,8 @@ read_h5ad_sparse_array <- function(file, name, version = "0.1.0",
#' They are used by **scanpy** to score marker gene testing results.
#'
#' @return a named list of 1D arrays
#'
#' @noRd
read_h5ad_rec_array <- function(file, name, version = "0.2.0") {
version <- match.arg(version)

Expand Down Expand Up @@ -196,6 +205,8 @@ read_h5ad_nullable_boolean <- function(file, name, version = "0.1.0") {
#' @param version Encoding version of the element to read
#'
#' @return an integer vector
#'
#' @noRd
read_h5ad_nullable_integer <- function(file, name, version = "0.1.0") {
as.integer(read_h5ad_nullable(file, name, version))
}
Expand All @@ -209,6 +220,8 @@ read_h5ad_nullable_integer <- function(file, name, version = "0.1.0") {
#' @param version Encoding version of the element to read
#'
#' @return a nullable vector
#'
#' @noRd
read_h5ad_nullable <- function(file, name, version = "0.1.0") {
version <- match.arg(version)

Expand Down Expand Up @@ -236,6 +249,8 @@ read_h5ad_nullable <- function(file, name, version = "0.1.0") {
#' @param version Encoding version of the element to read
#'
#' @return a character vector/matrix
#'
#' @noRd
read_h5ad_string_array <- function(file, name, version = "0.2.0") {
version <- match.arg(version)
# reads in transposed
Expand All @@ -261,6 +276,8 @@ read_h5ad_string_array <- function(file, name, version = "0.2.0") {
#' @param version Encoding version of the element to read
#'
#' @return a factor
#'
#' @noRd
read_h5ad_categorical <- function(file, name, version = "0.2.0") {
version <- match.arg(version)

Expand Down Expand Up @@ -304,6 +321,8 @@ read_h5ad_categorical <- function(file, name, version = "0.2.0") {
#' @param version Encoding version of the element to read
#'
#' @return a character vector of length 1
#'
#' @noRd
read_h5ad_string_scalar <- function(file, name, version = "0.2.0") {
version <- match.arg(version)
rhdf5::h5read(file, name)
Expand All @@ -318,6 +337,8 @@ read_h5ad_string_scalar <- function(file, name, version = "0.2.0") {
#' @param version Encoding version of the element to read
#'
#' @return a numeric vector of length 1
#'
#' @noRd
read_h5ad_numeric_scalar <- function(file, name, version = "0.2.0") {
version <- match.arg(version)
rhdf5::h5read(file, name)
Expand All @@ -332,6 +353,8 @@ read_h5ad_numeric_scalar <- function(file, name, version = "0.2.0") {
#' @param version Encoding version of the element to read
#'
#' @return a named list
#'
#' @noRd
read_h5ad_mapping <- function(file, name, version = "0.1.0") {
version <- match.arg(version)
groupname <- paste0("/", name)
Expand All @@ -358,6 +381,8 @@ read_h5ad_mapping <- function(file, name, version = "0.1.0") {
#' is not provided in the output. In either case row names are not set.
#'
#' @return a data.frame
#'
#' @noRd
read_h5ad_data_frame <- function(file, name, include_index = TRUE,
version = "0.2.0") {
version <- match.arg(version)
Expand Down Expand Up @@ -400,6 +425,8 @@ read_h5ad_data_frame <- function(file, name, include_index = TRUE,
#' @param version Encoding version of the element to read
#'
#' @return an object containing the index
#'
#' @noRd
read_h5ad_data_frame_index <- function(file, name, version = "0.2.0") {
version <- match.arg(version)

Expand All @@ -416,6 +443,8 @@ read_h5ad_data_frame_index <- function(file, name, version = "0.2.0") {
#' @param column_order Vector of item names (in order)
#'
#' @return a named list
#'
#' @noRd
read_h5ad_collection <- function(file, name, column_order) {
columns <- list()
for (col_name in column_order) {
Expand Down
2 changes: 1 addition & 1 deletion R/write_h5ad.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' ncells <- 100
#' counts <- matrix(rpois(20000, 5), ncol = ncells)
#' logcounts <- log2(counts + 1)
#
#' #
#' pca <- matrix(runif(ncells * 5), ncells)
#' tsne <- matrix(rnorm(ncells * 2), ncells)
#'
Expand Down
21 changes: 0 additions & 21 deletions man/read_h5ad_categorical.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/read_h5ad_collection.Rd

This file was deleted.

29 changes: 0 additions & 29 deletions man/read_h5ad_data_frame.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/read_h5ad_data_frame_index.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/read_h5ad_dense_array.Rd

This file was deleted.

29 changes: 0 additions & 29 deletions man/read_h5ad_element.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/read_h5ad_encoding.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/read_h5ad_mapping.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/read_h5ad_nullable.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/read_h5ad_nullable_integer.Rd

This file was deleted.

Loading

0 comments on commit fc08613

Please sign in to comment.