From 532b90b8b316d483e57b599cbecafefa05136f5e Mon Sep 17 00:00:00 2001 From: xjsun1221 Date: Sun, 5 Sep 2021 18:24:57 +0800 Subject: [PATCH] add --- DESCRIPTION | 1 - R/1_plots.R | 2 +- R/2_geo_id.R | 2 ++ R/6_multi_deg_all.R | 6 ++++++ R/7_quick_double_enrich.R | 6 +++++- R/8_tcga_group_trans_exp.R | 18 +++++++++--------- man/double_enrich.Rd | 4 +++- man/draw_heatmap2.Rd | 2 ++ man/draw_volcano2.Rd | 2 ++ man/geo_download.Rd | 2 ++ man/get_cgs.Rd | 2 ++ man/quick_enrich.Rd | 2 ++ 12 files changed, 36 insertions(+), 13 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 22b3072..b9210d3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -39,4 +39,3 @@ Suggests: Rtsne Depends:R (>= 3.5.0) RoxygenNote: 7.1.1 -Language: 1en-US diff --git a/R/1_plots.R b/R/1_plots.R index 17bcdb4..2c0030f 100644 --- a/R/1_plots.R +++ b/R/1_plots.R @@ -297,7 +297,7 @@ draw_venn <- function(x,name,color = c("#2874C5","#f87669","#e6b707","#868686"," ##' ##' @inheritParams draw_pca ##' @param method one of kruskal.test,aov,t.test and wilcox.test -##' @param width wdith of boxplot and error bar +##' @param width width of boxplot and error bar ##' @param sort whether the boxplot will be sorted ##' @param drop whether to discard insignificant values ##' @param pvalue_cutoff if drop = TRUE,genes with p-values below the threshold will be drawn diff --git a/R/2_geo_id.R b/R/2_geo_id.R index be7e8de..2904c09 100644 --- a/R/2_geo_id.R +++ b/R/2_geo_id.R @@ -14,9 +14,11 @@ ##' @importFrom dplyr %>% ##' @export ##' @examples +##' \dontrun{ ##' gse = "GSE42872" ##' a = geo_download(gse,destdir=tempdir()) ##' b = geo_download(gse,by_annopbrobe = FALSE,destdir=tempdir()) +##' } ##' @seealso ##' \code{\link{find_anno}} diff --git a/R/6_multi_deg_all.R b/R/6_multi_deg_all.R index 2bc6446..f84b920 100644 --- a/R/6_multi_deg_all.R +++ b/R/6_multi_deg_all.R @@ -7,6 +7,7 @@ ##' @author Xiaojie Sun ##' @export ##' @examples +##' \dontrun{ ##' #two group ##' gse = "GSE42872" ##' geo = geo_download(gse,destdir=tempdir()) @@ -26,6 +27,7 @@ ##' ids = AnnoProbe::idmap(geo$gpl,destdir = tempdir()) ##' deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE) ##' cgs = get_cgs(deg) +##' } ##' @seealso ##' \code{\link{geo_download}};\code{\link{draw_volcano}};\code{\link{draw_venn}} @@ -62,6 +64,7 @@ get_cgs <- function(deg){ ##' @importFrom patchwork plot_layout ##' @export ##' @examples +##' \dontrun{ ##' #two group ##' gse = "GSE42872" ##' geo = geo_download(gse,destdir=tempdir()) @@ -82,6 +85,7 @@ get_cgs <- function(deg){ ##' deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE) ##' draw_volcano2(deg) ##' draw_volcano2(deg,color = c("darkgreen","grey","darkred")) +##' } ##' @seealso ##' \code{\link{geo_download}};\code{\link{draw_volcano}};\code{\link{draw_venn}} @@ -134,6 +138,7 @@ draw_volcano2 = function(deg, ##' @importFrom pheatmap pheatmap ##' @export ##' @examples +##' \dontrun{ ##' gse = "GSE474" ##' geo = geo_download(gse,destdir=tempdir()) ##' geo$exp[1:4,1:4] @@ -145,6 +150,7 @@ draw_volcano2 = function(deg, ##' ids <- AnnoProbe::idmap(geo$gpl,destdir = tempdir()) ##' deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE) ##' draw_heatmap2(geo$exp,group_list,deg) +##' } ##' @seealso ##' \code{\link{draw_pca}};\code{\link{draw_volcano}};\code{\link{draw_venn}} diff --git a/R/7_quick_double_enrich.R b/R/7_quick_double_enrich.R index 8951fa5..442ab5f 100644 --- a/R/7_quick_double_enrich.R +++ b/R/7_quick_double_enrich.R @@ -17,12 +17,14 @@ ##' @importFrom ggplot2 scale_x_discrete ##' @export ##' @examples +##' \dontrun{ ##' head(genes) ##' g = quick_enrich(genes,destdir = tempdir()) ##' names(g) ##' g[[1]][1:4,1:4] ##' g[[3]] ##' g[[4]] +##' } ##' @seealso ##' \code{\link{double_enrich}} @@ -91,7 +93,9 @@ quick_enrich <- function(genes, ##' @importFrom ggplot2 theme ##' @export ##' @examples -##' # double_enrich(deg) +##' \dontrun{ +##' double_enrich(deg) +##' } ##' @seealso ##' \code{\link{quick_enrich}} diff --git a/R/8_tcga_group_trans_exp.R b/R/8_tcga_group_trans_exp.R index 6838c62..70fd79d 100644 --- a/R/8_tcga_group_trans_exp.R +++ b/R/8_tcga_group_trans_exp.R @@ -15,7 +15,7 @@ make_tcga_group <- function(exp){ k1 = stringr::str_starts(colnames(exp),"TCGA") - if(!any(k1))stop("no tcga samples detected,please check it") + if(!any(k1))stop("no TCGA samples detected,please check it") k2 = suppressWarnings(as.numeric(stringr::str_sub(colnames(exp),14,15))<10) group_list = ifelse(k1&k2,"tumor","normal") group_list = factor(group_list,levels = c("normal","tumor")) @@ -24,12 +24,12 @@ make_tcga_group <- function(exp){ ##' trans_exp ##' -##' transform rownames of tcga or tcga_gtex expression set from gdc or xena,from ensembl id to gene symbol +##' transform rownames of TCGA or TCGA_Gtex expression set from gdc or xena,from ensembl id to gene symbol ##' -##' @param exp tcga or tcga_gtex expression set from gdc or xena +##' @param exp TCGA or TCGA_Gtex expression set from gdc or xena ##' @param mrna_only only keep mrna rows in result ##' @param lncrna_only only keep lncrna rows in result -##' @param gtex logical,whether including gtex data +##' @param gtex logical,whether including Gtex data ##' @return a transformed expression set with symbol ##' @author Xiaojie Sun ##' @importFrom stringr str_detect @@ -99,7 +99,7 @@ utils::globalVariables(c("lnc_anno","mRNA_anno","lnc_annov23","mRNA_annov23")) ##' ##' transform rownames for microarray expression matrix ##' -##' @param exp tcga or tcga_gtex expression set from gdc or xena +##' @param exp TCGA or TCGA_Gtex expression set from gdc or xena ##' @param ids data.frame with original rownames and new rownames ##' @param from colname for original rownames ##' @param to colname for new rownames @@ -133,7 +133,7 @@ trans_array = function(exp,ids,from = "probe_id", ##' ##' drop duplicated samples from the same patients ##' -##' @param exp tcga or tcga_gtex expression set from gdc or xena +##' @param exp TCGA or TCGA_Gtex expression set from gdc or xena ##' @return a transformed expression set without duplicated samples ##' @author Xiaojie Sun ##' @export @@ -166,10 +166,10 @@ sam_filter = function(exp){ ##' match_exp_cl ##' -##' match exp and clinical data from tcga +##' match exp and clinical data from TCGA ##' -##' @param exp tcga expression set -##' @param cl tcga clinical data.frame +##' @param exp TCGA expression set +##' @param cl TCGA clinical data.frame ##' @param id_column which column contains patient ids, column number or colnmn name. ##' @param sample_centric logical,deault T,keep all samples from the same patients.if FALSE,keep only one tumor sample for one patient. ##' @return a transformed clinical data.frame with sample ids. diff --git a/man/double_enrich.Rd b/man/double_enrich.Rd index e48e614..0905b03 100644 --- a/man/double_enrich.Rd +++ b/man/double_enrich.Rd @@ -20,7 +20,9 @@ a list with kegg and go bar plot according to up and down genes enrichment resul draw enrichment bar plots for both up and down genes } \examples{ -# double_enrich(deg) +\dontrun{ +double_enrich(deg) +} } \seealso{ \code{\link{quick_enrich}} diff --git a/man/draw_heatmap2.Rd b/man/draw_heatmap2.Rd index a18ba74..6dac211 100644 --- a/man/draw_heatmap2.Rd +++ b/man/draw_heatmap2.Rd @@ -59,6 +59,7 @@ a heatmap plot according to \code{exp} and grouped by \code{group}. print heatmap plots for expression matrix and group by group_list paramter } \examples{ +\dontrun{ gse = "GSE474" geo = geo_download(gse,destdir=tempdir()) geo$exp[1:4,1:4] @@ -71,6 +72,7 @@ ids <- AnnoProbe::idmap(geo$gpl,destdir = tempdir()) deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE) draw_heatmap2(geo$exp,group_list,deg) } +} \seealso{ \code{\link{draw_pca}};\code{\link{draw_volcano}};\code{\link{draw_venn}} } diff --git a/man/draw_volcano2.Rd b/man/draw_volcano2.Rd index ba6b7b9..b766d22 100644 --- a/man/draw_volcano2.Rd +++ b/man/draw_volcano2.Rd @@ -39,6 +39,7 @@ one or more volcano plot print one or more volcano plot for Differential analysis result in data.frame fomat. } \examples{ +\dontrun{ #two group gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) @@ -60,6 +61,7 @@ deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE) draw_volcano2(deg) draw_volcano2(deg,color = c("darkgreen","grey","darkred")) } +} \seealso{ \code{\link{geo_download}};\code{\link{draw_volcano}};\code{\link{draw_venn}} } diff --git a/man/geo_download.Rd b/man/geo_download.Rd index ea0a065..46c01d6 100644 --- a/man/geo_download.Rd +++ b/man/geo_download.Rd @@ -30,10 +30,12 @@ a list with exp,pd and gpl download gse data and get informations } \examples{ +\dontrun{ gse = "GSE42872" a = geo_download(gse,destdir=tempdir()) b = geo_download(gse,by_annopbrobe = FALSE,destdir=tempdir()) } +} \seealso{ \code{\link{find_anno}} } diff --git a/man/get_cgs.Rd b/man/get_cgs.Rd index 58ecbfe..9b98479 100644 --- a/man/get_cgs.Rd +++ b/man/get_cgs.Rd @@ -16,6 +16,7 @@ a list with upgenes,downgenes,diffgenes. extract DEGs from deg data.frame } \examples{ +\dontrun{ #two group gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) @@ -36,6 +37,7 @@ ids = AnnoProbe::idmap(geo$gpl,destdir = tempdir()) deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE) cgs = get_cgs(deg) } +} \seealso{ \code{\link{geo_download}};\code{\link{draw_volcano}};\code{\link{draw_venn}} } diff --git a/man/quick_enrich.Rd b/man/quick_enrich.Rd index 6b856b8..a7a4213 100644 --- a/man/quick_enrich.Rd +++ b/man/quick_enrich.Rd @@ -20,6 +20,7 @@ enrichment results and dotplots do diffiencial analysis according to exprission set and group information } \examples{ +\dontrun{ head(genes) g = quick_enrich(genes,destdir = tempdir()) names(g) @@ -27,6 +28,7 @@ g[[1]][1:4,1:4] g[[3]] g[[4]] } +} \seealso{ \code{\link{double_enrich}} }