diff --git a/DESCRIPTION b/DESCRIPTION index 4370dd8..aec3cae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -4,8 +4,9 @@ Title: Templates and functions to guide downstream analysis and data interpretat Version: 0.1.0 Authors@R: person("Pantano", "Lorena", , "lorena.pantano@gmail.com", role = c("aut", "cre")) -Description: Collaborative code repository from the Harvard Chan Bioinformatics Core. +Description: Collaborative code repository at the Harvard Chan Bioinformatics Core. License: MIT + file LICENSE LazyData: true Encoding: UTF-8 Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1 diff --git a/NAMESPACE b/NAMESPACE index d75f824..5a75104 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1 +1,4 @@ -exportPattern("^[[:alpha:]]+") +# Generated by roxygen2: do not edit by hand + +export(bcbio_set_project) +export(bcbio_start_project) diff --git a/R/hello.R b/R/hello.R index c61eb13..e27efda 100644 --- a/R/hello.R +++ b/R/hello.R @@ -13,7 +13,68 @@ # Check Package: 'Cmd + Shift + E' # Test Package: 'Cmd + Shift + T' +#' @export +bcbio_set_project <- function() { + hbc_code <- readline("What is the hbc code:\n") + project <- readline("What is the project name:\n") + dropbox <- readline("What is the dropbox name:\n") + github_org <- readline("What is the github organization:\n") + project_full <- paste0(project, "_", hbc_code) + github <- c(github_org,project_full) + opts <- list(code=hbc_code, project=project_full, + dropbox=file.path(dropbox,project_full), + github=github) + print(opts) + return(opts) +} + +#' @export +bcbio_start_project <- function(options) { + +} + hello <- function() { print("Hello, world!") } + +# This function showcases how one might write a function to be used as an +# RStudio project template. This function will be called when the user invokes +# the New Project wizard using the project template defined in the template file +# at: +# +# inst/rstudio/templates/project/hello_world.dcf +# +# The function itself just echos its inputs and outputs to a file called INDEX, +# which is then opened by RStudio when the new project is opened. +rnaseq <- function(path, ...) { + + # ensure path exists + dir.create(path, recursive = TRUE, showWarnings = FALSE) + + # generate header + header <- c( + "# This file was generated by a call to 'ptexamples::hello_world()'.", + "# The following inputs were received:", + "" + ) + + # collect inputs + dots <- list(...) + text <- lapply(seq_along(dots), function(i) { + key <- names(dots)[[i]] + val <- dots[[i]] + paste0(key, ": ", val) + }) + + # collect into single text string + contents <- paste( + paste(header, collapse = "\n"), + paste(text, collapse = "\n"), + sep = "\n" + ) + + # write to index file + writeLines(contents, con = file.path(path, "README.md")) + +} diff --git a/inst/rmarkdown/templates/project/rnaseq.dcf b/inst/rmarkdown/templates/project/rnaseq.dcf new file mode 100644 index 0000000..d71a643 --- /dev/null +++ b/inst/rmarkdown/templates/project/rnaseq.dcf @@ -0,0 +1,28 @@ +Binding: rnaseq +Title: RNAseq Analysis +OpenFiles: README.md + +Parameter: check +Widget: CheckboxInput +Label: Checkbox Input +Default: On +Position: left + +Parameter: select +Widget: SelectInput +Label: Select Input +Fields: Field A, Field B, Field C +Default: Field B +Position: left + +Parameter: text +Widget: TextInput +Label: Text Input +Default: Hello, world! +Position: right + +Parameter: file +Widget: FileInput +Label: File Input +Default: ~/ +Position: right diff --git a/inst/rmarkdown/templates/rnaseq/skeleton/README.md b/inst/rmarkdown/templates/rnaseq/skeleton/README.md new file mode 100644 index 0000000..0e4c4ef --- /dev/null +++ b/inst/rmarkdown/templates/rnaseq/skeleton/README.md @@ -0,0 +1,9 @@ +# TODO + +[ ] Replace Title in this file matching title projects +[ ] run function`bcbio_set_project()` to set up information for this project + - hbcxxxx code + - pi + - project name to be used in storage/github/dropbox +[ ] run function `bcbio_set_git()` to set up git repository +[ ] run function `bcbio_copy_dropbox()` to copy files to dropbox location