### Install tinyarray from Online Sources Source: https://github.com/xjsun1221/tinyarray/blob/master/README.md Use these commands to install the package from CRAN or GitHub. ```R if(!require(tinyarray))install.packages("tinyarray") if(!require(devtools))install.packages("devtools") if(!require(tinyarray))devtools::install_github("xjsun1221/tinyarray",upgrade = FALSE,dependencies = TRUE) ``` -------------------------------- ### Example usage of plcortest Source: https://github.com/xjsun1221/tinyarray/blob/master/man/plcortest.Rd Placeholder example for the plcortest function. ```R # to update ``` -------------------------------- ### Generate Heatmaps with ggheat Source: https://github.com/xjsun1221/tinyarray/blob/master/man/ggheat.Rd Examples demonstrating basic heatmap generation, clustering, and customization of labels and visibility. ```R exp_dat = matrix(sample(100:1000,40),ncol = 4) exp_dat[1:(nrow(exp_dat)/2),] = exp_dat[1:(nrow(exp_dat)/2),]-1000 rownames(exp_dat) = paste0("sample",1:nrow(exp_dat)) colnames(exp_dat) = paste0("gene",1:ncol(exp_dat)) group = rep(c("A","B"),each = nrow(exp_dat)/2) group = factor(group,levels = c("A","B")) ggheat(exp_dat,group) ggheat(exp_dat,group,cluster_rows = TRUE) ggheat(exp_dat,group,cluster_rows = TRUE,show_rownames = FALSE, show_colnames = FALSE,groupname = "risk",expname = "expression") ``` -------------------------------- ### find_anno(gpl, install = FALSE, update = FALSE) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/find_anno.Rd Finds the annotation package or files for a given GPL accession. Optionally installs and loads the package or updates it. ```APIDOC ## find_anno ### Description Finds gpl annotation package or files based on the provided accession number. ### Usage find_anno(gpl, install = FALSE, update = FALSE) ### Arguments - **gpl** (string) - A GPL accession identifier. - **install** (boolean) - Whether to install and library the package. Default is FALSE. - **update** (boolean) - Whether to update the package. Default is FALSE. ### Returns A list containing deg data.frame, a volcano plot, and a list of DEGs. ### Example find_anno("GPL570") ``` -------------------------------- ### Differential Expression Analysis Example Source: https://github.com/xjsun1221/tinyarray/blob/master/man/multi_deg_all.Rd Example usage of multi_deg_all with GSE data, requiring the Biobase and AnnoProbe packages. ```R if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE474" geo = geo_download(gse,destdir=tempdir()) geo$exp[1:4,1:4] geo$exp=log2(geo$exp+1) group_list=ifelse(stringr::str_detect(geo$pd$title,"MObese"),"MObese", ifelse(stringr::str_detect(geo$pd$title,"NonObese"),"NonObese","Obese")) group_list=factor(group_list,levels = c("NonObese","Obese","MObese")) find_anno(geo$gpl) ids = AnnoProbe::idmap(geo$gpl,destdir = tempdir()) dcp = multi_deg_all(geo$exp, group_list,ids,adjust = FALSE,entriz = FALSE) dcp[[3]] }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { warning("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')",call. = FALSE) } if(!requireNamespace("Biobase",quietly = TRUE)) { warning("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')",call. = FALSE) } } ``` -------------------------------- ### Perform enrichment analysis with quick_enrich Source: https://github.com/xjsun1221/tinyarray/blob/master/man/quick_enrich.Rd Example usage of quick_enrich requiring the org.Hs.eg.db package for human data. ```R if(requireNamespace("org.Hs.eg.db",quietly = TRUE)){ head(genes) g = quick_enrich(genes,destdir = tempdir()) names(g) g[[1]][1:4,1:4] g[[3]] g[[4]] }else{ warning("Package 'org.Hs.eg.db' needed for this function to work. Please install it by BiocManager::install('org.Hs.eg.db')",call. = FALSE) } ``` -------------------------------- ### Calculate log-rank p-values with surv_KM Source: https://github.com/xjsun1221/tinyarray/blob/master/man/surv_KM.Rd Examples demonstrating basic usage, p-value threshold adjustment, and enabling cut-point analysis. ```R surv_KM(exprSet_hub1,meta1) surv_KM(exprSet_hub1,meta1,pvalue_cutoff = 1) surv_KM(exprSet_hub1,meta1,cut.point = TRUE) ``` -------------------------------- ### Generate Survival Plots with exp_surv Source: https://github.com/xjsun1221/tinyarray/blob/master/man/exp_surv.Rd Examples demonstrating how to generate survival plots using default median grouping and custom cut-point grouping, visualized with patchwork. ```R tmp = exp_surv(exprSet_hub1,meta1) patchwork::wrap_plots(tmp)+patchwork::plot_layout(guides = "collect") tmp2 = exp_surv(exprSet_hub1,meta1,cut.point = TRUE) patchwork::wrap_plots(tmp2)+patchwork::plot_layout(guides = "collect") ``` -------------------------------- ### Generate 3D PCA plots Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_pca.Rd Example demonstrating how to generate a 3D PCA plot, requiring scatterplot3d and FactoMineR packages. ```R if(requireNamespace("scatterplot3d",quietly = TRUE)& requireNamespace("FactoMineR",quietly = TRUE)){ draw_pca(t(iris[,1:4]),iris$Species,style = "3D") }else{ if(!requireNamespace("scatterplot3d",quietly = TRUE)){ warning("Package 'scatterplot3d' needed for this function to work. Please install it by install.packages('scatterplot3d')") } if(!requireNamespace("FactoMineR",quietly = TRUE)){ warning("Package 'FactoMineR' needed for this function to work. Please install it by install.packages('FactoMineR')") } } ``` -------------------------------- ### Perform differential expression analysis with get_deg_all Source: https://github.com/xjsun1221/tinyarray/blob/master/man/get_deg_all.Rd This example demonstrates how to download GEO data, prepare group lists and probe IDs, and execute the differential expression analysis pipeline. ```R \dontrun{ if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) group_list = rep(c("A","B"),each = 3) group_list = factor(group_list) find_anno(geo$gpl) ids <- AnnoProbe::idmap(geo$gpl,destdir = tempdir()) dcp = get_deg_all(geo$exp,group_list,ids,entriz = FALSE) head(dcp$deg) dcp$plots }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { warning("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')",call. = FALSE) } if(!requireNamespace("Biobase",quietly = TRUE)) { warning("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')",call. = FALSE) } } } ``` -------------------------------- ### Generate box and survival plots with box_surv Source: https://github.com/xjsun1221/tinyarray/blob/master/man/box_surv.Rd Demonstrates the usage of box_surv, requiring the ggpubr package to be installed. ```R if(requireNamespace("ggpubr",quietly = TRUE)) { k = box_surv(log2(exp_hub1+1),exprSet_hub1,meta1);k[[1]] }else{ warning("Package 'ggpubr' needed for this function to work. Please install it by install.packages('ggpubr')") } ``` -------------------------------- ### Generate enrichment bar plots with double_enrich Source: https://github.com/xjsun1221/tinyarray/blob/master/man/double_enrich.Rd This example demonstrates how to call double_enrich while checking for required dependencies org.Hs.eg.db and labeling. ```R if(requireNamespace("org.Hs.eg.db",quietly = TRUE)& requireNamespace("labeling",quietly = TRUE)){ double_enrich(deg) }else{ if(!requireNamespace("org.Hs.eg.db",quietly = TRUE)) { warning("Package 'org.Hs.eg.db' needed for this function to work. Please install it by BiocManager::install('org.Hs.eg.db')",call. = FALSE) } if(!requireNamespace("labeling",quietly = TRUE)) { warning("Package 'labeling' needed for this function to work. Please install it by install.packages('labeling')",call. = FALSE) } } ``` -------------------------------- ### Generate a heatmap plot Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_heatmap2.Rd This example demonstrates how to download GEO data, perform differential expression analysis, and generate a heatmap using draw_heatmap2. ```R if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE474" geo = geo_download(gse,destdir=tempdir()) geo$exp[1:4,1:4] geo$exp=log2(geo$exp+1) group_list=ifelse(stringr::str_detect(geo$pd$title,"MObese"),"MObese", ifelse(stringr::str_detect(geo$pd$title,"NonObese"),"NonObese","Obese")) group_list=factor(group_list,levels = c("NonObese","Obese","MObese")) find_anno(geo$gpl) ids <- AnnoProbe::idmap(geo$gpl,destdir = tempdir()) deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE,entriz = FALSE) draw_heatmap2(geo$exp,group_list,deg) }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { warning("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')",call. = FALSE) } if(!requireNamespace("Biobase",quietly = TRUE)) { warning("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')",call. = FALSE) } } ``` -------------------------------- ### Generate PCA plots with draw_pca Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_pca.Rd Examples demonstrating how to generate PCA plots using different styles and custom colors, requiring FactoMineR and factoextra packages. ```R if(requireNamespace("FactoMineR",quietly = TRUE)& requireNamespace("factoextra",quietly = TRUE)){ draw_pca(t(iris[,1:4]),iris$Species) draw_pca(t(iris[,1:4]),iris$Species,style = "ggplot2") #change color draw_pca(t(iris[,1:4]),iris$Species,color = c("#E78AC3", "#A6D854", "#FFD92F")) }else{ if(!requireNamespace("FactoMineR",quietly = TRUE)){ warning("Package 'FactoMineR' needed for this function to work. Please install it by install.packages('FactoMineR')") } if(!requireNamespace("factoextra",quietly = TRUE)){ warning("Package 'factoextra' needed for this function to work. Please install it by install.packages('factoextra')") } } ``` -------------------------------- ### Generate a heatmap with draw_heatmap Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_heatmap.Rd Example usage of draw_heatmap with synthetic data and the iris dataset, demonstrating basic and customized plotting. ```R #example data exp = matrix(abs(rnorm(60,sd = 16)),nrow = 10) exp[,4:6] <- exp[,4:6]+20 colnames(exp) <- paste0("sample",1:6) rownames(exp) <- paste0("gene",1:10) exp[1:4,1:4] group_list = factor(rep(c("A","B"),each = 3)) if(requireNamespace("ggplotify",quietly = TRUE)){ draw_heatmap(exp,group_list) #use iris n = t(iris[,1:4]);colnames(n) = 1:150 group_list = iris$Species draw_heatmap(n,group_list) draw_heatmap(n,group_list,color = colorRampPalette(c("green","black","red"))(100), color_an = c("red","blue","pink") ) }else{ warning("Package 'ggplotify' needed for this function to work. Please install it by install.packages('ggplotify')") } ``` -------------------------------- ### Generate a Kaplan-Meier plot Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_KM.Rd Example usage of draw_KM using the lung dataset from the survival package. ```R require("survival") x = survival::lung draw_KM(meta = x, group_list = x$sex,event_col = "status") ``` -------------------------------- ### Generate a Venn Diagram Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_venn.Rd Creates a Venn diagram from a list of sets. Requires the VennDiagram, ggplotify, and cowplot packages to be installed. ```R if(requireNamespace("VennDiagram",quietly = TRUE)& requireNamespace("ggplotify",quietly = TRUE)& requireNamespace("cowplot",quietly = TRUE)){ x = list(Deseq2=sample(1:100,30),edgeR = sample(1:100,30),limma = sample(1:100,30)) draw_venn(x,"test") draw_venn(x,"test",color = c("darkgreen", "darkblue", "#B2182B")) }else{ if(!requireNamespace("VennDiagram",quietly = TRUE)) { warning("Package 'VennDiagram' needed for this function to work. Please install it by install.packages('VennDiagram')") } if(!requireNamespace("ggplotify",quietly = TRUE)) { warning("Package 'ggplotify' needed for this function to work. Please install it by install.packages('ggplotify')") } if(!requireNamespace("cowplot",quietly = TRUE)) { warning("Package 'cowplot' needed for this function to work. Please install it by install.packages('cowplot')") } } ``` -------------------------------- ### Perform differential expression analysis with multi_deg Source: https://github.com/xjsun1221/tinyarray/blob/master/man/multi_deg.Rd Example usage of multi_deg involving data download, preprocessing, and annotation mapping using Biobase and AnnoProbe. ```R if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE474" geo = geo_download(gse,destdir=tempdir()) geo$exp[1:4,1:4] geo$exp=log2(geo$exp+1) group_list=ifelse(stringr::str_detect(geo$pd$title,"MObese"), "MObese",ifelse(stringr::str_detect(geo$pd$title,"NonObese"), "NonObese","Obese")) group_list=factor(group_list,levels = c("NonObese","Obese","MObese")) find_anno(geo$gpl) ids <- AnnoProbe::idmap(geo$gpl,destdir = tempdir()) deg = multi_deg(geo$exp,group_list,ids,adjust = FALSE,entriz = FALSE) names(deg) head(deg[[1]]) head(deg[[2]]) head(deg[[3]]) }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { warning("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')",call. = FALSE) } if(!requireNamespace("Biobase",quietly = TRUE)) { warning("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')",call. = FALSE) } } ``` -------------------------------- ### Generate Differential Expression Plots Source: https://github.com/xjsun1221/tinyarray/blob/master/man/plot_deg.Rd Example usage of plot_deg with data downloaded via geo_download and processed with AnnoProbe. ```R if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE474" geo = geo_download(gse,destdir=tempdir()) geo$exp[1:4,1:4] geo$exp=log2(geo$exp+1) group_list=ifelse(stringr::str_detect(geo$pd$title,"MObese"),"MObese", ifelse(stringr::str_detect(geo$pd$title,"NonObese"),"NonObese","Obese")) group_list=factor(group_list,levels = c("NonObese","Obese","MObese")) find_anno(geo$gpl) ids = AnnoProbe::idmap(geo$gpl,destdir = tempdir()) deg = get_deg(geo$exp,group_list,ids,adjust = FALSE,entriz = FALSE) plot_deg(geo$exp,group_list,deg) }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { warning("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')",call. = FALSE) } if(!requireNamespace("Biobase",quietly = TRUE)) { warning("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')",call. = FALSE) } } ``` -------------------------------- ### Transform Entrez IDs to Gene Symbols Source: https://github.com/xjsun1221/tinyarray/blob/master/man/trans_entrezexp.Rd Example usage of trans_entrezexp on a matrix with Entrez ID rownames. Requires the org.Hs.eg.db package for human data. ```R exp = matrix(rnorm(200),ncol = 10) rownames(exp) = c("79691", "56271", "8662", "10394", "55630", "159162", "23541", "79723", "54413", "22927", "92342", "23787", "5550", "8924", "55274", "866", "8844", "353299", "587", "1473") colnames(exp) = paste0("s",1:10) if(requireNamespace("org.Hs.eg.db",quietly = TRUE)){ exp2 = trans_entrezexp(exp) }else{ warning("Package \"org.Hs.eg.db\" needed for this function to work. Please install it by BiocManager::install('org.Hs.eg.db')",call. = FALSE) } ``` -------------------------------- ### Inspect the pkg_all dataset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/pkg_all.Rd Display the first few rows of the pkg_all data frame to verify its structure. ```R head(pkg_all) ``` -------------------------------- ### get_gpl_txt(gpl, destdir = getwd(), download = FALSE) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/get_gpl_txt.Rd Retrieves a GPL annotation text file from the GEO database. Users can specify the accession ID, destination directory, and whether to trigger a download. ```APIDOC ## get_gpl_txt ### Description Retrieves a GPL annotation text file from the GEO database. ### Signature `get_gpl_txt(gpl, destdir = getwd(), download = FALSE)` ### Parameters - **gpl** (string) - Required - The GPL accession ID from the GEO database. - **destdir** (string) - Optional - The destination directory for data downloads. Defaults to the current working directory. - **download** (boolean) - Optional - Whether to download the txt file. Defaults to FALSE. ### Returns - **list** - A list containing the deg data.frame, a volcano plot, and a list of DEGs. ### Example `get_gpl_txt("GPL23270", destdir = tempdir())` ``` -------------------------------- ### Download GSE data using geo_download Source: https://github.com/xjsun1221/tinyarray/blob/master/man/geo_download.Rd Demonstrates how to download a specific GSE dataset while checking for required dependencies like Biobase and AnnoProbe. ```R if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE42872" a = geo_download(gse,destdir=tempdir()) }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { print("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')"print) } if(!requireNamespace("Biobase",quietly = TRUE)) { print("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')"print) } } ``` -------------------------------- ### Perform differential expression analysis with get_deg Source: https://github.com/xjsun1221/tinyarray/blob/master/man/get_deg.Rd Example usage of get_deg requiring the Biobase and AnnoProbe packages to process GEO data. ```R if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ gse = "GSE42872" a = geo_download(gse,destdir=tempdir()) find_anno(geo$gpl) ids <- AnnoProbe::idmap(geo$gpl,destdir = tempdir()) Group = rep(c("control","treat"),each = 3) Group = factor(Group) deg = get_deg(geo$exp,Group,ids,entriz = FALSE) head(deg) }else{ if(!requireNamespace("AnnoProbe",quietly = TRUE)) { warning("Package 'AnnoProbe' needed for this function to work. Please install it by install.packages('AnnoProbe')",call. = FALSE) } if(!requireNamespace("Biobase",quietly = TRUE)) { warning("Package 'Biobase' needed for this function to work. Please install it by BiocManager::install('Biobase')",call. = FALSE) } } ``` -------------------------------- ### quick_enrich(genes, kkgo_file = "kkgo_file.Rdata", destdir = getwd(), species = "human") Source: https://github.com/xjsun1221/tinyarray/blob/master/man/quick_enrich.Rd Performs enrichment analysis and generates results and dotplots. ```APIDOC ## quick_enrich ### Description Performs enrichment analysis based on a provided vector of gene symbols or Entrez IDs. The function saves KEGG and GO results to a specified directory. ### Parameters - **genes** (vector) - Required - A gene symbol or Entrez ID vector. - **kkgo_file** (string) - Optional - Rdata filename for KEGG and GO results. Default: "kkgo_file.Rdata". - **destdir** (string) - Optional - Directory to save the result file. Default: current working directory. - **species** (string) - Optional - Species selection: "human", "mouse", or "rat". Default: "human". ### Returns - **results** (list) - Enrichment results and dotplots. ``` -------------------------------- ### Find annotation for a GPL accession Source: https://github.com/xjsun1221/tinyarray/blob/master/man/find_anno.Rd Locate the annotation package or files for a specific GPL accession. ```R find_anno("GPL570") ``` -------------------------------- ### geo_download(gse, by_annopbrobe = TRUE, simpd = TRUE, colon_remove = FALSE, destdir = getwd(), n = 1) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/geo_download.Rd Downloads GSE data and returns a list containing expression data (exp), phenotypic data (pd), and GPL information. ```APIDOC ## geo_download ### Description Downloads GSE data and retrieves associated information. Returns a list containing expression data, phenotypic data, and GPL information. ### Signature `geo_download(gse, by_annopbrobe = TRUE, simpd = TRUE, colon_remove = FALSE, destdir = getwd(), n = 1)` ### Parameters - **gse** (string) - Required - The GSE accession number. - **by_annopbrobe** (boolean) - Optional - Whether to download data by geoquery or annoprobe. Defaults to TRUE. - **simpd** (boolean) - Optional - Whether to get simplified pdata by dropping columns with all identical values. Defaults to TRUE. - **colon_remove** (boolean) - Optional - Whether to remove duplicated columns with colons. Defaults to FALSE. - **destdir** (string) - Optional - The destination directory for data downloads. Defaults to current working directory. - **n** (integer) - Optional - For data with more than one ExpressionSet, specify which one to analyze. Defaults to 1. ### Returns - **list** - A list containing 'exp' (expression data), 'pd' (phenotypic data), and 'gpl' (GPL information). ``` -------------------------------- ### Generate a correlation scatter plot Source: https://github.com/xjsun1221/tinyarray/blob/master/man/corscatterplot.Rd Creates a scatter plot using the iris dataset with marginal density plots. Requires the ggpubr package to be installed. ```R if(requireNamespace("ggpubr",quietly = TRUE)){ corscatterplot(iris,"Sepal.Length","Sepal.Width") }else{ warning("Package 'ggpubr' needed for this function to work. Please install it by install.packages('ggpubr')") } ``` -------------------------------- ### Inspect mRNA_anno dataset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/mRNA_anno.Rd Display the first few rows of the mRNA_anno data frame to verify its structure. ```R head(mRNA_anno) ``` -------------------------------- ### Perform differential expression analysis with t_choose Source: https://github.com/xjsun1221/tinyarray/blob/master/man/t_choose.Rd Demonstrates setting up a sample expression matrix and group list to identify differentially expressed genes. ```R exp = matrix(rnorm(1000),ncol = 10) rownames(exp) = sample(mRNA_annov23$gene_id,100) colnames(exp) = c(paste0("TCGA",1:5),paste0("GTEX",1:5)) exp2 = trans_exp(exp) exp2[,1:5] = exp2[,1:5]+10 group_list = rep(c("A","B"),each = 5) genes = sample(rownames(exp2),3) t_choose(genes,exp2,group_list) ``` -------------------------------- ### draw_venn(x, main, ...) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_venn.Rd Generates a Venn diagram based on the provided list of sets. ```APIDOC ## draw_venn ### Description Creates a Venn diagram visualization for a list of sets, typically used for comparing differential expression results. ### Parameters - **x** (list) - Required - A list of sets to plot. - **main** (character) - Required - The main title of the diagram. - **color** (vector) - Optional - Color vector for the diagram. - **imagetype** (string) - Optional - Image format (e.g., tiff, png, svg). - **filename** (string) - Optional - Filename for output; if NULL, returns the grid object. - **lwd** (numeric) - Optional - Width of the circle's circumference. - **lty** (numeric) - Optional - Dash pattern of the circle's circumference. - **col** (vector) - Optional - Colour of the circle's circumference. - **fill** (vector) - Optional - Colour of the circle's area. - **cat.col** (vector) - Optional - Colour of the category name. - **cat.cex** (numeric) - Optional - Size of the category name. - **cat.dist** (numeric) - Optional - Distance of the category name from the edge. - **rotation.degree** (numeric) - Optional - Degrees to rotate the diagram. - **main.cex** (numeric) - Optional - Font size of the main title. - **cex** (numeric) - Optional - Size of the area label. - **alpha** (numeric) - Optional - Alpha transparency of the circle's area. - **reverse** (logical) - Optional - Reflect the three-set Venn diagram along its vertical axis. - **...** (dots) - Optional - Other parameters passed to venn.diagram. ### Returns A venn plot or a grid object if filename is NULL. ``` -------------------------------- ### Calculate intersection of vectors Source: https://github.com/xjsun1221/tinyarray/blob/master/man/intersect_all.Rd Demonstrates calculating the intersection of multiple vectors using individual arguments or a list, and shows the related union_all function. ```R x1 = letters[1:4] x2 = letters[3:6] x3 = letters[3:4] re =intersect_all(x1,x2,x3) re2 = intersect_all(list(x1,x2,x3)) re3 = union_all(x1,x2,x3) ``` -------------------------------- ### Accessing the cod dataset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/cod.Rd Displays the cod matrix object in the R console. ```R cod ``` -------------------------------- ### Inspect lnc_anno data Source: https://github.com/xjsun1221/tinyarray/blob/master/man/lnc_anno.Rd Display the first few rows of the lnc_anno dataset to verify its structure. ```R head(lnc_anno) ``` -------------------------------- ### Generate box plots for hub genes Source: https://github.com/xjsun1221/tinyarray/blob/master/man/exp_boxplot.Rd Demonstrates how to generate box plots from an expression matrix, checking for the required ggpubr package. ```R if(requireNamespace("ggpubr",quietly = TRUE)) { k = exp_boxplot(log2(exp_hub1+1));k[[1]] }else{ warning("Package 'ggpubr' needed for this function to work. Please install it by install.packages('ggpubr')") } ``` -------------------------------- ### Transform Ensembl IDs to Gene Symbols Source: https://github.com/xjsun1221/tinyarray/blob/master/man/trans_exp_new.Rd Demonstrates how to prepare an expression matrix and apply the trans_exp_new function, requiring the AnnoProbe package. ```R exp = matrix(rnorm(1000),ncol = 10) rownames(exp) = sample(mRNA_annov23$gene_id,100) colnames(exp) = c(paste0("TCGA",1:5),paste0("GTEX",1:5)) if(requireNamespace("AnnoProbe")){ k = trans_exp_new(exp) }else{ warning("Package \"AnnoProbe\" needed for this function to work. Please install it by install.packages('AnnoProbe')") } ``` -------------------------------- ### Inspect meta1 dataset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/meta1.Rd Displays the first few rows of the meta1 data.frame. ```R head(meta1) ``` -------------------------------- ### Inspect deg dataset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/deg.Rd Display the first few rows of the deg data frame. ```R head(deg) ``` -------------------------------- ### Retrieve GPL annotation text Source: https://github.com/xjsun1221/tinyarray/blob/master/man/get_gpl_txt.Rd Downloads or accesses a GPL annotation file from the GEO database using a specific accession ID. ```R get_gpl_txt("GPL23270",destdir = tempdir()) ``` -------------------------------- ### exp_surv(exprSet_hub, meta, cut.point = FALSE, color = c("#2874C5", "#f87669")) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/exp_surv.Rd Draws survival plots for a hub gene expression matrix for tumor samples. Users can specify whether to use a cut point or the median for survival analysis. ```APIDOC ## exp_surv ### Description Draws survival plots for a hub gene expression matrix for tumor samples. ### Signature `exp_surv(exprSet_hub, meta, cut.point = FALSE, color = c("#2874C5", "#f87669"))` ### Parameters - **exprSet_hub** (object) - Required - A tumor expression set for hubgenes. - **meta** (object) - Required - Meta data corresponding to the expression set. - **cut.point** (logical) - Optional - Whether to use a cut point; if FALSE, uses the median by default. - **color** (vector) - Optional - Color palette for the boxplot. ### Returns - **list** - A list of survival plots for all genes. ### Example ```r tmp = exp_surv(exprSet_hub1, meta1) patchwork::wrap_plots(tmp) + patchwork::plot_layout(guides = "collect") tmp2 = exp_surv(exprSet_hub1, meta1, cut.point = TRUE) patchwork::wrap_plots(tmp2) + patchwork::plot_layout(guides = "collect") ``` ``` -------------------------------- ### Inspect deseq_data Source: https://github.com/xjsun1221/tinyarray/blob/master/man/deseq_data.Rd Display the first few rows of the deseq_data dataset. ```R head(deseq_data) ``` -------------------------------- ### Inspect mRNA_annov23 data Source: https://github.com/xjsun1221/tinyarray/blob/master/man/mRNA_annov23.Rd Display the first few rows of the mRNA_annov23 dataset to verify its structure. ```R head(mRNA_annov23) ``` -------------------------------- ### Inspect exprSet_hub1 data subset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/exprSet_hub1.Rd Displays the first four rows and columns of the exprSet_hub1 matrix. ```R exprSet_hub1[1:4,1:4] ``` -------------------------------- ### cor.full(x, drop = min(x) - 0.001, min.obs = 10) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/cor.full.Rd Performs cor.test for all pairs of columns in the provided input. ```APIDOC ## cor.full(x, drop, min.obs) ### Description Performs cor.test for all variables (each two columns) in a numeric matrix or data.frame. ### Parameters - **x** (numeric matrix or data.frame) - Required - The input data to analyze. - **drop** (numeric) - Optional - Values to drop. Defaults to min(x) - 0.001. - **min.obs** (numeric) - Optional - Minimum number of observations after dropping. Defaults to 10. ### Returns - **data.frame** - A data frame containing the cor.test p-value and estimate for each pair of columns. ### Example ```r x = iris[,-5] cor.full(x) ``` ``` -------------------------------- ### Calculate Cox p-values and HR Source: https://github.com/xjsun1221/tinyarray/blob/master/man/surv_cox.Rd Basic usage of surv_cox with default parameters. ```R surv_cox(exprSet_hub1,meta1) ``` -------------------------------- ### Generate a correlation heatmap Source: https://github.com/xjsun1221/tinyarray/blob/master/man/corheatmap.Rd Creates a heatmap visualization based on correlation data from a provided expression matrix. ```R x = rownames(exprSet_hub1)[1:3] y = rownames(exprSet_hub1)[4:7] corheatmap(exprSet_hub1,x,y) ``` -------------------------------- ### Filter duplicated samples from expression data Source: https://github.com/xjsun1221/tinyarray/blob/master/man/sam_filter.Rd Demonstrates how to inspect the dimensions of an expression matrix, apply the sam_filter function, and verify the removal of duplicates. ```R cod[1:4,1:4] dim(cod) cod2 = sam_filter(cod) dim(cod2) g = make_tcga_group(cod);table(g) library(stringr) table(!duplicated(str_sub(colnames(cod[,g=="tumor"]),1,12))) ``` -------------------------------- ### Accessing exp_hub1 data Source: https://github.com/xjsun1221/tinyarray/blob/master/man/exp_hub1.Rd Displays a subset of the expression matrix by indexing the first four rows and columns. ```R exp_hub1[1:4,1:4] ``` -------------------------------- ### draw_volcano(deg, lab = NA, xlab.package = TRUE, pvalue_cutoff = 0.05, logFC_cutoff = 1, pkg = 1, adjust = FALSE, symmetry = FALSE, color = c("#2874C5", "grey", "#f87669")) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_volcano.Rd Generates a volcano plot for differential analysis results. ```APIDOC ## draw_volcano ### Description Generates a volcano plot for differential analysis results stored in a data.frame. ### Arguments - **deg** (data.frame) - Required - A data.frame created by differential analysis. - **lab** (character) - Optional - Label for the x-axis; if NA, uses package-specific naming. - **xlab.package** (logical) - Optional - Whether to use the package name as the x-axis label. - **pvalue_cutoff** (numeric) - Optional - Cutoff value for p-value (default 0.05). - **logFC_cutoff** (numeric) - Optional - Cutoff value for logFC (default 1). - **pkg** (integer) - Optional - Identifier for the differential analysis package used (1: DESeq2, 2: edgeR, 3: limma(voom), 4: limma). - **adjust** (logical) - Optional - Whether to use adjusted p-values (default FALSE). - **symmetry** (logical) - Optional - Whether to make the plot symmetrical. - **color** (vector) - Optional - Color vector for the plot. ### Returns A volcano plot visualization based on logFC and P-value (or adjusted P-value). ### Example ```R draw_volcano(deseq_data, pvalue_cutoff = 0.01, logFC_cutoff = 2) ``` ``` -------------------------------- ### Accessing exists_anno_list Source: https://github.com/xjsun1221/tinyarray/blob/master/man/exists_anno_list.Rd Displays the contents of the exists_anno_list character vector. ```R exists_anno_list ``` -------------------------------- ### Inspect lnc_annov23 data Source: https://github.com/xjsun1221/tinyarray/blob/master/man/lnc_annov23.Rd Display the first few rows of the lnc_annov23 data frame to verify its structure. ```R head(lnc_annov23) ``` -------------------------------- ### box_surv(exp_hub, exprSet_hub, meta) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/box_surv.Rd Draws a box plot for a hub gene expression matrix and a corresponding survival plot. ```APIDOC ## box_surv(exp_hub, exprSet_hub, meta) ### Description Draws a box plot for a hub gene expression matrix and a corresponding survival plot. ### Parameters - **exp_hub** (matrix) - Required - An expression matrix for hubgenes. - **exprSet_hub** (matrix) - Required - A tumor expression set for hubgenes. - **meta** (data.frame) - Required - Meta data corresponding to the expression set. ### Returns - **patchwork** - A patchwork result containing the hub genes boxplot and survival plot. ### Example ```r if(requireNamespace("ggpubr",quietly = TRUE)) { k = box_surv(log2(exp_hub1+1),exprSet_hub1,meta1);k[[1]] }else{ warning("Package 'ggpubr' needed for this function to work.") } ``` ``` -------------------------------- ### Convert interactions to edges in R Source: https://github.com/xjsun1221/tinyarray/blob/master/man/interaction_to_edges.Rd Demonstrates transforming a data frame with delimited interaction strings into a tidy edges format. ```R df = data.frame(a = c("gene1","gene2","gene3"), b = c("d,f,a,b", "c,e,g", "a,b,d")) interaction_to_edges(df) ``` -------------------------------- ### draw_pca(exp, group_list, color, addEllipses, style, color.label, title, ...) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_pca.Rd Performs PCA analysis and generates a PCA plot based on the provided expression matrix and grouping information. ```APIDOC ## draw_pca ### Description Performs PCA analysis and generates a PCA plot. The function supports multiple styles including default, ggplot2, and 3D. ### Parameters - **exp** (numeric matrix) - Required - The input data matrix. - **group_list** (factor) - Required - A factor with duplicated character or factor values for grouping. - **color** (vector) - Optional - A vector of colors to be used in the plot. - **addEllipses** (logical) - Optional - Whether to add ellipses to the plot. Defaults to TRUE. - **style** (string) - Optional - The plot style, options are "default", "ggplot2", or "3D". - **color.label** (string) - Optional - The label for the color legend. - **title** (string) - Optional - The title of the plot. - **...** (dots) - Optional - Additional parameters passed to fviz_pca_ind. ### Returns - A PCA plot object based on the input expression matrix and grouping. ``` -------------------------------- ### draw_KM(meta, group_list, time_col = "time", event_col = "event", ...) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_KM.Rd Generates a Kaplan-Meier survival plot using survival data and grouping information. ```APIDOC ## draw_KM ### Description Draws a Kaplan-Meier survival plot for two or more groups. ### Parameters - **meta** (data.frame) - Required - Survival data containing time and event columns. - **group_list** (factor) - Required - A factor with duplicated character or factor values for grouping. - **time_col** (string) - Optional - Column name for time. Default is "time". - **event_col** (string) - Optional - Column name for event. Default is "event". - **legend.title** (string) - Optional - Title for the plot legend. - **legend.labs** (vector) - Optional - Character vector specifying legend labels. - **color** (vector) - Optional - Color vector for the plot lines. - **...** (dots) - Optional - Additional parameters passed to ggsurvplot. ### Returns - **KM-plot** (object) - A Kaplan-Meier plot object. ### Example ```R require("survival") x = survival::lung draw_KM(meta = x, group_list = x$sex, event_col = "status") ``` ``` -------------------------------- ### Calculate Cox p-values with cut-point and continuous options Source: https://github.com/xjsun1221/tinyarray/blob/master/man/surv_cox.Rd Usage of surv_cox with cut-point enabled and continuous expression data. ```R surv_cox(exprSet_hub1,meta1,cut.point = TRUE,continuous = TRUE) ``` -------------------------------- ### draw_volcano2(deg, pkg = 4, lab, ...) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_volcano2.Rd Generates volcano plots for differential analysis results. Supports multiple differential analysis packages including DESeq2, edgeR, and limma. ```APIDOC ## draw_volcano2 ### Description Prints one or more volcano plots for differential analysis results provided in a data.frame format. ### Signature `draw_volcano2(deg, pkg = 4, lab, ...)` ### Parameters - **deg** (data.frame) - Required - A data.frame created by differential analysis. - **pkg** (integer) - Optional - Specifies the differential analysis package used. Supported values: 1 (DESeq2), 2 (edgeR), 3 (limma(voom)), 4 (limma). Default is 4. - **lab** (string) - Optional - Label for the x-axis in the volcano plot. If NA, the x-axis is named by the package. - **...** (parameters) - Optional - Additional parameters passed to the underlying draw_volcano function. ### Returns - **plot** (object) - One or more volcano plots. ``` -------------------------------- ### Transform expression matrix rownames Source: https://github.com/xjsun1221/tinyarray/blob/master/man/trans_array.Rd Demonstrates how to map probe IDs to gene symbols in an expression matrix using a mapping data frame. ```R exp = matrix(1:50,nrow = 10) rownames(exp) = paste0("g",1:10) ids = data.frame(probe_id = paste0("g",1:10), symbol = paste0("G",c(1:9,9))) trans_array(exp,ids) ``` -------------------------------- ### Accessing the genes dataset Source: https://github.com/xjsun1221/tinyarray/blob/master/man/genes.Rd Display the contents of the genes character vector. ```R genes ``` -------------------------------- ### surv_cox(exprSet_hub, meta, cut.point = FALSE, pvalue_cutoff = 0.05, HRkeep = "all", continuous = FALSE, min_gn = 0.1) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/surv_cox.Rd Calculates Cox p-values and HR for genes based on provided expression sets and metadata. ```APIDOC ## surv_cox ### Description Calculate cox p values and HR for genes. ### Parameters - **exprSet_hub** (matrix/data.frame) - Required - A tumor expression set for hubgenes. - **meta** (data.frame) - Required - Meta data corresponds to expression set. - **cut.point** (logical) - Optional - Use cut_point or not, if FALSE, use median by default. - **pvalue_cutoff** (numeric) - Optional - p value cut off, 0.05 by default. - **HRkeep** (string) - Optional - One of "all", "protect" or "risk". - **continuous** (logical) - Optional - Gene expression or gene expression group. - **min_gn** (numeric) - Optional - If a smaller group of samples is less than 10 percent (default) of all, the gene will be discarded. ### Returns - **matrix** - A matrix with gene names, cox p value and HR. ### Examples ```r surv_cox(exprSet_hub1, meta1) surv_cox(exprSet_hub1, meta1, cut.point = TRUE, continuous = TRUE) surv_cox(exprSet_hub1, meta1, cut.point = TRUE, continuous = TRUE, pvalue_cutoff = 1) ``` ``` -------------------------------- ### Generate a t-SNE plot Source: https://github.com/xjsun1221/tinyarray/blob/master/man/draw_tsne.Rd Demonstrates how to prepare a numeric matrix and group list to visualize data using the draw_tsne function. ```R exp <- matrix(rnorm(10000),nrow = 50) colnames(exp) <- paste0("sample",1:200) rownames(exp) <- paste0("gene",1:50) exp[1:4,1:4] exp[,1:100] = exp[,1:100]+10 group_list <- factor(rep(c("A","B"),each = 100)) if(requireNamespace("Rtsne",quietly = TRUE)){ draw_tsne(exp,group_list) }else{ warning("Package 'Rtsne' needed for this function to work. Please install it by install.packages('Rtsne')") } ``` -------------------------------- ### ggheat(dat, group, ...) Source: https://github.com/xjsun1221/tinyarray/blob/master/man/ggheat.Rd Draws a heatmap plot with annotation using ggplot2. ```APIDOC ## ggheat(dat, group, cluster = FALSE, color = c("#2874C5", "white", "#f87669"), legend_color = ..., show_rownames = TRUE, show_colnames = TRUE, cluster_rows = FALSE, cluster_cols = FALSE, groupname = "group", expname = "exp", fill_mid = TRUE) ### Description Draws a heatmap plot with annotation by ggplot2. ### Parameters - **dat** (matrix) - Required - Expression matrix for plot. - **group** (vector) - Required - Group for expression colnames. - **cluster** (logical) - Optional - Cluster in both rows and column or not, default F (replaced by cluster_rows and cluster_cols). - **color** (vector) - Optional - Color for heatmap. - **legend_color** (vector) - Optional - Color for legend. - **show_rownames** (logical) - Optional - Show rownames in plot or not, default T. - **show_colnames** (logical) - Optional - Show colnames in plot or not, default T. - **cluster_rows** (logical) - Optional - If rows (on the plot) should be clustered, default F. - **cluster_cols** (logical) - Optional - If column (on the plot) should be clustered, default F. - **groupname** (string) - Optional - Name of group legend. - **expname** (string) - Optional - Name of exp legend. - **fill_mid** (logical) - Optional - Use median value as geom_tile fill midpoint. ### Returns - **ggplot object** - A ggplot object representing the heatmap. ```