From ec29522d8fe90cdd11fbc4a5aee0154c751ab7d7 Mon Sep 17 00:00:00 2001 From: Lorena Pantano Date: Fri, 25 Oct 2024 15:00:23 -0400 Subject: [PATCH] pass R check --- DESCRIPTION | 3 +- NAMESPACE | 2 + R/bcbioR-package.R | 2 + R/helpers.R | 8 ++- README.md | 2 +- .../org/hcbc/{README.md => hcbc_README.md} | 0 .../singlecell/Integration/01-integration.R | 61 ------------------- man/bcbio_templates.Rd | 4 +- man/cb_friendly_pal.Rd | 2 +- man/cb_friendly_palettes.Rd | 2 +- man/scale_color_cb_friendly.Rd | 2 +- man/scale_fill_cb_friendly.Rd | 2 +- vignettes/bcbioR_quick_start.Rmd | 3 +- 13 files changed, 20 insertions(+), 73 deletions(-) rename inst/templates/rnaseq/org/hcbc/{README.md => hcbc_README.md} (100%) delete mode 100644 inst/templates/singlecell/Integration/01-integration.R diff --git a/DESCRIPTION b/DESCRIPTION index e2efa40..8442eee 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,8 @@ Imports: yaml, whisker, rlang, - stringr + stringr, + utils Suggests: hues, ggprism, diff --git a/NAMESPACE b/NAMESPACE index 63cd351..5882394 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,3 +16,5 @@ importFrom(grDevices,colorRampPalette) importFrom(magrittr,"%>%") importFrom(readr,read_csv) importFrom(stringr,str_replace_all) +importFrom(utils,download.file) +importFrom(utils,unzip) diff --git a/R/bcbioR-package.R b/R/bcbioR-package.R index 46c710b..2ddfc44 100644 --- a/R/bcbioR-package.R +++ b/R/bcbioR-package.R @@ -6,6 +6,8 @@ #' @importFrom magrittr %>% #' @importFrom readr read_csv #' @importFrom stringr str_replace_all +#' @importFrom utils download.file +#' @importFrom utils unzip ## usethis namespace: end #' @import usethis #' @import fs diff --git a/R/helpers.R b/R/helpers.R index db1e9b4..d0e90f6 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -193,15 +193,17 @@ copy_templates <- function(path, pipeline, org=NULL){ parts = c("templates/spatial") } analysis_template <- fs::path_package(base, parts) - org_template <- fs::path_package(base, parts, "org", org) ui_info("Getting templates from {ui_value(analysis_template)}") # ls_files <- grep("org", list.files(analysis_template, full.names = TRUE), # value = TRUE, invert = TRUE) # ui_info("{ui_value(length(ls_files))} amount of files to copy") copy_files_in_folder(analysis_template, path) - ui_info("Getting templates from {ui_value(org_template)}") - copy_files_in_folder(org_template, path, is_org=TRUE) + if (!is.null(org)){ + org_template <- fs::path_package(base, parts, "org", org) + ui_info("Getting templates from {ui_value(org_template)}") + copy_files_in_folder(org_template, path, is_org=TRUE) + } # check org folder is in there # search for param + _README.md diff --git a/README.md b/README.md index 4957bf7..45ea579 100755 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ bcbio_templates(type="rnaseq", outpath="/path/to/analysis/folder/reports") ### Discover moreā€¦ -Go to the vignette to know more `vignette("bcbioR_quick_start",package="bcbioR")` +Go to the vignette to know more `vignette("bcbioR_quick_start", package="bcbioR")` ## How to Contribute diff --git a/inst/templates/rnaseq/org/hcbc/README.md b/inst/templates/rnaseq/org/hcbc/hcbc_README.md similarity index 100% rename from inst/templates/rnaseq/org/hcbc/README.md rename to inst/templates/rnaseq/org/hcbc/hcbc_README.md diff --git a/inst/templates/singlecell/Integration/01-integration.R b/inst/templates/singlecell/Integration/01-integration.R deleted file mode 100644 index c0fc928..0000000 --- a/inst/templates/singlecell/Integration/01-integration.R +++ /dev/null @@ -1,61 +0,0 @@ -# some code showing integrating two seurat objects -library(Seurat) -library(tidyverse) -library(harmony) - -# We assume exp1 and exp2 has a Group column with naming the sample groups -# We create a batch annotation for each batch -exp1=readRDS("data/exp1.rds") -exp1$batch="n10" -exp2=readRDS("data/exp2.rds") -exp2$batch="n6" - -# Normalize ---- -exp = SCTransform(exp, verbose = FALSE,conserve.memory=TRUE, - variable.features.n = 3000) -exp <- RunPCA(exp) -ElbowPlot(exp,ndims=40) -end_dimension=35 -resolution=0.5 - -# Clustering for each batch ---- -exp <- FindNeighbors(exp, dims = 1:end_dimension, reduction = "pca") -exp <- FindClusters(exp, resolution = resolution, cluster.name = "unintegrated_clusters") -exp <- RunUMAP(exp, dims = 1:end_dimension, reduction = "pca", reduction.name = "umap.unintegrated") -saveRDS(exp, file="data/merged_umap.rds") - -## Plot by batch---- -DimPlot(exp, reduction = "umap.unintegrated", split.by = c("Group"), - group.by = c("batch")) - -# Integration ---- -exp <- IntegrateLayers( - object = exp, method = HarmonyIntegration, - orig.reduction = "pca", new.reduction = "harmony", - verbose = FALSE -) -exp[["RNA"]] <- JoinLayers(exp[["RNA"]]) -end_dimension=35 -resolution=0.5 -exp <- FindNeighbors(exp, reduction = "harmony", dims = 1:end_dimension) -exp <- FindClusters(exp, resolution = resolution, cluster.name = "harmony_clusters") -exp <- RunUMAP(exp, reduction = "harmony", dims = 1:end_dimension, reduction.name = "umap.harmony") -saveRDS(exp, file="data/integrated_harmony.rds") - -## Plot by Group and Cluster ---- -DimPlot( - exp, - reduction = "umap.harmony", - split.by = c("Group"), - group.by = c("batch"), - combine = TRUE, label.size = 2 -) - -DimPlot( - exp, - reduction = "umap.harmony", - split.by = c("Group"), - group.by = c("ident"), - combine = TRUE, label.size = 2 -) - diff --git a/man/bcbio_templates.Rd b/man/bcbio_templates.Rd index c5a2f7b..e5e39e3 100644 --- a/man/bcbio_templates.Rd +++ b/man/bcbio_templates.Rd @@ -4,12 +4,14 @@ \alias{bcbio_templates} \title{Function to help deploy analysis folder inside a project folder} \usage{ -bcbio_templates(type = "rnaseq", outpath) +bcbio_templates(type = "rnaseq", outpath = NULL, org = NULL) } \arguments{ \item{type}{string indicating the type of analysis, supported: rnaseq.} \item{outpath}{string path indicating where to copy all the files to} + +\item{org}{string with the organization name. To deploy specific files.} } \description{ This function contains Rmd, R, md, files that help to structure diff --git a/man/cb_friendly_pal.Rd b/man/cb_friendly_pal.Rd index d1d9181..09215b1 100644 --- a/man/cb_friendly_pal.Rd +++ b/man/cb_friendly_pal.Rd @@ -7,7 +7,7 @@ cb_friendly_pal(palette = "main", reverse = F, ...) } \arguments{ -\item{palette}{name of the palette to be returned} +\item{palette}{name of the palette to be returned (main, cool, hot, grey, white_to_blue, or heatmap)} \item{reverse}{boolean, reverse order of colors in palette} diff --git a/man/cb_friendly_palettes.Rd b/man/cb_friendly_palettes.Rd index 88ae911..d8bb831 100644 --- a/man/cb_friendly_palettes.Rd +++ b/man/cb_friendly_palettes.Rd @@ -5,7 +5,7 @@ \alias{cb_friendly_palettes} \title{define main colorblind-friendly palette as well as sub-palettes} \format{ -An object of class \code{list} of length 5. +An object of class \code{list} of length 6. } \usage{ cb_friendly_palettes diff --git a/man/scale_color_cb_friendly.Rd b/man/scale_color_cb_friendly.Rd index a89f1f8..34ab816 100644 --- a/man/scale_color_cb_friendly.Rd +++ b/man/scale_color_cb_friendly.Rd @@ -12,7 +12,7 @@ scale_color_cb_friendly( ) } \arguments{ -\item{palette}{name of the palette to be returned} +\item{palette}{name of the palette to be returned (main, cool, hot, grey, white_to_blue, or heatmap)} \item{discrete}{boolean, whether to make palette discretely divided into colors or continuous} diff --git a/man/scale_fill_cb_friendly.Rd b/man/scale_fill_cb_friendly.Rd index b48fc73..89ecf35 100644 --- a/man/scale_fill_cb_friendly.Rd +++ b/man/scale_fill_cb_friendly.Rd @@ -7,7 +7,7 @@ scale_fill_cb_friendly(palette = "main", discrete = TRUE, reverse = FALSE, ...) } \arguments{ -\item{palette}{name of the palette to be returned} +\item{palette}{name of the palette to be returned (main, cool, hot, grey, white_to_blue, or heatmap)} \item{discrete}{boolean, whether to make palette discretely divided into colors or continuous} diff --git a/vignettes/bcbioR_quick_start.Rmd b/vignettes/bcbioR_quick_start.Rmd index a05670a..002003f 100644 --- a/vignettes/bcbioR_quick_start.Rmd +++ b/vignettes/bcbioR_quick_start.Rmd @@ -64,8 +64,7 @@ We support multiple analyses type: - RNAseq - scRNAseq -- TEAseq -- COSMX +- ChipPseq To get the example code for any of them you can use a similar command: