From 5e1857138d1f4c50411372a993fab59ad20134d9 Mon Sep 17 00:00:00 2001 From: dimalvovs Date: Thu, 7 Dec 2023 16:59:19 -0500 Subject: [PATCH 1/3] add description --- R/utils.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index 87960d1e..3397a372 100644 --- a/R/utils.R +++ b/R/utils.R @@ -23,8 +23,8 @@ check_arg <- function(arg, allow_class = c("character"), allow_len = NULL) { #' Read in data if an object looks like path to it. #' -#' @param obj -#' @return obj the object itself in case its not a character +#' @param obj Object to read if not already object +#' @return obj Object itself in case its not a character read_if_char <- function(obj) { if (is(obj, "character")) { obj <- read.csv(obj, stringsAsFactors = FALSE) From 5e38f97f949ebee2aaaecfd6f239c918c7826265 Mon Sep 17 00:00:00 2001 From: dimalvovs Date: Thu, 7 Dec 2023 17:02:17 -0500 Subject: [PATCH 2/3] update docs --- man/check_arg.Rd | 18 ++++++++++++++++++ man/conv_py_bools.Rd | 17 +++++++++++++++++ man/create_rl_map_cellphonedb.Rd | 5 +---- man/read_if_char.Rd | 17 +++++++++++++++++ 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 man/check_arg.Rd create mode 100644 man/conv_py_bools.Rd create mode 100644 man/read_if_char.Rd diff --git a/man/check_arg.Rd b/man/check_arg.Rd new file mode 100644 index 00000000..83da77a1 --- /dev/null +++ b/man/check_arg.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{check_arg} +\alias{check_arg} +\title{Check input arguments} +\usage{ +check_arg(arg, allow_class = c("character"), allow_len = NULL) +} +\arguments{ +\item{arg}{The argument to check} + +\item{allow_class}{Vector of allowed classes} + +\item{allow_len}{Vector of allowed lengths} +} +\description{ +Accepts an object and rules for checking, stops if rules not met. +} diff --git a/man/conv_py_bools.Rd b/man/conv_py_bools.Rd new file mode 100644 index 00000000..da33af50 --- /dev/null +++ b/man/conv_py_bools.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{conv_py_bools} +\alias{conv_py_bools} +\title{Change cases of True/False syntax from Python to TRUE/FALSE R syntax} +\usage{ +conv_py_bools(obj) +} +\arguments{ +\item{obj}{Object that will be converted} +} +\value{ +obj The converted object +} +\description{ +Change cases of True/False syntax from Python to TRUE/FALSE R syntax +} diff --git a/man/create_rl_map_cellphonedb.Rd b/man/create_rl_map_cellphonedb.Rd index 9156776c..7075a559 100644 --- a/man/create_rl_map_cellphonedb.Rd +++ b/man/create_rl_map_cellphonedb.Rd @@ -12,7 +12,6 @@ create_rl_map_cellphonedb( database_name = "CellPhoneDB", gene_conv = NULL, gene_conv_host = "https://www.ensembl.org", - alternate_convert = FALSE, alternate_convert_table = NULL ) } @@ -31,9 +30,7 @@ create_rl_map_cellphonedb( \item{gene_conv_host}{host for conversion; default ensembl, could also use mirrors if desired} -\item{alternate_convert}{boolean if you would like to use a non-ensembl method of conversion (must supply table; not recommended, use only if ensembl is down)} - -\item{alternate_convert_table}{supplied table for non-ensembl method of conversion} +\item{alternate_convert_table}{supplied table for non-ensembl method of conversion (not recommended, use only if ensembl is down))} } \value{ Data frame where each row describes a possible receptor-ligand interaction diff --git a/man/read_if_char.Rd b/man/read_if_char.Rd new file mode 100644 index 00000000..7efac3de --- /dev/null +++ b/man/read_if_char.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{read_if_char} +\alias{read_if_char} +\title{Read in data if an object looks like path to it.} +\usage{ +read_if_char(obj) +} +\arguments{ +\item{obj}{Object to read if not already object} +} +\value{ +obj Object itself in case its not a character +} +\description{ +Read in data if an object looks like path to it. +} From 112cc7088921b99197e11021975f3d1abcc73abd Mon Sep 17 00:00:00 2001 From: dimalvovs Date: Thu, 7 Dec 2023 17:16:33 -0500 Subject: [PATCH 3/3] adjust tests (to tiny) --- tests/testthat/test-import_fxns.R | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/testthat/test-import_fxns.R b/tests/testthat/test-import_fxns.R index 6789e51c..43192663 100644 --- a/tests/testthat/test-import_fxns.R +++ b/tests/testthat/test-import_fxns.R @@ -79,37 +79,36 @@ test_that("building a domino object under set parameters", { }) test_that("create_rl_map_cellphonedb fails on wrong input arg type.", { - load(test_path("testdata", "sysdata.rda")) expect_error(create_rl_map_cellphonedb( - genes = list(), proteins = proteins_test, - interactions = interactions_test, complexes = complexes_test + genes = list(), proteins = proteins_tiny, + interactions = interactions_tiny, complexes = complexes_tiny )) expect_error(create_rl_map_cellphonedb( - genes = genes_test, proteins = list(), - interactions = interactions_test, complexes = complexes_test + genes = genes_tiny, proteins = list(), + interactions = interactions_tiny, complexes = complexes_tiny )) expect_error(create_rl_map_cellphonedb( - genes = genes_test, proteins = proteins_test, - interactions = list(), complexes = complexes_test + genes = genes_tiny, proteins = proteins_tiny, + interactions = list(), complexes = complexes_tiny )) expect_error(create_rl_map_cellphonedb( - genes = genes_test, proteins = proteins_test, - interactions = interactions_test, complexes = list() + genes = genes_tiny, proteins = proteins_tiny, + interactions = interactions_tiny, complexes = list() )) expect_error(create_rl_map_cellphonedb( - genes = genes_test, proteins = proteins_test, - interactions = interactions_test, complexes = complexes_test, + genes = genes_tiny, proteins = proteins_tiny, + interactions = interactions_tiny, complexes = complexes_tiny, database_name = list() )) expect_error(create_rl_map_cellphonedb( - genes = genes_test, proteins = proteins_test, - interactions = interactions_test, complexes = complexes_test, + genes = genes_tiny, proteins = proteins_tiny, + interactions = interactions_tiny, complexes = complexes_tiny, database_name = c("length", ">1") )) })