Skip to content

Commit

Permalink
bring some readme to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
lpantano committed Apr 17, 2024
1 parent a055d97 commit c2c4c3d
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
exportPattern("^[[:alpha:]]+")
# Generated by roxygen2: do not edit by hand

export(bcbio_set_project)
export(bcbio_start_project)
61 changes: 61 additions & 0 deletions R/hello.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

}
28 changes: 28 additions & 0 deletions inst/rmarkdown/templates/project/rnaseq.dcf
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions inst/rmarkdown/templates/rnaseq/skeleton/README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c2c4c3d

Please sign in to comment.