diff --git a/DESCRIPTION b/DESCRIPTION
index 015dc2e..08a5676 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -25,7 +25,7 @@ BugReports: https://github.com/RajLabMSSM/echoverseTemplate/issues
Encoding: UTF-8
Depends: R (>= 4.1)
biocViews:
- Genetics, FunctionalGenomics, SystemsBiology
+ Software, Genetics, FunctionalGenomics, SystemsBiology
Imports:
Suggests:
rworkflows,
diff --git a/R/args2vars.R b/R/args2vars.R
deleted file mode 100644
index 0641643..0000000
--- a/R/args2vars.R
+++ /dev/null
@@ -1,69 +0,0 @@
-#' Set function argument defaults to global variables
-#'
-#' Useful for development, where you want to quickly initialize default values
-#' for a function while editing its internal code.
-#'
-#' Note the lack of parentheses at the end of the function
-#' (to avoid calling it).
-#'
-#' @param fn The function for which you want to convert its default
-#' argument values into global variables (e.g. \code{utils::packageDate}).
-#' @param remove If \code{TRUE}, will remove globals
-#' assigned by \code{args2vars} (if supplying the same \code{fn} as before).
-#' If the global does not exist, it will be skipped.
-#' @param run_source_all Source all R scripts first.
-#' @inheritParams base::assign
-#' @inheritDotParams source_all
-#'
-#' @keywords internal
-#' @returns A named list with each argument's default value, or simply a
-#' \link[base]{stop} function declaring "No default".
-#' @source
-#' \code{
-#' #### Example (note the ::: notation as it is an internal function) ####
-#' args_return <- echoverseTemplate:::args2vars(fn = utils::packageDate)
-#' }
-args2vars <- function(fn,
- remove = FALSE,
- envir = .GlobalEnv,
- run_source_all = TRUE,
- ...){
- requireNamespace("rlang")
-
- if(isTRUE(run_source_all)) source_all(...)
- argument_list <- rlang::fn_fmls(fn = fn)
- args_return <- lapply(names(argument_list), function(arg){
- if(remove){
- message("Removing global: ",arg)
- if(exists(arg, envir = envir)){
- rm(list = arg, pos = envir, envir = envir)
- }
- } else {
- message("Assigning global ->> ",arg)
- }
- #### Parse arguments ####
- arg_final <- tryCatch({
- arg_out <- argument_list[[arg]]
- if(methods::is(arg_out,"call")){
- arg_out <- tryCatch({
- eval(arg_out)
- }, error = function(e) arg_out)
- }
- arg_out
- }, error = function(e) function(){stop("No default")})
- #### Assign global ####
- if(remove){
- if(exists(arg, envir = envir)) warning("Global removal failed.")
- } else {
- assign(x = arg,
- value = arg_final,
- pos = .GlobalEnv,
- envir = .GlobalEnv)
- if(!exists(arg, envir = envir)) warning("Global assignment failed.")
- }
- return(arg_final)
- })
- names(args_return) <- names(argument_list)
- print(args_return)
- return(args_return)
-}
diff --git a/R/source_all.R b/R/source_all.R
deleted file mode 100644
index 79954e0..0000000
--- a/R/source_all.R
+++ /dev/null
@@ -1,38 +0,0 @@
-#' Source all functions
-#'
-#' Source all R files in a directory at once.
-#' Also loads selected libraries.
-#' This function can be useful when developing R packages,
-#' instead of rebuilding the entire package every time you make a change
-#' (which is a more robust way to checking the package works,
-#' but is much slower).
-#'
-#' @param path Directory containing R files.
-#' @param pattern File name pattern to search for.
-#' @param packages Packages to load.
-#' @param ... Additional arguments passed to \link[base]{sys.source}.
-#' @inheritParams base::sys.source
-#'
-#' @return Null
-#' @keywords internal
-source_all <- function(path="R/",
- pattern="*.R$",
- packages = NULL,
- envir = globalenv(),
- ...){
- for(x in packages){
- require(x, character.only=TRUE)
- }
- #### Source all internal funcs at once ####
- file.sources = list.files(path = path,
- pattern = pattern,
- full.names = TRUE, ignore.case = TRUE)
-
- if(length(file.sources)>0){
- message("Sourcing ",length(file.sources)," files.")
- } else {
- message("No files found to source.")
- }
- out <- lapply(X = file.sources,
- FUN = function(x){try({sys.source(x,envir = envir, ...)})})
-}
diff --git a/README.Rmd b/README.Rmd
index 941c155..f8e5d5d 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -1,6 +1,6 @@
---
title: ""
-author: "`r rworkflows::use_badges()`"
+author: "`r rworkflows::use_badges(add_doi = '10.1093/bioinformatics/btab658')`"
output:
github_document
---
@@ -30,7 +30,7 @@ library(`r pkg`)
## Documentation
### [Website](https://rajlabmssm.github.io/`r pkg`)
-### [Getting started](https://rajlabmssm.github.io/`r pkg`/articles/`r pkg`)
+### [Get started](https://rajlabmssm.github.io/`r pkg`/articles/`r pkg`)
diff --git a/README.md b/README.md
index 19d9851..bfef821 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,17 @@
-
+
+[![License:
+GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://cran.r-project.org/web/licenses/GPL-3)
+[![](https://img.shields.io/badge/doi-10.1093/bioinformatics/btab658-blue.svg)](https://doi.org/10.1093/bioinformatics/btab658)
[![](https://img.shields.io/badge/devel%20version-0.99.0-black.svg)](https://github.com/RajLabMSSM/echoverseTemplate)
-[![R build
-status](https://github.com/RajLabMSSM/echoverseTemplate/workflows/rworkflows/badge.svg)](https://github.com/RajLabMSSM/echoverseTemplate/actions)
-[![](https://img.shields.io/github/last-commit/RajLabMSSM/echoverseTemplate.svg)](https://github.com/RajLabMSSM/echoverseTemplate/commits/master)
[![](https://img.shields.io/github/languages/code-size/RajLabMSSM/echoverseTemplate.svg)](https://github.com/RajLabMSSM/echoverseTemplate)
+[![](https://img.shields.io/github/last-commit/RajLabMSSM/echoverseTemplate.svg)](https://github.com/RajLabMSSM/echoverseTemplate/commits/master)
+
[![R build
+status](https://github.com/RajLabMSSM/echoverseTemplate/workflows/rworkflows/badge.svg)](https://github.com/RajLabMSSM/echoverseTemplate/actions)
[![](https://codecov.io/gh/RajLabMSSM/echoverseTemplate/branch/master/graph/badge.svg)](https://codecov.io/gh/RajLabMSSM/echoverseTemplate)
-[![License:
-GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://cran.r-project.org/web/licenses/GPL-3)
-¶ ¶ Authors: Brian Schilder, Jack Humphrey, Towfique Raj ¶
+
+
+
+Authors: Brian Schilder, Jack Humphrey, Towfique Raj
## `echoverseTemplate`: echoversePackageDescription.
diff --git a/man/args2vars.Rd b/man/args2vars.Rd
deleted file mode 100644
index 3c15cc8..0000000
--- a/man/args2vars.Rd
+++ /dev/null
@@ -1,47 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/args2vars.R
-\name{args2vars}
-\alias{args2vars}
-\title{Set function argument defaults to global variables}
-\source{
-\code{
-#### Example (note the ::: notation as it is an internal function) ####
-args_return <- echoverseTemplate:::args2vars(fn = utils::packageDate)
-}
-}
-\usage{
-args2vars(fn, remove = FALSE, envir = .GlobalEnv, run_source_all = TRUE, ...)
-}
-\arguments{
-\item{fn}{The function for which you want to convert its default
-argument values into global variables (e.g. \code{utils::packageDate}).}
-
-\item{remove}{If \code{TRUE}, will remove globals
-assigned by \code{args2vars} (if supplying the same \code{fn} as before).
-If the global does not exist, it will be skipped.}
-
-\item{envir}{the \code{\link[base]{environment}} to use. See \sQuote{Details}.}
-
-\item{run_source_all}{Source all R scripts first.}
-
-\item{...}{
- Arguments passed on to \code{\link[=source_all]{source_all}}
- \describe{
- \item{\code{path}}{Directory containing R files.}
- \item{\code{pattern}}{File name pattern to search for.}
- \item{\code{packages}}{Packages to load.}
- }}
-}
-\value{
-A named list with each argument's default value, or simply a
-\link[base]{stop} function declaring "No default".
-}
-\description{
-Useful for development, where you want to quickly initialize default values
-for a function while editing its internal code.
-}
-\details{
-Note the lack of parentheses at the end of the function
-(to avoid calling it).
-}
-\keyword{internal}
diff --git a/man/source_all.Rd b/man/source_all.Rd
deleted file mode 100644
index 07bdbd4..0000000
--- a/man/source_all.Rd
+++ /dev/null
@@ -1,42 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/source_all.R
-\name{source_all}
-\alias{source_all}
-\title{Source all functions}
-\usage{
-source_all(
- path = "R/",
- pattern = "*.R$",
- packages = NULL,
- envir = globalenv(),
- ...
-)
-}
-\arguments{
-\item{path}{Directory containing R files.}
-
-\item{pattern}{File name pattern to search for.}
-
-\item{packages}{Packages to load.}
-
-\item{envir}{an \R object specifying the environment in which the
- expressions are to be evaluated. May also be a list or an integer.
- The default \code{\link[base]{baseenv}()} corresponds to evaluation in the base
- environment. This is probably not what you want; you should
- typically supply an explicit \code{envir} argument, see the
- \sQuote{Note}.}
-
-\item{...}{Additional arguments passed to \link[base]{sys.source}.}
-}
-\value{
-Null
-}
-\description{
-Source all R files in a directory at once.
-Also loads selected libraries.
-This function can be useful when developing R packages,
-instead of rebuilding the entire package every time you make a change
-(which is a more robust way to checking the package works,
-but is much slower).
-}
-\keyword{internal}
diff --git a/tests/testthat/test-args2vars.R b/tests/testthat/test-args2vars.R
deleted file mode 100644
index 0be8a69..0000000
--- a/tests/testthat/test-args2vars.R
+++ /dev/null
@@ -1,39 +0,0 @@
-test_that("args2vars works", {
-
- fn <- utils::packageDate
- args <- rlang::fn_fmls(fn = fn)
-
- run_tests <- function(args, args_return){
- testthat::expect_equal(names(args_return), names(args))
- testthat::expect_equal(
- args_return$date.fields,
- c("Date","Packaged","Date/Publication","Built")
- )
- testthat::expect_null(args_return$lib.loc)
- testthat::expect_error(args_return$pkg())
- }
-
- args_return <- echoverseTemplate:::args2vars(fn = fn)
- #### Check list output ####
- run_tests(args = args,
- args_return = args_return)
- #### Check globals ####
- #### Check that each argument also exists are a variable in the namespace
- for(arg in names(args_return)){
- message(arg)
- testthat::expect_true(exists(arg, envir = .GlobalEnv))
- }
-
- #### Reverse / remove globals ####
- args_return2 <- echoverseTemplate:::args2vars(fn = fn,
- remove = TRUE)
- #### Check list output ####
- run_tests(args = args,
- args_return = args_return2)
- #### Check globals ####
- #### Check that each argument also exists are a variable in the namespace
- for(arg in names(args_return)){
- message(arg)
- testthat::expect_false(exists(arg, envir = .GlobalEnv))
- }
-})
diff --git a/tests/testthat/test-source_all.R b/tests/testthat/test-source_all.R
deleted file mode 100644
index b49c506..0000000
--- a/tests/testthat/test-source_all.R
+++ /dev/null
@@ -1,40 +0,0 @@
-test_that("source_all works", {
-
- ## NOTE: By default, this unit test will only work when being
- ## run through R CMD checks.
- ## To manually run these tests, set `manual <- TRUE`.
- ##
- ## Also note, scoping the environment is important here,
- ## because testthat uses its own environment during testing.
- ##
- ## See here for usage of devtools::code_coverage() in this context:
- ## https://github.com/r-lib/covr/issues/487
- manual <- FALSE
-
- ## Create new test env
- env <- testthat::test_env()
- ## This function might be helpful
- ## but there's zero documentation on how to use it.
- # testthat::source_test_setup(path = "tests/testthat", env = env)
-
- #### Successful sourcing ####
- testthat::source_test_helpers(env = env)
- # setwd(here::here())
- source_all(
- path = if(manual) "./R" else "../../R" ,
- env = env)
- globals <- ls(envir = env)
- message("globals: ",paste(globals,collapse = ", "))
- # testthat::expect_true(
- # all(c("messager","message_parallel","source_all") %in% globals)
- # )
-
- #### Failed sourcing ####
- ## Create new test env
- env <- testthat::test_env()
- rm(list = ls(envir = env))
- source_all(path = "typoooo",
- envir = env)
- globals <- ls(envir = env)
- testthat::expect_false("messager" %in% globals)
-})
diff --git a/vignettes/echoverseTemplate.Rmd b/vignettes/echoverseTemplate.Rmd
index b03631d..7d4b791 100644
--- a/vignettes/echoverseTemplate.Rmd
+++ b/vignettes/echoverseTemplate.Rmd
@@ -1,13 +1,14 @@
---
-title: "Getting Started"
-author: "Author: Brian M. Schilder
"
-date: "Updated: `r format( Sys.Date(), '%b-%d-%Y')`
"
-output:
- BiocStyle::html_document
-vignette: >
- %\VignetteIndexEntry{echodata}
- %\usepackage[utf8]{inputenc}
- %\VignetteEngine{knitr::rmarkdown}
+title: Get started
+author: 'Authors: `r auths <- eval(parse(text = gsub("person","c",read.dcf("../DESCRIPTION",
+ fields = "Authors@R"))));paste(auths[names(auths)=="given"],auths[names(auths)=="family"],
+ collapse = ", ")`
'
+date: 'Vignette updated: `r format( Sys.Date(), "%b-%d-%Y")`
'
+output: BiocStyle::html_document
+vignette: |
+ %\VignetteIndexEntry{echoverseTemplate}
+ %\usepackage[utf8]{inputenc}
+ %\VignetteEngine{knitr::rmarkdown}
---
@@ -38,3 +39,4 @@ utils::sessionInfo()
+