Title: | Expression Data Analysis and Visualization |
---|---|
Description: | The Gene Expression Omnibus (<https://www.ncbi.nlm.nih.gov/geo/>) and The Cancer Genome Atlas (<https://portal.gdc.cancer.gov/>) are widely used medical public databases. Our platform integrates routine analysis and visualization tools for expression data to provide concise and intuitive data analysis and presentation. |
Authors: | Xiaojie Sun [aut, cre] |
Maintainer: | Xiaojie Sun <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.4.2 |
Built: | 2025-03-10 02:52:27 UTC |
Source: | https://github.com/xjsun1221/tinyarray |
draw box plot for a hub gene expression matrix
box_surv(exp_hub, exprSet_hub, meta)
box_surv(exp_hub, exprSet_hub, meta)
exp_hub |
an expression matrix for hubgenes |
exprSet_hub |
a tumor expression set for hubgenes |
meta |
meta data corresponds to expression set |
patchwork result for hub genes boxplot and survival plot
Xiaojie Sun
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')") }
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')") }
An expression matrix form TCGA
cod
cod
An object of class matrix
(inherits from array
) with 100 rows and 512 columns.
cod
cod
cor.test for all variables(each two columns)
cor.full(x, drop = min(x) - 0.001, min.obs = 10)
cor.full(x, drop = min(x) - 0.001, min.obs = 10)
x |
A numeric matrix or data.frame |
drop |
drop values |
min.obs |
minimum number of observations after dropping |
a data.frame with cor.test p.value and estimate
Xiaojie Sun
x = iris[,-5] cor.full(x)
x = iris[,-5] cor.full(x)
cor.test for all variables(each two columns)
cor.one( x, var, drop.var = min(x[, var]) - 0.001, drop.other = min(x[, -which(colnames(x) == var)]) - 0.001, min.obs = 10 )
cor.one( x, var, drop.var = min(x[, var]) - 0.001, drop.other = min(x[, -which(colnames(x) == var)]) - 0.001, min.obs = 10 )
x |
A numeric matrix or data.frame |
var |
your chosen variable,only one. |
drop.var |
drop values in var |
drop.other |
drop values in other columns |
min.obs |
minimum number of observations after dropping |
A data.frame with cor.test p.value and estimate
Xiaojie Sun
x = iris[,-5] cor.one(x,"Sepal.Width")
x = iris[,-5] cor.one(x,"Sepal.Width")
draw cor heatmap
corheatmap(exp, x, y, color = c("#2fa1dd", "white", "#f87669"))
corheatmap(exp, x, y, color = c("#2fa1dd", "white", "#f87669"))
exp |
A numeric matrix |
x |
genes or cells from exp |
y |
genes or cells from exp |
color |
color for heatmap |
a ggplot object
Xiaojie Sun
x = rownames(exprSet_hub1)[1:3] y = rownames(exprSet_hub1)[4:7] corheatmap(exprSet_hub1,x,y)
x = rownames(exprSet_hub1)[1:3] y = rownames(exprSet_hub1)[4:7] corheatmap(exprSet_hub1,x,y)
draw cor scatter plot with density plot by ggplot2
corscatterplot( dat, x, y, color_cor = "blue", fill_cor = "lightgray", fill_x = "#ff820e", fill_y = "#0000fe", type = "density", ... )
corscatterplot( dat, x, y, color_cor = "blue", fill_cor = "lightgray", fill_x = "#ff820e", fill_y = "#0000fe", type = "density", ... )
dat |
plot data |
x |
x |
y |
y |
color_cor |
color for cor reg.line |
fill_cor |
fill for cor reg.line |
fill_x |
fill for top density plot |
fill_y |
fill for right density plot |
type |
whether to use a density plot or a histogram plot for the side panel. |
... |
other paramters for ggscatter |
a ggplot object
Xiaojie Sun
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')") }
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')") }
limma differential analysis result for GSE42872
deg
deg
An object of class data.frame
with 18591 rows and 10 columns.
head(deg)
head(deg)
DEseq2 differential analysis result
deseq_data
deseq_data
An object of class data.frame
with 552 rows and 6 columns.
head(deseq_data)
head(deseq_data)
draw enrichment bar plots for both up and down genes,for human only.
double_enrich(deg, n = 10, color = c("#2874C5", "#f87669"))
double_enrich(deg, n = 10, color = c("#2874C5", "#f87669"))
deg |
a data.frame contains at least two columns:"ENTREZID" and "change" |
n |
how many terms will you perform for up and down genes respectively |
color |
color for bar plot |
a list with kegg and go bar plot according to up and down genes enrichment result.
Xiaojie Sun
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
draw boxplot for expression
draw_boxplot( exp, group_list, method = "kruskal.test", sort = TRUE, drop = FALSE, width = 0.5, pvalue_cutoff = 0.05, xlab = "Gene", ylab = "Expression", grouplab = "Group", p.label = FALSE, add_error_bar = FALSE, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), ... )
draw_boxplot( exp, group_list, method = "kruskal.test", sort = TRUE, drop = FALSE, width = 0.5, pvalue_cutoff = 0.05, xlab = "Gene", ylab = "Expression", grouplab = "Group", p.label = FALSE, add_error_bar = FALSE, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), ... )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
method |
one of kruskal.test,aov,t.test and wilcox.test |
sort |
whether the boxplot will be sorted |
drop |
whether to discard insignificant values |
width |
width of boxplot and error bar |
pvalue_cutoff |
if drop = TRUE,genes with p-values below the threshold will be drawn |
xlab |
title of the x axis |
ylab |
title of the y axis |
grouplab |
title of group legend |
p.label |
whether to show p value in the plot |
add_error_bar |
whether to add error bar |
color |
color vector |
... |
other parameters from stat_compare_means |
a boxplot according to exp
and grouped by group
.
Xiaojie Sun
draw_heatmap
;draw_volcano
;draw_venn
if(requireNamespace("tidyr",quietly = TRUE)& requireNamespace("ggpubr",quietly = TRUE)){ draw_boxplot(t(iris[,1:4]),iris$Species) exp <- matrix(rnorm(60),nrow = 10) colnames(exp) <- paste0("sample",1:6) rownames(exp) <- paste0("gene",1:10) exp[,4:6] = exp[,4:6] +10 exp[1:4,1:4] group_list <- factor(rep(c("A","B"),each = 3)) draw_boxplot(exp,group_list) draw_boxplot(exp,group_list,color = c("grey","red")) }else{ if(!requireNamespace("ggpubr",quietly = TRUE)) { warning("Package 'ggpubr' needed for this function to work. Please install it by install.packages('ggpubr')") } if(!requireNamespace("tidyr",quietly = TRUE)) { warning("Package 'tidyr' needed for this function to work. Please install it by install.packages('tidyr')") } }
if(requireNamespace("tidyr",quietly = TRUE)& requireNamespace("ggpubr",quietly = TRUE)){ draw_boxplot(t(iris[,1:4]),iris$Species) exp <- matrix(rnorm(60),nrow = 10) colnames(exp) <- paste0("sample",1:6) rownames(exp) <- paste0("gene",1:10) exp[,4:6] = exp[,4:6] +10 exp[1:4,1:4] group_list <- factor(rep(c("A","B"),each = 3)) draw_boxplot(exp,group_list) draw_boxplot(exp,group_list,color = c("grey","red")) }else{ if(!requireNamespace("ggpubr",quietly = TRUE)) { warning("Package 'ggpubr' needed for this function to work. Please install it by install.packages('ggpubr')") } if(!requireNamespace("tidyr",quietly = TRUE)) { warning("Package 'tidyr' needed for this function to work. Please install it by install.packages('tidyr')") } }
warning a heatmap plot for expression matrix and group by group_list praramter, exp will be scaled.
draw_heatmap( n, group_list, scale_before = FALSE, n_cutoff = 3, legend = FALSE, show_rownames = FALSE, annotation_legend = FALSE, split_column = FALSE, show_column_title = FALSE, color = (grDevices::colorRampPalette(c("#2fa1dd", "white", "#f87669")))(100), color_an = c("#2fa1dd", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), scale = TRUE, main = NA, ... )
draw_heatmap( n, group_list, scale_before = FALSE, n_cutoff = 3, legend = FALSE, show_rownames = FALSE, annotation_legend = FALSE, split_column = FALSE, show_column_title = FALSE, color = (grDevices::colorRampPalette(c("#2fa1dd", "white", "#f87669")))(100), color_an = c("#2fa1dd", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), scale = TRUE, main = NA, ... )
n |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
scale_before |
deprecated parameter |
n_cutoff |
3 by defalut , scale before plot and set a cutoff,usually 2 or 1.6 |
legend |
logical,show legend or not |
show_rownames |
logical,show rownames or not |
annotation_legend |
logical,show annotation legend or not |
split_column |
split column by group_list |
show_column_title |
show column title or not |
color |
color for heatmap |
color_an |
color for column annotation |
scale |
logical,scale the matrix or not |
main |
the title of the plot |
... |
other parameters from pheatmap |
a heatmap plot according to exp
and grouped by group
.
Xiaojie Sun
draw_pca
;draw_volcano
;draw_venn
#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')") }
#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')") }
print heatmap plots for expression matrix and group by group_list paramter
draw_heatmap2(exp, group_list, deg, my_genes = NULL, heat_union = TRUE, ...)
draw_heatmap2(exp, group_list, deg, my_genes = NULL, heat_union = TRUE, ...)
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
deg |
a data.frame created by Differential analysis |
my_genes |
genes for pheatmap |
heat_union |
logical ,use union or intersect DEGs for heatmap |
... |
other parameters from draw_heatmap |
a heatmap plot according to exp
and grouped by group
.
Xiaojie Sun
draw_pca
;draw_volcano
;draw_venn
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
draw KM-plot with two or more group
draw_KM( meta, group_list, time_col = "time", event_col = "event", legend.title = "Group", legend.labs = levels(group_list), color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), ... )
draw_KM( meta, group_list, time_col = "time", event_col = "event", legend.title = "Group", legend.labs = levels(group_list), color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), ... )
meta |
survival data with time and event column |
group_list |
A factor with duplicated character or factor |
time_col |
colname of time |
event_col |
colname of event |
legend.title |
legend title |
legend.labs |
character vector specifying legend labels |
color |
color vector |
... |
other parameters from ggsurvplot |
a KM-plot
Xiaojie Sun
require("survival") x = survival::lung draw_KM(meta = x, group_list = x$sex,event_col = "status")
require("survival") x = survival::lung draw_KM(meta = x, group_list = x$sex,event_col = "status")
do PCA analysis and warning a PCA plot
draw_pca( exp, group_list, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), addEllipses = TRUE, style = "default", color.label = "Group", title = "", ... )
draw_pca( exp, group_list, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), addEllipses = TRUE, style = "default", color.label = "Group", title = "", ... )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
color |
color vector |
addEllipses |
logical,add ellipses or not |
style |
plot style,"default","ggplot2"and "3D" |
color.label |
color legend label |
title |
plot title |
... |
other paramters from fviz_pca_ind |
a pca plot according to exp
and grouped by group
.
Xiaojie Sun
draw_heatmap
;draw_volcano
;draw_venn
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')") } } 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')") } }
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')") } } 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')") } }
draw tsne plot with annotation by ggplot2
draw_tsne( exp, group_list, perplexity = 30, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), color.label = "group", addEllipses = TRUE )
draw_tsne( exp, group_list, perplexity = 30, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), color.label = "group", addEllipses = TRUE )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
perplexity |
numeric; perplexity parameter for Rtsne |
color |
color vector |
color.label |
color legend label |
addEllipses |
logical,add ellipses or not |
a ggplot object
Xiaojie Sun
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')") }
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')") }
warning a venn plot for deg result created by three packages
draw_venn( x, main, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), imagetype = "png", filename = NULL, lwd = 1, lty = 1, col = color[1:length(x)], fill = color[1:length(x)], cat.col = color[1:length(x)], cat.cex = 1, cat.dist = -0.15, rotation.degree = 0, main.cex = 1, cex = 1, alpha = 0.1, reverse = TRUE, ... )
draw_venn( x, main, color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), imagetype = "png", filename = NULL, lwd = 1, lty = 1, col = color[1:length(x)], fill = color[1:length(x)], cat.col = color[1:length(x)], cat.cex = 1, cat.dist = -0.15, rotation.degree = 0, main.cex = 1, cex = 1, alpha = 0.1, reverse = TRUE, ... )
x |
a list for plot |
main |
Character giving the main title of the diagram |
color |
color vector |
imagetype |
Specification of the image format (e.g. tiff, png or svg) |
filename |
Filename for image output, or if NULL returns the grid object itself |
lwd |
width of the circle's circumference |
lty |
dash pattern of the circle's circumference |
col |
Colour of the circle's circumference |
fill |
Colour of the circle's area |
cat.col |
Colour of the category name |
cat.cex |
size of the category name |
cat.dist |
The distance (in npc units) of the category name from the edge of the circle (can be negative) |
rotation.degree |
Number of degrees to rotate the entire diagram |
main.cex |
Number giving the cex (font size) of the main title |
cex |
size of the area label |
alpha |
Alpha transparency of the circle's area |
reverse |
logical,reflect the three-set Venn diagram along its central vertical axis of symmetry. Use in combination with rotation to generate all possible set orders |
... |
other parameters from venn.diagram |
a venn plot according to x
, y
and.z
named "name" paramter
Xiaojie Sun
draw_pca
;draw_volcano
;draw_heatmap
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')") } }
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')") } }
warning a volcano plot for Differential analysis result in data.frame format.
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") )
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") )
deg |
a data.frame created by Differential analysis |
lab |
label for x axis in volcano plot, if NA , x axis names by package |
xlab.package |
whether to use the package name as the x axis name |
pvalue_cutoff |
Cutoff value of pvalue,0.05 by default. |
logFC_cutoff |
Cutoff value of logFC,1 by default. |
pkg |
a integer ,means which Differential analysis packages you used,we support three packages by now, 1,2,3,4 respectively means "DESeq2","edgeR","limma(voom)","limma" |
adjust |
a logical value, would you like to use adjusted pvalue to draw this plot,FAlSE by default. |
symmetry |
a logical value ,would you like to get your plot symmetrical |
color |
color vector |
a volcano plot according to logFC and P.value(or adjust P.value)
Xiaojie Sun
draw_heatmap
;draw_pca
;draw_venn
head(deseq_data) draw_volcano(deseq_data) draw_volcano(deseq_data,pvalue_cutoff = 0.01,logFC_cutoff = 2) draw_volcano(deseq_data,color = c("darkgreen", "darkgrey", "#B2182B"))
head(deseq_data) draw_volcano(deseq_data) draw_volcano(deseq_data,pvalue_cutoff = 0.01,logFC_cutoff = 2) draw_volcano(deseq_data,color = c("darkgreen", "darkgrey", "#B2182B"))
print one or more volcano plot for Differential analysis result in data.frame fomat.
draw_volcano2(deg, pkg = 4, lab, ...)
draw_volcano2(deg, pkg = 4, lab, ...)
deg |
a data.frame created by Differential analysis |
pkg |
a integer ,means which Differential analysis packages you used,we support three packages by now, 1,2,3,4 respectively means "DESeq2","edgeR","limma(voom)","limma" |
lab |
label for x axis in volcano plot, if NA , x axis names by package |
... |
other parameters from draw_volcano |
one or more volcano plot
Xiaojie Sun
geo_download
;draw_volcano
;draw_venn
## Not run: if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ #two group gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) group_list = rep(c("A","B"),each = 3) ids = AnnoProbe::idmap('GPL6244',destdir = tempdir()) deg = get_deg(geo$exp,group_list,ids) draw_volcano2(deg) #multigroup 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_volcano2(deg) draw_volcano2(deg,color = c("darkgreen","grey","darkred")) }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) } } ## End(Not run)
## Not run: if(requireNamespace("Biobase",quietly = TRUE)& requireNamespace("AnnoProbe",quietly = TRUE)){ #two group gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) group_list = rep(c("A","B"),each = 3) ids = AnnoProbe::idmap('GPL6244',destdir = tempdir()) deg = get_deg(geo$exp,group_list,ids) draw_volcano2(deg) #multigroup 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_volcano2(deg) draw_volcano2(deg,color = c("darkgreen","grey","darkred")) }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) } } ## End(Not run)
in geo analysis,this function can help you simplify pdata, delete columns with unique values,which can't be used as group vector
dumd(x)
dumd(x)
x |
A data.frame. |
The simple data.frame of columns unique values count in x
dumd(iris) data(ToothGrowth) x = ToothGrowth dumd(ToothGrowth)
dumd(iris) data(ToothGrowth) x = ToothGrowth dumd(ToothGrowth)
get nodes from edges
edges_to_nodes(edges)
edges_to_nodes(edges)
edges |
data.frame |
nodes data.frame
Xiaojie Sun
df = data.frame(a = c("gene1","gene2","gene3"), b = c("d,f,a,b", "c,e,g", "a,b,d")) edges = interaction_to_edges(df) nodes = edges_to_nodes(edges)
df = data.frame(a = c("gene1","gene2","gene3"), b = c("d,f,a,b", "c,e,g", "a,b,d")) edges = interaction_to_edges(df) nodes = edges_to_nodes(edges)
AnnoProbe supported GPLs
exists_anno_list
exists_anno_list
An object of class character
of length 175.
exists_anno_list
exists_anno_list
draw box plot for a hub gene expression matrix
exp_boxplot(exp_hub, color = c("#2fa1dd", "#f87669"))
exp_boxplot(exp_hub, color = c("#2fa1dd", "#f87669"))
exp_hub |
an expression matrix for hubgenes |
color |
color for boxplot |
box plots list for all genes in the matrix
Xiaojie Sun
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')") }
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')") }
An expression matrix from TCGA and Gtex
exp_hub1
exp_hub1
An object of class matrix
(inherits from array
) with 8 rows and 350 columns.
exp_hub1[1:4,1:4]
exp_hub1[1:4,1:4]
draw surv plot for a hub gene expression matrix for tumor samples
exp_surv(exprSet_hub, meta, cut.point = FALSE, color = c("#2874C5", "#f87669"))
exp_surv(exprSet_hub, meta, cut.point = FALSE, color = c("#2874C5", "#f87669"))
exprSet_hub |
a tumor expression set for hubgenes |
meta |
meta data corresponds to expression set |
cut.point |
logical , use cut_point or not, if FALSE,use median by defult |
color |
color for boxplot |
survival plots list for all genes
Xiaojie Sun
exp_boxplot
;box_surv
;draw_venn
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")
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")
An cpm expression matrix from TCGA,tumor samples only
exprSet_hub1
exprSet_hub1
An object of class matrix
(inherits from array
) with 8 rows and 177 columns.
exprSet_hub1[1:4,1:4]
exprSet_hub1[1:4,1:4]
find gpl annotation package or files
find_anno(gpl, install = FALSE, update = FALSE)
find_anno(gpl, install = FALSE, update = FALSE)
gpl |
a gpl accession |
install |
whether to install and library the package |
update |
whether to update the package |
a list with deg data.frame, volcano plot and a list with DEGs.
Xiaojie Sun
find_anno("GPL570")
find_anno("GPL570")
some gene entriz ids
genes
genes
An object of class character
of length 511.
genes
genes
download gse data and get informations
geo_download( gse, by_annopbrobe = TRUE, simpd = TRUE, colon_remove = FALSE, destdir = getwd(), n = 1 )
geo_download( gse, by_annopbrobe = TRUE, simpd = TRUE, colon_remove = FALSE, destdir = getwd(), n = 1 )
gse |
gse assession number |
by_annopbrobe |
download data by geoquery or annoprobe |
simpd |
get simplified pdata,drop out columns with all same values |
colon_remove |
whether to remove duplicated columns with colons |
destdir |
The destination directory for data downloads. |
n |
For data with more than one ExpressionSet, specify which one to analyze |
a list with exp,pd and gpl
Xiaojie Sun
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
extract DEGs from deg data.frame
get_cgs(deg)
get_cgs(deg)
deg |
a data.frame created by Differential analysis |
a list with upgenes,downgenes,diffgenes.
Xiaojie Sun
geo_download
;draw_volcano
;draw_venn
## Not run: #two group gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) group_list = rep(c("A","B"),each = 3) ids = AnnoProbe::idmap('GPL6244',destdir=tempdir()) deg = get_deg(geo$exp,group_list,ids) cgs = get_cgs(deg) #mutigroup 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) cgs = get_cgs(deg) ## End(Not run)
## Not run: #two group gse = "GSE42872" geo = geo_download(gse,destdir=tempdir()) group_list = rep(c("A","B"),each = 3) ids = AnnoProbe::idmap('GPL6244',destdir=tempdir()) deg = get_deg(geo$exp,group_list,ids) cgs = get_cgs(deg) #mutigroup 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) cgs = get_cgs(deg) ## End(Not run)
get RNA-seq count file from GEO database
get_count_txt(gse, destdir = getwd(), download = FALSE)
get_count_txt(gse, destdir = getwd(), download = FALSE)
gse |
gse assession number |
destdir |
The destination directory for data downloads. |
download |
download the txt file or not |
a list with deg data.frame, volcano plot and a list with DEGs.
Xiaojie Sun
get_count_txt("GSE162550",destdir = tempdir())
get_count_txt("GSE162550",destdir = tempdir())
do differential analysis according to expression set and group information
get_deg( exp, group_list, ids, logFC_cutoff = 1, pvalue_cutoff = 0.05, adjust = FALSE, entriz = TRUE, species = "human" )
get_deg( exp, group_list, ids, logFC_cutoff = 1, pvalue_cutoff = 0.05, adjust = FALSE, entriz = TRUE, species = "human" )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
ids |
a data.frame with 2 columns,including probe_id and symbol |
logFC_cutoff |
Cutoff value of logFC,1 by default. |
pvalue_cutoff |
Cutoff value of pvalue,0.05 by default. |
adjust |
a logical value, would you like to use adjusted pvalue to draw this plot,FAlSE by default. |
entriz |
whether convert symbols to entriz ids |
species |
choose human or mouse, or rat, default: human |
a deg data.frame with 10 columns
Xiaojie Sun
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
do diffiencial analysis according to exprission set and group information
get_deg_all( exp, group_list, ids, symmetry = TRUE, my_genes = NULL, show_rownames = FALSE, cluster_cols = TRUE, color_volcano = c("#2874C5", "grey", "#f87669"), logFC_cutoff = 1, pvalue_cutoff = 0.05, adjust = FALSE, entriz = TRUE, n_cutoff = 2, annotation_legend = FALSE, lab = NA, species = "human" )
get_deg_all( exp, group_list, ids, symmetry = TRUE, my_genes = NULL, show_rownames = FALSE, cluster_cols = TRUE, color_volcano = c("#2874C5", "grey", "#f87669"), logFC_cutoff = 1, pvalue_cutoff = 0.05, adjust = FALSE, entriz = TRUE, n_cutoff = 2, annotation_legend = FALSE, lab = NA, species = "human" )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
ids |
a data.frame with 2 columns,including probe_id and symbol |
symmetry |
a logical value ,would you like to get your plot symmetrical |
my_genes |
genes for pheatmap |
show_rownames |
logical,show rownames or not |
cluster_cols |
boolean values determining if columns should be clustered or |
color_volcano |
color for volcano |
logFC_cutoff |
Cutoff value of logFC,1 by default. |
pvalue_cutoff |
Cutoff value of pvalue,0.05 by default. |
adjust |
a logical value, would you like to use adjusted pvalue to draw this plot,FAlSE by default. |
entriz |
logical , if TRUE ,convert symbol to entriz id. |
n_cutoff |
3 by defalut , scale before plot and set a cutoff,usually 2 or 1.6 |
annotation_legend |
logical,show annotation legend or not |
lab |
label for x axis in volcano plot, if NA , x axis names by package |
species |
choose human or mouse, or rat, default: human |
a list with deg data.frame, volcano plot ,pca plot ,heatmap and a list with DEGs.
Xiaojie Sun
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
get gpl annotation txt file from GEO database
get_gpl_txt(gpl, destdir = getwd(), download = FALSE)
get_gpl_txt(gpl, destdir = getwd(), download = FALSE)
gpl |
gpl accession from GEO database |
destdir |
The destination directory for data downloads. |
download |
download the txt file or not |
a list with deg data.frame, volcano plot and a list with DEGs.
Xiaojie Sun
get_gpl_txt("GPL23270",destdir = tempdir())
get_gpl_txt("GPL23270",destdir = tempdir())
draw heatmap plot with annotation by ggplot2
ggheat( dat, group, cluster = FALSE, color = c("#2874C5", "white", "#f87669"), legend_color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), show_rownames = TRUE, show_colnames = TRUE, cluster_rows = FALSE, cluster_cols = FALSE, groupname = "group", expname = "exp", fill_mid = TRUE )
ggheat( dat, group, cluster = FALSE, color = c("#2874C5", "white", "#f87669"), legend_color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"), show_rownames = TRUE, show_colnames = TRUE, cluster_rows = FALSE, cluster_cols = FALSE, groupname = "group", expname = "exp", fill_mid = TRUE )
dat |
expression matrix for plot |
group |
group for expression colnames |
cluster |
logical,cluster in both rows and column or not, default F,now replaced by cluster_rows and cluster_cols. |
color |
color for heatmap |
legend_color |
color for legend |
show_rownames |
logical,show rownames in plot or not, default T |
show_colnames |
logical,show colnames in plot or not, default T |
cluster_rows |
logical, if rows (on the plot) should be clustered, default F |
cluster_cols |
logical, if column (on the plot) should be clustered, default F |
groupname |
name of group legend |
expname |
name of exp legend |
fill_mid |
use median value as geom_tile fill midpoint |
a ggplot object
Xiaojie Sun
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")
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")
make hypertest for given lncRNA and mRNA common miRNAs
hypertest(lnc, pc, deMIR = NULL, lnctarget, pctarget)
hypertest(lnc, pc, deMIR = NULL, lnctarget, pctarget)
lnc |
lncRNA names |
pc |
mRNA names |
deMIR |
miRNA names , default NULL |
lnctarget |
a data.frame with two column,lncRNA in the first column ,miRNA in the second column |
pctarget |
a data.frame with two column,mRNA in the first column ,miRNA in the second column |
a data.frame with hypertest result
Xiaojie Sun
# to update
# to update
split interactions by sep paramter,return edges data.frame
interaction_to_edges(df, a = 1, b = 2, sep = ",")
interaction_to_edges(df, a = 1, b = 2, sep = ",")
df |
interactions data.frame |
a |
column to replicate |
b |
column to split |
sep |
a character string to separate b column |
a new data.frame with two column ,one interaction by one rows
Xiaojie Sun
df = data.frame(a = c("gene1","gene2","gene3"), b = c("d,f,a,b", "c,e,g", "a,b,d")) interaction_to_edges(df)
df = data.frame(a = c("gene1","gene2","gene3"), b = c("d,f,a,b", "c,e,g", "a,b,d")) interaction_to_edges(df)
calculate intersect set for two or more elements
intersect_all(...)
intersect_all(...)
... |
some vectors or a list with some vectors |
vector
Xiaojie Sun
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)
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)
annotation for TCGA expression matrix(lncRNA),form genecode v22 gtf file.
lnc_anno
lnc_anno
An object of class data.frame
with 14826 rows and 3 columns.
head(lnc_anno)
head(lnc_anno)
annotation for TCGA and gtex expression matrix(lncRNA),form genecode v23 gtf file.
lnc_annov23
lnc_annov23
An object of class data.frame
with 14852 rows and 3 columns.
head(lnc_annov23)
head(lnc_annov23)
make tcga group for given tcga expression matrix
make_tcga_group(exp)
make_tcga_group(exp)
exp |
TCGA or TCGA_Gtex expression set from gdc or xena |
a group factor with normal and tumor ,correspond to colnames for expression matrix
Xiaojie Sun
k = make_tcga_group(exp_hub1);table(k)
k = make_tcga_group(exp_hub1);table(k)
match exp and clinical data from TCGA
match_exp_cl(exp, cl, id_column = "id", sample_centric = TRUE)
match_exp_cl(exp, cl, id_column = "id", sample_centric = TRUE)
exp |
TCGA expression set |
cl |
TCGA clinical data.frame |
id_column |
which column contains patient ids, column number or colnmn name. |
sample_centric |
logical,deault T,keep all samples from the same patients.if FALSE,keep only one tumor sample for one patient. |
a transformed clinical data.frame with sample ids.
Xiaojie Sun
a = match_exp_cl(exp_hub1,meta1[,2:4],"X_PATIENT") exp_matched = a[[1]] cl_matched = a[[2]] b = match_exp_cl(exp_hub1,meta1[,2:4],"X_PATIENT",sample_centric = FALSE) exp_matched = b[[1]] cl_matched = b[[2]]
a = match_exp_cl(exp_hub1,meta1[,2:4],"X_PATIENT") exp_matched = a[[1]] cl_matched = a[[2]] b = match_exp_cl(exp_hub1,meta1[,2:4],"X_PATIENT",sample_centric = FALSE) exp_matched = b[[1]] cl_matched = b[[2]]
clinical messages for some TCGA patients,correspond to exprSet_hub1
meta1
meta1
An object of class data.frame
with 177 rows and 4 columns.
head(meta1)
head(meta1)
annotation for TCGA and gtex expression matrix(mRNA),form genecode v22 gtf file.
mRNA_anno
mRNA_anno
An object of class data.frame
with 19814 rows and 3 columns.
head(mRNA_anno)
head(mRNA_anno)
annotation for TCGA and gtex expression matrix(mRNA),form genecode v23 gtf file.
mRNA_annov23
mRNA_annov23
An object of class data.frame
with 19797 rows and 3 columns.
head(mRNA_annov23)
head(mRNA_annov23)
do diffiential analysis according to expression set and group information
multi_deg( exp, group_list, ids, logFC_cutoff = 1, pvalue_cutoff = 0.05, adjust = FALSE, species = "human", entriz = TRUE )
multi_deg( exp, group_list, ids, logFC_cutoff = 1, pvalue_cutoff = 0.05, adjust = FALSE, species = "human", entriz = TRUE )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
ids |
a data.frame with 2 columns,including probe_id and symbol |
logFC_cutoff |
Cutoff value of logFC,1 by default. |
pvalue_cutoff |
Cutoff value of pvalue,0.05 by default. |
adjust |
a logical value, would you like to use adjusted pvalue to draw this plot,FAlSE by default. |
species |
choose human or mouse, or rat, default: human |
entriz |
whether convert symbols to entriz ids |
a deg data.frame with 10 columns
Xiaojie Sun
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
do diffiencial analysis according to exprission set and group information
multi_deg_all( exp, group_list, ids, symmetry = TRUE, my_genes = NULL, show_rownames = FALSE, cluster_cols = TRUE, color_volcano = c("#2874C5", "grey", "#f87669"), pvalue_cutoff = 0.05, logFC_cutoff = 1, adjust = FALSE, entriz = TRUE, annotation_legend = FALSE, lab = NA, species = "human" )
multi_deg_all( exp, group_list, ids, symmetry = TRUE, my_genes = NULL, show_rownames = FALSE, cluster_cols = TRUE, color_volcano = c("#2874C5", "grey", "#f87669"), pvalue_cutoff = 0.05, logFC_cutoff = 1, adjust = FALSE, entriz = TRUE, annotation_legend = FALSE, lab = NA, species = "human" )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
ids |
a data.frame with 2 columns,including probe_id and symbol |
symmetry |
a logical value ,would you like to get your plot symmetrical |
my_genes |
genes for pheatmap |
show_rownames |
boolean specifying if column names are be shown. |
cluster_cols |
boolean values determining if columns should be clustered or |
color_volcano |
color for volcano |
pvalue_cutoff |
Cutoff value of pvalue,0.05 by default. |
logFC_cutoff |
Cutoff value of logFC,1 by default. |
adjust |
a logical value, would you like to use adjusted pvalue to draw this plot,FAlSE by default. |
entriz |
whether convert symbols to entriz ids |
annotation_legend |
boolean value showing if the legend for annotation tracks should be drawn. |
lab |
label for x axis in volcano plot, if NA , x axis names by package |
species |
choose human or mouse, or rat, default: human |
a list with deg data.frame, volcano plot and a list with DEGs.
Xiaojie Sun
geo_download
;draw_volcano
;draw_venn
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
bioconductor annotation packages for GPLs
pkg_all
pkg_all
An object of class data.frame
with 82 rows and 3 columns.
head(pkg_all)
head(pkg_all)
make cor.test for given lncRNA and mRNA
plcortest(lnc_exp, mRNA_exp, cor_cutoff = 0)
plcortest(lnc_exp, mRNA_exp, cor_cutoff = 0)
lnc_exp |
lncRNA expression set |
mRNA_exp |
mRNA expression set which nrow equal to lncRNA_exp |
cor_cutoff |
cor estimate cut_off, default 0 |
a list with cor.test result,names are lncRNAs, element are mRNAs
Xiaojie Sun
# to update
# to update
plot pca plot,volcano plot,heatmap,and venn plot for Differential analysis result
plot_deg( exp, group_list, deg, symmetry = TRUE, my_genes = NULL, show_rownames = FALSE, cluster_cols = TRUE, color_volcano = c("#2874C5", "grey", "#f87669"), pvalue_cutoff = 0.05, logFC_cutoff = 1, adjust = FALSE, annotation_legend = FALSE, lab = NA, species = "human" )
plot_deg( exp, group_list, deg, symmetry = TRUE, my_genes = NULL, show_rownames = FALSE, cluster_cols = TRUE, color_volcano = c("#2874C5", "grey", "#f87669"), pvalue_cutoff = 0.05, logFC_cutoff = 1, adjust = FALSE, annotation_legend = FALSE, lab = NA, species = "human" )
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
deg |
result of multi_deg or get_deg function |
symmetry |
a logical value ,would you like to get your plot symmetrical |
my_genes |
genes for pheatmap |
show_rownames |
boolean specifying if column names are be shown. |
cluster_cols |
boolean values determining if columns should be clustered or |
color_volcano |
color for volcano |
pvalue_cutoff |
Cutoff value of pvalue,0.05 by default. |
logFC_cutoff |
Cutoff value of logFC,1 by default. |
adjust |
a logical value, would you like to use adjusted pvalue to draw this plot,FAlSE by default. |
annotation_legend |
boolean value showing if the legend for annotation tracks should be drawn. |
lab |
label for x axis in volcano plot, if NA , x axis names by package |
species |
choose human or mouse, or rat, default: human |
plots
Xiaojie Sun
## Not run: 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) } } ## End(Not run)
## Not run: 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) } } ## End(Not run)
calculate cut point for multiple genes
point_cut(exprSet_hub, meta)
point_cut(exprSet_hub, meta)
exprSet_hub |
a tumor expression set for hubgenes |
meta |
meta data corresponds to expression set |
a vector with cutpoint for genes
Xiaojie Sun
point_cut(exprSet_hub1,meta1)
point_cut(exprSet_hub1,meta1)
do diffiencial analysis according to exprission set and group information,for human only
quick_enrich( genes, kkgo_file = "kkgo_file.Rdata", destdir = getwd(), species = "human" )
quick_enrich( genes, kkgo_file = "kkgo_file.Rdata", destdir = getwd(), species = "human" )
genes |
a gene symbol or entrizid vector |
kkgo_file |
Rdata filename for kegg and go result |
destdir |
destdir to save kkgofile |
species |
choose human or mouse, or rat, default: human |
enrichment results and dotplots
Xiaojie Sun
## Not run: 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) } ## End(Not run)
## Not run: 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) } ## End(Not run)
draw risk plot
risk_plot( exprSet_hub, meta, riskscore, cut.point = FALSE, color = c("#2fa1dd", "#f87669"), n_cutoff = 3 )
risk_plot( exprSet_hub, meta, riskscore, cut.point = FALSE, color = c("#2fa1dd", "#f87669"), n_cutoff = 3 )
exprSet_hub |
a tumor expression set for hubgenes |
meta |
meta data corresponds to expression set |
riskscore |
a numeric vector of riskscore |
cut.point |
logical , use cut_point or not, if FALSE,use median by defult |
color |
color for boxplot |
n_cutoff |
3 by defalut , scale before plot and set a cutoff,usually 2 or 1.6 |
risk plot
Xiaojie Sun
exp_boxplot
;box_surv
;draw_venn
risk_plot(exprSet_hub1,meta1,riskscore = rnorm(nrow(meta1)))
risk_plot(exprSet_hub1,meta1,riskscore = rnorm(nrow(meta1)))
drop duplicated samples from the same patients
sam_filter(exp)
sam_filter(exp)
exp |
TCGA or TCGA_Gtex expression set from gdc or xena |
a transformed expression set without duplicated samples
Xiaojie Sun
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)))
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)))
calculate cox p values and HR for genes
surv_cox( exprSet_hub, meta, cut.point = FALSE, pvalue_cutoff = 0.05, HRkeep = "all", continuous = FALSE, min_gn = 0.1 )
surv_cox( exprSet_hub, meta, cut.point = FALSE, pvalue_cutoff = 0.05, HRkeep = "all", continuous = FALSE, min_gn = 0.1 )
exprSet_hub |
a tumor expression set for hubgenes |
meta |
meta data corresponds to expression set |
cut.point |
logical , use cut_point or not, if FALSE,use median by defult |
pvalue_cutoff |
p value cut off ,0.05 by defult |
HRkeep |
one of "all","protect"or"risk" |
continuous |
logical, gene expression or gene expression group |
min_gn |
Depending on the expression of a gene, there may be a large difference in the number of samples between the two groups, and if a smaller group of samples is less than 10 percent (default) of all, the gene will be discarded |
a matrix with gene names ,cox p value and HR
Xiaojie Sun
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)
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)
calculate log_rank test p values for genes
surv_KM( exprSet_hub, meta, cut.point = FALSE, pvalue_cutoff = 0.05, min_gn = 0.1 )
surv_KM( exprSet_hub, meta, cut.point = FALSE, pvalue_cutoff = 0.05, min_gn = 0.1 )
exprSet_hub |
a tumor expression set for hubgenes |
meta |
meta data corresponds to expression set |
cut.point |
logical , use cut_point or not, if FALSE,use median by defult |
pvalue_cutoff |
p value cut off ,0.05 by defult |
min_gn |
Depending on the expression of a gene, there may be a large difference in the number of samples between the two groups, and if a smaller group of samples is less than 10 percent (default) of all, the gene will be discarded |
a vector with gene names and log_rank p value
Xiaojie Sun
surv_KM(exprSet_hub1,meta1) surv_KM(exprSet_hub1,meta1,pvalue_cutoff = 1) surv_KM(exprSet_hub1,meta1,cut.point = TRUE)
surv_KM(exprSet_hub1,meta1) surv_KM(exprSet_hub1,meta1,pvalue_cutoff = 1) surv_KM(exprSet_hub1,meta1,cut.point = TRUE)
choose differential expressed genes by simple t.test
t_choose( genes, exp, group_list, up_only = FALSE, down_only = FALSE, pvalue_cutoff = 0.05 )
t_choose( genes, exp, group_list, up_only = FALSE, down_only = FALSE, pvalue_cutoff = 0.05 )
genes |
a vector with some genes |
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
up_only |
keep up genes in the result only |
down_only |
keep down genes in the result only |
pvalue_cutoff |
p value cut off ,0.05 by defult |
a vector with differential expressed genes
Xiaojie Sun
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)
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)
transform rownames for microarray or rnaseq expression matrix
trans_array(exp, ids, from = "probe_id", to = "symbol")
trans_array(exp, ids, from = "probe_id", to = "symbol")
exp |
microarray expression matrix with probe_id as rownames |
ids |
data.frame with original rownames and new rownames |
from |
colname for original rownames |
to |
colname for new rownames |
a transformed expression set with new rownames
Xiaojie Sun
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)
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)
transform rownames of expression set from "entrez" to"symbol",according to the bitr function.
trans_entrezexp(entrezexp, species = "human")
trans_entrezexp(entrezexp, species = "human")
entrezexp |
expression set with entrezid as rownames |
species |
choose human or mouse, or rat, default: human |
a transformed expression set with symbol
Xiaojie Sun
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) }
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) }
transform rownames of TCGA or TCGA_Gtex expression set from gdc or xena,from ensembl id to gene symbol
trans_exp(exp, mrna_only = FALSE, lncrna_only = FALSE, gtex = FALSE)
trans_exp(exp, mrna_only = FALSE, lncrna_only = FALSE, gtex = FALSE)
exp |
TCGA or TCGA_Gtex expression set from gdc or xena |
mrna_only |
only keep mrna rows in result |
lncrna_only |
only keep lncrna rows in result |
gtex |
logical,whether including Gtex data |
a transformed expression set with symbol
Xiaojie Sun
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)) k = trans_exp(exp)
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)) k = trans_exp(exp)
transform rownames of expression set from "ensembl" to"symbol",according to the new information from ensembl database.
trans_exp_new(exp, mrna_only = FALSE, lncrna_only = FALSE, species = "human")
trans_exp_new(exp, mrna_only = FALSE, lncrna_only = FALSE, species = "human")
exp |
expression set with ensembl as rownames |
mrna_only |
only keep mrna rows in result |
lncrna_only |
only keep lncrna rows in result |
species |
choose human or mouse, or rat, default: human |
a transformed expression set with symbol
Xiaojie Sun
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')") }
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')") }
calculate union set for two or more elements
union_all(...)
union_all(...)
... |
some vectors or a list with some vectors |
vector
Xiaojie Sun
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)
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)