diff --git a/R/prep_fiji_coords.R b/R/prep_fiji_coords.R index 03c9940..8d3d0e8 100644 --- a/R/prep_fiji_coords.R +++ b/R/prep_fiji_coords.R @@ -7,12 +7,10 @@ #' file from Spaceranger, and transform using the rotation matrix specified #' by Fiji. Write one new \code{tissue_positions.csv} file per group. #' -#' @param sample_info A \code{tibble} with columns \code{capture_area}, -#' \code{group}, \code{fiji_xml_path}, \code{intra_group_scalar}, and -#' \code{group_hires_scalef} #' @param out_dir A character(1) vector giving a path to a directory to place #' the output pixel coordinates CSVs. Provided the parent exists, \code{out_dir} #' will be created if necessary. +#' @inheritParams add_array_coords #' #' @return This function returns `character()` with the file paths to the #' `tissue_positions.csv` files it created. diff --git a/R/prep_fiji_image.R b/R/prep_fiji_image.R index 1a6d2ef..7e5a507 100644 --- a/R/prep_fiji_image.R +++ b/R/prep_fiji_image.R @@ -7,15 +7,13 @@ #' Spaceranger's. In conjunction with \code{prep_fiji_image()}, this function #' prepares for building the \code{SpatialExperiment} with \code{build_spe()}. #' -#' @param sample_info A \code{tibble} with columns \code{capture_area}, -#' \code{group}, \code{fiji_image_path}, \code{spaceranger_dir}, -#' \code{intra_group_scalar}, and \code{group_hires_scalef} #' @param out_dir A character(1) vector giving a path to a directory to place #' the output image(s) and scale factors. Provided the parent exists, \code{out_dir} #' will be created if necessary. #' @param lowres_max_size An integer(1) vector: the resolution (number of #' pixels) of the larger dimension of the output image(s), considered to be "low #' resolution". +#' @inheritParams add_array_coords #' #' @return This function returns `character()` with the file paths to the #' `tissue_lowres_image.png` and `scalefactors_json.json` files it created. diff --git a/R/rescale_fiji_inputs.R b/R/rescale_fiji_inputs.R index 6028b06..6d19a6e 100644 --- a/R/rescale_fiji_inputs.R +++ b/R/rescale_fiji_inputs.R @@ -17,11 +17,10 @@ #' (as from Spaceranger's \code{scalefactors_json.json} file) appropriate for #' every capture area from the group. #' -#' @param sample_info A \code{tibble} with columns \code{capture_area}, -#' \code{group}, and \code{spaceranger_dir} #' @param out_dir A character(1) vector giving a path to a directory to place #' the output images. Provided the parent exists, \code{out_dir} #' will be created if necessary. +#' @inheritParams add_array_coords #' #' @return A \code{tibble}: a copy of \code{sample_info} with additional columns #' \code{intra_group_scalar} and \code{group_hires_scalef} diff --git a/man/prep_fiji_coords.Rd b/man/prep_fiji_coords.Rd index ec482d9..e559e5e 100644 --- a/man/prep_fiji_coords.Rd +++ b/man/prep_fiji_coords.Rd @@ -7,9 +7,8 @@ prep_fiji_coords(sample_info, out_dir) } \arguments{ -\item{sample_info}{A \code{tibble} with columns \code{capture_area}, -\code{group}, \code{fiji_xml_path}, \code{intra_group_scalar}, and -\code{group_hires_scalef}} +\item{sample_info}{A \code{tibble} with columns \code{capture_area} and +\code{group}} \item{out_dir}{A character(1) vector giving a path to a directory to place the output pixel coordinates CSVs. Provided the parent exists, \code{out_dir} @@ -55,7 +54,7 @@ sample_info$fiji_image_path <- temp[grep("png$", temp)] sample_info <- rescale_fiji_inputs(sample_info, out_dir = tempdir()) spe_input_dir <- tempdir() -out_file = prep_fiji_coords(sample_info, out_dir = spe_input_dir) +out_file <- prep_fiji_coords(sample_info, out_dir = spe_input_dir) # A file of spatial coordinates for the stitched Br2719 was produced print(readr::read_csv(out_file)) diff --git a/man/prep_fiji_image.Rd b/man/prep_fiji_image.Rd index 6a45337..c51b3de 100644 --- a/man/prep_fiji_image.Rd +++ b/man/prep_fiji_image.Rd @@ -7,9 +7,8 @@ prep_fiji_image(sample_info, out_dir, lowres_max_size = 1200) } \arguments{ -\item{sample_info}{A \code{tibble} with columns \code{capture_area}, -\code{group}, \code{fiji_image_path}, \code{spaceranger_dir}, -\code{intra_group_scalar}, and \code{group_hires_scalef}} +\item{sample_info}{A \code{tibble} with columns \code{capture_area} and +\code{group}} \item{out_dir}{A character(1) vector giving a path to a directory to place the output image(s) and scale factors. Provided the parent exists, \code{out_dir} @@ -59,7 +58,7 @@ sample_info$fiji_image_path <- temp[grep("png$", temp)] sample_info <- rescale_fiji_inputs(sample_info, out_dir = tempdir()) spe_input_dir <- tempdir() -out_paths = prep_fiji_image( +out_paths <- prep_fiji_image( sample_info, out_dir = spe_input_dir, lowres_max_size = 1000 ) diff --git a/man/rescale_fiji_inputs.Rd b/man/rescale_fiji_inputs.Rd index 305c071..c90b94d 100644 --- a/man/rescale_fiji_inputs.Rd +++ b/man/rescale_fiji_inputs.Rd @@ -7,8 +7,8 @@ rescale_fiji_inputs(sample_info, out_dir) } \arguments{ -\item{sample_info}{A \code{tibble} with columns \code{capture_area}, -\code{group}, and \code{spaceranger_dir}} +\item{sample_info}{A \code{tibble} with columns \code{capture_area} and +\code{group}} \item{out_dir}{A character(1) vector giving a path to a directory to place the output images. Provided the parent exists, \code{out_dir} diff --git a/tests/testthat/test-prep_fiji_coords.R b/tests/testthat/test-prep_fiji_coords.R index 3948b4b..7b4f2eb 100644 --- a/tests/testthat/test-prep_fiji_coords.R +++ b/tests/testthat/test-prep_fiji_coords.R @@ -39,7 +39,7 @@ test_that( expect_equal(file.exists(out_file_actual), TRUE) # The tissue positions should have the expected columns - coords <- readr::read_csv(out_file, show_col_types = FALSE) + coords <- readr::read_csv(out_file_expected, show_col_types = FALSE) expect_equal( colnames(coords), c( diff --git a/tests/testthat/test-prep_fiji_image.R b/tests/testthat/test-prep_fiji_image.R index 4376142..417c489 100644 --- a/tests/testthat/test-prep_fiji_image.R +++ b/tests/testthat/test-prep_fiji_image.R @@ -40,7 +40,7 @@ test_that( file.path(spe_input_dir, "Br2719", "scalefactors_json.json") ) expect_equal(all(file.exists(out_paths_expected)), TRUE) - expect_equal(setequal(out_paths_actual, out_paths_expected)) + expect_equal(setequal(out_paths_actual, out_paths_expected), TRUE) # The image should have the correct maximal dimension size this_image <- imager::load.image(out_paths_expected[1])