knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(YSX) library(pheatmap) library(RColorBrewer) library(grid) sp_pheatmap("exprTable.txt", xtics_angle = 45, cluster_rows = T, cluster_cols = T) sp_pheatmap("exprTable.txt", xtics_angle = 45, cluster_rows = T, cluster_cols = T, saveppt = TRUE, filename = "pheatmap.pdf")
library(vegan) sp_pheatmap("exprTable.txt", xtics_angle = 45, cluster_rows = T, cluster_cols = T, clustering_distance_cols = "binomial") sp_pheatmap("exprTable.txt", xtics_angle = 45, cluster_rows = T, cluster_cols = T, clustering_distance_cols = "spearman")
exprTable <- read.table("exprTable.txt", sep="\t", row.names=1, header=T) exprTable sp_pheatmap(exprTable, manual_color_vector="Set2")
sp_pheatmap(exprTable, manual_color_vector=c("green","red"), scale="row")
sp_pheatmap(exprTable, cluster_rows = T, logv="log2", manual_color_vector="YlOrRd", clustering_distance_rows = "binary")
exprTable <- read.table("exprTable.txt", sep="\t", row.names=1, header=T) # Row annotation # Can be a dataframe or a file annotation_row = data.frame(Type=c("TF","TF","TF","TF","Enzyme","Enzyme"), row.names=rownames(exprTable)) # sp_writeTable(annotation_row, "exprTable.annorow.txt") annotation_col = data.frame(Count=c(1,2,4,8,16,32), row.names=colnames(exprTable)) # sp_writeTable(annotation_col, "exprTable.annocol.txt") sp_pheatmap(exprTable, xtics_angle = 90, cluster_rows = T, cluster_cols = T, annotation_row = annotation_row, annotation_col = annotation_col)
Reorder branches
exprTable <- read.table("exprTable.txt", sep="\t", row.names=1, header=T) # Row annotation # Can be a dataframe or a file annotation_row = data.frame(Type=c("TF","TF","TF","TF","Enzyme","Enzyme"), Weight=c(10,20,30,40,50,60), row.names=rownames(exprTable)) # sp_writeTable(annotation_row, "exprTable.annorow.txt") annotation_col = data.frame(Count=c(1,2,4,8,16,32), row.names=colnames(exprTable)) # sp_writeTable(annotation_col, "exprTable.annocol.txt") sp_pheatmap(exprTable, xtics_angle = 90, cluster_rows = T, cluster_cols = T, annotation_row = annotation_row, annotation_col = annotation_col, cluster_cols_variable = "Count", cluster_rows_variable = "Weight", remove_cluster_cols_variable_in_annocol = FALSE, remove_cluster_rows_variable_in_annorow = T)
annotation_colors <- list(Type=c(TF="red",Enzyme="green"), Count=c("grey","blue")) sp_pheatmap(exprTable, xtics_angle = 90, cluster_rows = T, cluster_cols = T, annotation_row = annotation_row, annotation_col = annotation_col, manual_annotation_colors_sidebar = annotation_colors)
pheatmap(exprTable, cluster_rows = T, cluster_cols = T, annotation_row = annotation_row, annotation_col = annotation_col, annotation_colors = annotation_colors, clustering_distance_rows = "correlation", clustering_distance_cols = "correlation")
sp_pheatmap(exprTable, breaks="quantile", breaks_mid = 20)
sp_pheatmap(exprTable, breaks=c(0,5,10,20,40), manual_color_vector = "YlGnBu")
library(YSX) library(plotrix) library(RColorBrewer) set_data = "Set.data" flower_plot(set_data, item_variable = "Gene", set_variable = "Sample",saveplot = "flower.pdf",saveppt = TRUE) flower_plot(set_data, group_color = c("Set2"), r = 1, item_variable = "Gene", set_variable = "Sample") flower_plot(set_data, label_total_num_items = T, a = 1, item_variable = "Gene", set_variable = "Sample") # flower_plot(set_data, saveplot="Set.data.flower.pdf")
library(YSX) library(ggplot2) library(ggrepel) set.seed(1) res_output <- data.frame(log2FoldChange=rnorm(3000), row.names=paste0("YSX",1:3000)) res_output$padj <- 20 ^ (-1*(res_output$log2FoldChange^2)) padj = 0.05 log2FC = 1 res_output$level <- ifelse(res_output$padj<=padj, ifelse(res_output$log2FoldChange>=log2FC, paste("groupA","UP"), ifelse(res_output$log2FoldChange<=(-1)*(log2FC), paste("groupB","UP"), "NoDiff")) , "NoDiff") # sp_writeTable(res_output, file="volcano.txt", keep_rownames = T) head(res_output) sp_volcano_plot(data=res_output, log2fc_var="log2FoldChange", fdr_var="padj", status_col_var = 'level', filename = "1.pdf" )
sp_volcano_plot(data=res_output, log2fc_var="log2FoldChange", fdr_var="padj", significance_threshold = c(0.05, 1), point_color_vector = c("red","blue","black"), max_allowed_log10p = 10 )
sp_volcano_plot(data=res_output, log2fc_var="log2FoldChange", fdr_var="padj", significance_threshold = c(0.05, 1), point_color_vector = c("red","blue","black"), coordinate_flip = TRUE )
# Generate one column containing genes to be labels with their symbol. # One can also create this column easily using Excel. label = c("Pou5f1","Gata2") names(label) = c("YSX14","YSX4") res_output$Symbol <- label[match(rownames(res_output), names(label))] head(res_output) sp_writeTable(res_output, file="volcano.txt", keep_rownames = T) sp_volcano_plot(data=res_output, log2fc_var="log2FoldChange", fdr_var="padj", status_col_var = 'level', point_label_var = "Symbol" )
library(YSX) library(VennDiagram) vennDiagram_data = "vennDiagram.data" sp_vennDiagram(data = vennDiagram_data, header=T)
sp_vennDiagram(data = vennDiagram_data, label1 = "Set1",label2 = "Set2", label3="Set3", manual_color_vector = "Dark2")
sp_vennDiagram( supplyNumbers = TRUE, numVector=c (120, 110, 50), labelVector=c('a','b'))
sp_vennDiagram(data = vennDiagram_data, label1 = "Set1",label2 = "Set2", manual_color_vector = c('red', 'green'))
sp_vennDiagram(data = vennDiagram_data, label1 = "Set1",label2 = "Set2", label3="Set3", label4="Set4")
library(YSX) library(VennDiagram) vennDiagram_data = "vennDiagram.data" sp_vennDiagram2(data = vennDiagram_data, header=T, item_variable = "Gene", set_variable = "Sample") sp_vennDiagram2(data = vennDiagram_data, header=T, item_variable = "Gene", set_variable = "Sample",saveppt = TRUE,filename = "venn2.pdf")
sp_vennDiagram2(data = vennDiagram_data, header=T, item_variable = "Gene", set_variable = "Sample", set_variable_order = c("Set1","Set2", "Set3"), manual_color_vector = "Dark2")
sp_vennDiagram( supplyNumbers = TRUE, numVector=c (120, 110, 50), labelVector=c('a','b'))
sp_vennDiagram2(data = vennDiagram_data, item_variable = "Gene", set_variable = "Sample", set_variable_order = c("Set1","Set2"), manual_color_vector = c('red', 'green'))
sp_vennDiagram2(data = vennDiagram_data, item_variable = "Gene", set_variable = "Sample", set_variable_order = c("Set1","Set2","Set3", "Set4"))
library(Vennerable) vennDiagram_data = "vennDiagram.data" sp_vennDiagram3(data=vennDiagram_data, header = TRUE, item_variable = "Gene", set_variable = "Sample", select_set_to_show = c("Set1","Set2","Set3"), doWeights = TRUE, type = "AWFE") sp_vennDiagram3(data=vennDiagram_data, header = TRUE, item_variable = "Gene", set_variable = "Sample", doWeights = TRUE, type = "squares") sp_vennDiagram3(data=vennDiagram_data, header = TRUE, item_variable = "Gene", set_variable = "Sample", doWeights = TRUE, type = "squares", saveplot = "venn.pdf", saveppt = TRUE)
library(UpSetR) library(reshape2) library(YSX) vennDiagram_data = "vennDiagram.data" sp_upsetview(vennDiagram_data, vennFormat = 2) sp_upsetview(vennDiagram_data, vennFormat = 2, saveppt = TRUE, saveplot = "upsetview.pdf")
sp_upsetview("upset.txt", vennFormat = 0, nintersects = 7,saveplot = "upset.pdf")
sp_upsetview("upset.wide.data", vennFormat = 0) sp_upsetview("upset.wide.data", vennFormat = 0,nintersects = 4) sp_upsetview("upset.wide.data", vennFormat = 0,order.by = "degree") sp_upsetview("upset.wide.data", vennFormat = 0,decreasing = FALSE) sp_upsetview("upset.wide.data", vennFormat = 0,scale.intersections = "log2") sp_upsetview("upset.wide.data", vennFormat = 0,queries_bar1 = c("Samp1","Samp3"),queries_bar1_color = "#FF0000") sp_upsetview("upset.wide.data", vennFormat = 0,scale.intersections = "log2",sets = c("Samp1","Samp2"))
sp_upsetview(vennDiagram_data, vennFormat = 2, width=10, height=4, saveplot = "upsetview2.pdf")
str(a)
library(YSX) library(ggplot2) library(dplyr) manhattan_data = "manhattan.data" sp_manhattan2_plot(data=manhattan_data, ID_var='ID', FDR_var='FDR', title="test1", point_size=2, point_label_var = "Labels")
library(YSX) library(ggplot2) library(reshape2) library(grid) set.seed(131) res_output <- data.frame(Pos=1:10,value =runif(20)) value=0.5 res_output$Group <- ifelse(res_output$value<=value,"groupA", "groupB") head(res_output) sp_lines(data=res_output, xvariable="Pos", melted=T, yvariable="value", legend_variable="Group",zoom_xlim = c(3,5),zoom_split =F) library(ggforce) sp_lines(data=res_output, xvariable="Pos", melted=T, yvariable="value", legend_variable="Group",zoom_xlim = c(3,5),zoom_split =F)
sp_lines(data=res_output, xvariable="Pos", melted=T, yvariable="value")
lines_data_melted = "line.data" sp_lines(data=lines_data_melted, xvariable = "Pos", yvariable = "value", legend_variable="Variable", melted = T)
sp_lines(data=lines_data_melted, xvariable = "Pos", yvariable = "value", legend_variable="Variable", melted = T, smooth_method = "auto", manual_color_vector = c("cyan","purple"), manual_xtics_pos = c(-5000,0,5000), manual_xtics_value = c("-5 kb","TSS","5 kb"), xintercept=c(-1000,1000), custom_vline_anno=c("-1 kb","1 kb"))
sp_lines(data="exprTable.txt", manual_color_vector = "Set2", alpha=1, line_size = 1)
exprTable <- read.table("exprTable.txt", row.names=1, header=T, sep="\t") exprTable <- as.data.frame(t(exprTable)) sp_lines(data=exprTable, manual_color_vector = "Set2", alpha=1, line_size = 1)
exprTable <- read.table("exprTable.txt", row.names=1, header=T, sep="\t") exprTable <- as.data.frame(t(exprTable)) sp_lines(data=exprTable, manual_color_vector = "Set2", alpha=1, line_size = 1, yaxis_scale_mode = "log2")
exprTable <- read.table("exprTable.txt", row.names=1, header=T, sep="\t") exprTable <- as.data.frame(t(exprTable)) sp_lines(data=exprTable, manual_color_vector = "Set2", alpha=1, line_size = 1, yaxis_scale_mode = "scale_y_log10()")
sp_lines(data=exprTable, manual_color_vector = "Set2", alpha=1, line_size = "value")
sp_lines(data=exprTable, manual_color_vector = "Set2", alpha=1, line_size = "value", coordinate_flip = T)
library(YSX) library(ggplot2) library(RColorBrewer) bar_test_data <- data.frame(ID = letters[1:4],Gene = letters[c(8,8,9,9,10,10,11,11)], Exper = runif(16)) sp_barplot(data = bar_test_data, xvariable = "ID", yvariable = "Exper", color_variable = "Gene") bar_data = "bar.data" sp_barplot(data = bar_data, xvariable = "ID", yvariable = "Exper", color_variable = "Gene",height=12.36,width=20,filename = "bar.pdf") library(eoffice) sp_barplot(data = bar_data, xvariable = "ID", yvariable = "Exper", color_variable = "Gene",height=12.36,width=20,filename = "bar.pdf",saveppt = T ) library(htmlwidgets) library(plotly) sp_barplot(data = bar_data, xvariable = "ID", yvariable = "Exper", color_variable = "Gene",height=12.36,width=20,filename = "bar.pdf",savehtml = T )
library(tidyr) library(dplyr) bar_data = "bar.txt" sp_barplot(data = bar_data, melted =TRUE,xvariable= "ID",color_variable = "Gene", yvariable = "Expression",add_bar_link = T) sp_barplot(data = bar_data, melted =TRUE,xvariable= "ID",color_variable = "Gene", yvariable = "Expression",add_bar_link = T, bar_mode = "fill") sp_barplot(data = bar_data, melted =TRUE,xvariable= "ID",color_variable = "Gene", yvariable = "Expression",add_bar_link = T, bar_mode = "stack",xvariable_order = c("2_cell","4_cell")) sp_barplot(data = bar_data, melted =TRUE,xvariable= "ID",color_variable = "Gene", yvariable = "Expression",add_bar_link = T, bar_mode = "stack",xvariable_order = c("2_cell","4_cell"),color_variable_order = c("Tet1","Tet3")) sp_barplot(data = bar_data, melted =TRUE,xvariable= "ID",color_variable = "Gene", yvariable = "Expression",add_bar_link = T, bar_mode = "fill",xvariable_order = c("2_cell","4_cell"),color_variable_order = c("Tet1","Tet3","Pou5f1","Sox2"))
box_demo1_data <- "exprTable.txt" sp_barplot(data = box_demo1_data, melted = F) sp_barplot(data = box_demo1_data, melted = F, ylim = c(0,20)) sp_barplot(data = box_demo1_data, melted = F, ylim = c(20,40))
library(dplyr) box_demo2_data <- "exprTable.txt" sp_barplot(data = box_demo2_data, melted = F, bar_mode="fill", add_text=T)
random_v <- c(rnorm(10, mean=1, sd=0.1), rnorm(10, mean=5), rnorm(20, mean=10), rnorm(20, mean=20), rnorm(20, mean=2, sd=0.2), rnorm(10, mean=20), rnorm(10, mean=1, sd=0.01), rnorm(20, mean=2), rnorm(20, mean=2), rnorm(20, mean=3)) data <- data.frame(Gene=c(paste0('SOX', rep(2,80)), paste0('SOX', rep(3,80))), Expr=random_v, Cluster=rep(c(rep("C1",10), rep("C2",10),rep("C3",20),rep("C4",20), rep("C5",20)),2)) data[data["Expr"]<0,"Expr"] = 0 sp_writeTable(data, file="boxplot_singlecell.txt", keep_rownames = F)
library(dplyr) library(YSX) library(ggplot2) library(RColorBrewer) library(ggbeeswarm) box_demo3_data <- "boxplot_singlecell.txt" sp_barplot(data = box_demo3_data, melted = T, xvariable="Gene", yvariable="Expr", color_variable = "Cluster", #bar_mode = "stack", add_point = F, group_variable = c("Gene","Cluster"), add_text = F)
library(dplyr) library(YSX) library(ggplot2) library(RColorBrewer) library(ggbeeswarm) box_demo4_data <- "barplot_demo4.txt" p <- sp_barplot(data = box_demo4_data, melted = T, xvariable="Gene", yvariable="Mean_value", color_variable = "Cluster", bar_mode = "stack", error_bar_variable = "Standard_deviation", add_text = F)
library(ggplot2) library(reshape2) library(scales) library(ggbeeswarm) library(multcompView) library(dplyr) box_data = "box.data" sp_boxplot(data = box_data, melted=T, xvariable = "Gene", yvariable = "Expr", legend_variable="Group", statistics = T, violin_nb = F, violin=T, jitter_bp = T)
sp_boxplot(data = box_data, melted=T, xvariable = "Gene", yvariable = "Expr", legend_variable="Group", manual_color_vector = "Set3", violin = T, coordinate_flip = T)
set.seed(3) box_test_data <- data.frame(Gene = 1:4, Expr = runif(16), Group=1:4) head(box_test_data) sp_boxplot(data = box_test_data, melted=T, xvariable = "Gene", yvariable = "Expr", manual_color_vector = c("green","yellow","red"), jitter_bp = T, statistics = T, violin = T)
random_v <- c(rnorm(10, mean=1, sd=0.1), rnorm(10, mean=5), rnorm(20, mean=10), rnorm(10, mean=10), rnorm(10, mean=0.2, sd=0.01), rnorm(20, mean=1), rnorm(20, mean=1), rnorm(20, mean=1), rnorm(20, mean=2,sd=0.5), rnorm(20, mean=2,sd=0.5)) data <- data.frame(Gene=c(paste0('SOX', rep(2,80)), paste0('SOX', rep(3,80))), Expr=random_v, Cluster=rep(c(rep(1,10), rep(2,10),rep(3,20),rep(4,20),rep(5,20)),2)) sp_boxplot(data, melted = T, xvariable = "Cluster", yvariable = "Expr", facet_variable="Gene", facet_ncol=1, facet_scales="free_y", facet_singlecell_style = T, violin = T)
Different types of color assignment
sp_boxplot(data = box_test_data, melted=T, xvariable = "Gene", yvariable = "Expr", legend_variable="Group", manual_color_vector = c("green","red"), violin_nb = T, statistics=T)
box_test_data2 <- box_test_data[box_test_data$Gene %in% c(1,2),] sp_boxplot(data = box_test_data2, melted=T, xvariable = "Gene", yvariable = "Expr", legend_variable="Group", manual_color_vector = c("green","red"), violin_nb = T, statistics=T)
exprTableWithReps = "exprTableWithReps.txt" metadata = "metadata.txt" sp_boxplot(data = exprTableWithReps, melted=F, metadata = metadata, legend_variable = "Group", statistics = T)
#test ylim sp_boxplot(data = exprTableWithReps, melted=F, metadata = metadata, legend_variable = "Class",ylim= c(0,8))
单细胞Marker基因小提琴图展示
data = "boxplot_singlecell.txt" sp_boxplot(data, melted = T, xvariable = "Cluster", yvariable = "Expr", facet_variable="Gene", facet_ncol=1, facet_scales="free_y", facet_singlecell_style = T, violin = T)
library(YSX) library(stringr) enrichment_data <- "enrichment.data" sp_enrichment(data = enrichment_data, xvariable = "SampleGroup", yvariable = "Description", color_variable = "Qvalue", log10_transform_variable="Qvalue", size_variable = "Count")
enrichment.data <- sp_readTable(enrichment_data) head(enrichment.data) sp_enrichment(data = enrichment.data, xvariable = "GeneRatio", yvariable = "Description", log10_transform_variable = "Qvalue", sqrt_transform_variable = "Count", shape_variable = "SampleGroup")
library(YSX) enrichment_data <- "goeast.enrich.txt" enrichment.data <- sp_readTable(enrichment_data) head(enrichment.data) flower_plot() p <- sp_enrichment(data = enrichment.data, xvariable = "log_odds_ratio", yvariable = "Term", color_variable = "p", log10_transform_variable="p", size_variable = "q", sqrt_transform_variable = "q", shape_variable = "Ontology")
library(YSX) library(ggplot2) library(reshape2) library(grid) library(dplyr) # demo1 sp_histogram(data = "histogram.demo1.txt", xvariable = "weight", melted=T, group_variable = "sex", plot_type = "both", yaxis_statistics = "density", fill_area = T, add_mean_value_vline = T)
Demo2
sp_histogram(data = "histogram.demo1.txt", xvariable = "weight", melted=T, group_variable = "sex", plot_type = "both", yaxis_statistics = "density", fill_area = T, add_mean_value_vline = T, facet_variable = "sex")
Demo3
histogram_demo3 = "exprMat.txt" sp_histogram(data = histogram_demo3,melted=F, plot_type = "line", yaxis_statistics = "density", add_mean_value_vline = F)
library(plyr) library(ggplot2) library(grid) library(data.table, quietly=T) library(ggfortify) library(ggrepel) pca_test_data <- matrix(runif(3000,0,100000),ncol=6) colnames(pca_test_data) <- c(paste("wt",1:3,sep = ""),paste("ko",1:3,sep = "")) rownames(pca_test_data) <- c(ID = paste0("ENSG",c(1:500))) pca_data <- as.data.frame(pca_test_data) sp_pca(data = pca_data, grp_file = NULL) data = "pca.data" group_data = "pca_group.data" sp_pca(data = data, grp_file = group_data, color="Conditions", size = "Diameters", shape = "Batch", label = TRUE) sp_pca(data = data, grp_file = group_data, color="Conditions", size = "Diameters", shape = "Batch", label = FALSE, dimensions = 3)
suppressMessages(library("optparse")) suppressMessages(library("reshape2")) suppressMessages(library("ggplot2")) suppressMessages(library("vegan")) suppressMessages(library("digest")) suppressMessages(library("ggrepel")) suppressMessages(library("ggpubr")) pcoa_data = "pcoa.data" group_pcoa_data = "group_pcoa.data" sp_pcoa(data=pcoa_data,grp_file = group_pcoa_data, color = "genotype")
library(plyr) library(ggplot2) library(grid) library(ggbeeswarm) library(ggrepel) library(YSX) scatter_test_data <- data.frame(Samp = letters[1:6], Color = sample(c("group1", "group2", "group3"),6,replace = TRUE), X_val = runif(6), Y_val = runif(6), Size = sample(4:20, size = 6), Shape = sample(c("cluster1","cluster2"),6,replace = TRUE)) sp_scatterplot(data=scatter_test_data,xvariable = "X_val",yvariable = "Y_val", color_variable = "Color", shape_variable= "Shape", size_variable = "Size",label_variable="Samp",Jitter = TRUE)
Demo 1
scatter_data = "scatter_demo1.txt" sp_scatterplot(data = scatter_data, xvariable = "Gene", yvariable = "Cluster", color_variable = "Expr", size_variable = "Percent", label_variable = "Expr", manual_color_vector = c("#95DF6D","#E78D6C"),height=12.36,width=20,filename="scatter.pdf")
Demo 2
scatter_data = "scatter_demo2.txt" sp_scatterplot(data=scatter_data, xvariable = "X_variable", yvariable = "Y_variable", color_variable = "Color", shape_variable= "Shape", size_variable = "Size",label_variable="Samp",Jitter = F)
sp_scatterplot(data="scatter3.txt", xvariable = "eruptions", yvariable = "waiting", smooth_method = "lm",line_size=1)
scatter_data = "scatter.txt" sp_scatterplot(data = scatter_data, xvariable = "X_val", yvariable = "Y_val", color_variable = "Color", shape_variable = "Shape", size_variable = "Size", label = "Samp", xvariable_order = c(1,3,2), yvariable_order = c(2,1,3), color_variable_order = c("grp2","grp1","grp3"), shape_variable_order = c("cluster2","cluster1"), label_font_size = 2) sp_scatterplot(data = scatter_data, xvariable = "X_val", yvariable = "Y_val", color_variable = "Color", shape_variable = "Shape", size_variable = "Size", label_variable = "Samp", Jitter = TRUE) sp_scatterplot(data = scatter_data, xvariable = "X_val", yvariable = "Y_val", color_variable = "Color", shape_variable = "Shape", size_variable = "Size",label_variable = "Samp", Jitter = TRUE, facet = "Color", scales = "free_y")
scatter_data = "box.data" sp_scatterplot(data = scatter_data, xvariable = "Gene", yvariable = "Group", color_variable = "Expr", size_variable = "Expr", label_variable = "Expr")
Simple Tree
library(ggtree) library(ggplot2) library(YSX) library(treeio) treefile <- "iqtree.treefile" sp_tree_plot(treefile,debug=T)
Color branches using node attributes.
tree_attrib <- "tree.attribute" tree_msa = "iqtree.aligned.fa" sp_tree_plot(treefile, tree_type = 'iqtree', tree_attrib = tree_attrib, tree_msa = NULL, color_branches = "Spe", layout = "fan", ladderize = F, branch.length = "none", tip_text = "Name", tip_text_size = 3, bootstrap = TRUE, bootstrap_variable = NULL, legend.position = "bottom", bootstrap_size = 3, bootstrap_color = 'red')
tree_msa = "iqtree.aligned.fa" sp_tree_plot(treefile, tree_type = 'iqtree', tree_attrib = tree_attrib, tree_msa = tree_msa, layout = "circular", ladderize = F, branch.length = "none", tip_text = 'label', tip_text_size = 3, bootstrap = TRUE, bootstrap_variable = NULL, legend.position = "bottom", bootstrap_size = 3, bootstrap_color = 'red')
Gene expression table 3 gene x 20 samples (each with 10 replicates)
expr_matrix <- as.data.frame(round(matrix(c(runif(10, min=1, max=5), runif(10, min=3, max=7), runif(10, min=5, max=9), runif(10, min=1, max=5), runif(10, min=3, max=7), runif(10, min=5, max=9)), nrow=3, byrow=T),2)) rownames(expr_matrix) <- paste0("Gene_", letters[1:3]) colnames(expr_matrix) <- paste(rep(c("SampleA","SampleB"), each=10),1:20,sep="_") sp_writeTable(expr_matrix, file="exprTableWithReps.txt")
Metadata table with 20 samples and two attributes
sampleGroup = data.frame(Sample=paste(rep(c("SampleA","SampleB"), each=10),1:20,sep="_"), Group=rep(c("GroupA","GroupB"), each=10), Class=rep(c("ConditionC","ConditionD"), each=5)) sp_writeTable(sampleGroup, file="metadata.txt", keep_rownames = F)
set.seed(1234) df2 <- data.frame( sex=factor(rep(c("F", "M"), each=200)), weight=round(c(rnorm(200, mean=55, sd=5), rnorm(200, mean=65, sd=5))) ) head(df2) sp_writeTable(df2,"histogram.demo1.txt", keep_rownames =F)
library(dplyr) library(YSX) library(grid) library(tidyverse) library(readr) library(tidyr) library(ggplot2) library(Hmisc) library(plyr) library(RColorBrewer) library(reshape2) data <- data.frame(Value = rnorm(300), Repeat = rep(paste("Repeat", 1:3, sep = "_"), 100), Condition = rep(c("Control", "Test"), 150)) sp_raincloud(data = data,xvariable = "Condition", yvariable = "Value")
data = "exprTable.txt" sp_raincloud(data= data, melted = FALSE,position_nudge_jitter_size = 0.1 )
library(WGCNA) x = runif(10) y = runif(10) data = cbind(x,y) rownames(data) = paste("Name",1:10,"") sp_hclust(data =data)
data="inflectionpoint.txt" sp_inflectionpoint(data=data,which_col = 2,keep_point = "little")
library(eulerr) library(YSX) data = "Set.data" sp_EulerDiagrams(data = data, format = "items", # items or counts item_variable = "Gene", set_variable = "Sample", shape="circle",manual_color_vector = c("red","green","blue","yellow","purple"))
library(eulerr) library(YSX) data = "Euler.txt" sp_EulerDiagrams(data = data , format = "counts", # items or counts type = "percent", intersection_variable = "Intersection", count_variable = "Count", manual_color_vector = c("red","green","blue","yellow","purple"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.