From 984b2b6745d59e31a2da6e85ab34d0030a2547bc Mon Sep 17 00:00:00 2001 From: Lorena Pantano Date: Fri, 19 Apr 2024 08:58:16 -0400 Subject: [PATCH 1/2] add common files of a project --- .../templates/common/skeleton/README.md | 13 ++++++++++ .../common/skeleton/code/placeholder.R | 0 .../templates/common/skeleton/data/readme | 0 .../templates/common/skeleton/information.R | 6 +++++ .../common/skeleton/scripts/placeholder | 0 .../templates/common/skeleton/skeleton.Rmd | 25 +++++++++++++++++++ inst/rmarkdown/templates/common/template.yaml | 3 +++ 7 files changed, 47 insertions(+) create mode 100644 inst/rmarkdown/templates/common/skeleton/README.md create mode 100644 inst/rmarkdown/templates/common/skeleton/code/placeholder.R create mode 100644 inst/rmarkdown/templates/common/skeleton/data/readme create mode 100644 inst/rmarkdown/templates/common/skeleton/information.R create mode 100644 inst/rmarkdown/templates/common/skeleton/scripts/placeholder create mode 100644 inst/rmarkdown/templates/common/skeleton/skeleton.Rmd create mode 100644 inst/rmarkdown/templates/common/template.yaml diff --git a/inst/rmarkdown/templates/common/skeleton/README.md b/inst/rmarkdown/templates/common/skeleton/README.md new file mode 100644 index 0000000..30016c5 --- /dev/null +++ b/inst/rmarkdown/templates/common/skeleton/README.md @@ -0,0 +1,13 @@ +# TODO + +[ ] Replace Title in this file matching title projects +[ ] run function`bcbio_set_project()` to set up information for this project + - hbcxxxx code + - technology + - tissue + - organism + - pi + - project name +[ ] run function `bcbio_set_git()` to set up git repository +[ ] run function `bcbio_copy_dropbox()` to copy files to dropbox location + diff --git a/inst/rmarkdown/templates/common/skeleton/code/placeholder.R b/inst/rmarkdown/templates/common/skeleton/code/placeholder.R new file mode 100644 index 0000000..e69de29 diff --git a/inst/rmarkdown/templates/common/skeleton/data/readme b/inst/rmarkdown/templates/common/skeleton/data/readme new file mode 100644 index 0000000..e69de29 diff --git a/inst/rmarkdown/templates/common/skeleton/information.R b/inst/rmarkdown/templates/common/skeleton/information.R new file mode 100644 index 0000000..6e15eef --- /dev/null +++ b/inst/rmarkdown/templates/common/skeleton/information.R @@ -0,0 +1,6 @@ +# info params +project = "name_hbcXXXXX" +PI = 'person name' +experiment = 'short description' +aim = 'short description' +analyst = 'person in the core' diff --git a/inst/rmarkdown/templates/common/skeleton/scripts/placeholder b/inst/rmarkdown/templates/common/skeleton/scripts/placeholder new file mode 100644 index 0000000..e69de29 diff --git a/inst/rmarkdown/templates/common/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/common/skeleton/skeleton.Rmd new file mode 100644 index 0000000..dc4bbf5 --- /dev/null +++ b/inst/rmarkdown/templates/common/skeleton/skeleton.Rmd @@ -0,0 +1,25 @@ +--- +title: "General Project Information" +author: "Harvard Chan Bioinformatics Core" +date: "`r Sys.Date()`" +output: + html_document: + code_folding: hide + df_print: paged + highlights: pygments + number_sections: true + self_contained: true + theme: default + toc: true + toc_float: + collapsed: true + smooth_scroll: true +editor_options: + chunk_output_type: console +params: + params_file: information.R +--- + +```{r echo = F} +source(params$params_file) +``` diff --git a/inst/rmarkdown/templates/common/template.yaml b/inst/rmarkdown/templates/common/template.yaml new file mode 100644 index 0000000..1db494c --- /dev/null +++ b/inst/rmarkdown/templates/common/template.yaml @@ -0,0 +1,3 @@ +name: bcbio base +description: Standard NGS down-stream analyses +create_dir: true From 20c012759deb9ebb91651a7d3019e4a7cafba3af Mon Sep 17 00:00:00 2001 From: Lorena Pantano Date: Fri, 19 Apr 2024 09:08:07 -0400 Subject: [PATCH 2/2] fix start function --- R/hello.R | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/R/hello.R b/R/hello.R index e148037..7e90f7f 100644 --- a/R/hello.R +++ b/R/hello.R @@ -14,26 +14,27 @@ # Test Package: 'Cmd + Shift + T' .fix <- function(x){ - x <- tolower(x) %>% str_replace_all(x, "[[:punct:]]", " ") - retunr(x) + x <- tolower(x) %>% str_replace_all(., "[[:punct:]]", "_") + return(x) } #' @export bcbio_set_project <- function() { hbc_code <- readline("What is the hbc code:\n") + hbc_code <- paste0("hbc", hbc_code) pi <- readline("What is PI last name:\n") technology <- readline("What is the technology:\n") tissue <- readline("What is the tissue:\n") org <- readline("What is the organism:\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") + #dropbox <- readline("What is the dropbox name:\n") + #github_org <- readline("What is the github organization:\n") #hbc_$technology_of_$pilastname_$intervention_on_$tissue_in_$organism_$hbccode - project_full <- paste(project, technology, fix(pi), project, tissue, organism, hbc_code, sep="_") - github <- c(github_org,project_full) - opts <- list(code=hbc_code, project=project_full, - dropbox=file.path(dropbox,project_full), - github=github) + project_full <- paste(technology, .fix(pi), .fix(project), tissue, org, hbc_code, sep="_") + #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) }