heatmap R

 

> library(gplots)

Attaching package: ‘gplots’

The following object is masked from ‘package:stats’:

lowess

> > setwd(“/home/zyshen/work/QM_nanjing”) > data2<-read.csv(“combined_example.level_5.csv”, header=T, sep=”,”) > data2plot<-data.matrix(data2[2:3]) > row.names(data2plot)<-data2[,1] > heatmap.2(data2plot,trace=”none”,cexCol = 2,col=greenred(50), margins = c(5, 40), sepwidth=c(0.05,0.05))

 

 

 

if (!require(“gplots”)) { install.packages(“gplots”, dependencies = TRUE) library(gplots) } if (!require(“RColorBrewer”)) { install.packages(“RColorBrewer”, dependencies = TRUE) library(RColorBrewer) } […]

Correlation tests, correlation matrix, and corresponding visualization methods in R (forward)

https://rstudio-pubs-static.s3.amazonaws.com/240657_5157ff98e8204c358b2118fa69162e18.html

Correlation tests, correlation matrix, and corresponding visualization methods in R Igor Hut 12 January, 2017 Install and load required R packages Methods for correlation analyses Compute correlation in R R functions Preliminary considerations Preleminary test to check the test assumptions Pearson correlation test Kendall rank correlation test Spearman rank correlation coefficient How to interpret […]

R drawing png with high resolution

可重复的示例:

the_plot <- function() { x <- seq(0, 1, length.out = 100) y <- pbeta(x, 1, 10) plot( x, y, xlab = “False Positive Rate”, ylab = “Average true positive rate”, type = “l” ) }

 

png( “test.png”, width = 3.25, height = 3.25, units = “in”, res = 1200, pointsize = 4 ) […]

fasta2nexus by R script

Workspace loaded from ~/.RData] > setwd(“/home/shenzy/work/beast/51samples”) > library(seqinr) > data=read.fasta(“51strain_core_gene_alignment.aln”) > library(ape) Attaching package: ‘ape’ The following objects are masked from ‘package:seqinr’: as.alignment, consensus > write.nexus.data(data,file=”51strain_core_gene_alignment.aln.nexus”, format=”DNA”) > […]

Remove grid and background from plot (ggplot2)

Remove grid and background from plot (ggplot2) HOMECATEGORIESTAGSMY TOOLSABOUTLEAVE MESSAGERSS 2013-11-27 | category RStudy | tag ggplot2 Generate data library(ggplot2) a <- seq(1, 20) b <- a^0.25 df <- as.data.frame(cbind(a, b)) basic plot myplot = ggplot(df, aes(x = a, y = b)) + geom_point() myplot

theme_bw() will get rid of the background myplot […]

Size Matters: Metabolic Rate and Longevity (Regression analysis sample)

Size Matters: Metabolic Rate and Longevity

John Tukey once said, “The best thing about being a statistician is that you get to play in everyone’s backyard.” I enthusiastically agree!

I frequently enjoy reading and watching science-related material. This invariably raises questions, involving other “backyards,” that I can better understand using statistics. For instance, see my […]

数据分析之美:如何进行回归分析

1. 确定自变量与Y是否相关 证明:自变量X1,X2,….XP中至少存在一个自变量与因变量Y相关 For any given value of n(观测数据的数目) and p(自变量X的数目), any statistical software package can be used to compute the p-value associated with the F-statistic using this distribution. Based on this p-value, we can determine whether or not to reject H0. (用软件计算出的与F-statistic 相关的p-value来验证假设,the p-value associated with the F-statistic) 例子: Is there a relationship between […]

MSstats: an R package for statistical analysis of quantitative mass spectrometry-based proteomic experiments

MSstats: an R package for statistical analysis of quantitative mass spectrometry-based proteomic experiments.

R PheWAS: data analysis and plotting tools for phenome-wide association studies in the R environment

R PheWAS: data analysis and plotting tools for phenome-wide association studies in the R environment.

R pheatmap

> library(caTools); > library(bitops); > library(grid); > data=read.csv(“/home/shenzy/Desktop/R/Bac.heatmap1.csv”) > data=read.csv(“/home/shenzy/Desktop/R/Bac.heatmap1.2.csv”) > View(data) > data=read.csv(“/home/shenzy/Desktop/R/Bac.heatmap1.2.csv”,sep=”\t”) > View(data) > row.names(data) <- data$X.OTU.ID; > View(data) > data_matrix<-data[,2:15] > View(data_matrix) > data_matrix<-data[,2:14] > View(data_matrix) > View(data) > data_matrix<-data[,1:14] > View(data_matrix) > library(pheatmap) > data_matrix[is.na(data_matrix)]<-1 > View(data_matrix) > data_log10<-log10(data_matrix) > View(data_log10) > data_log2<-log2(data_matrix) > View(data_log2) > pheatmap(data_log2,fontsize=9, fontsize_row=6) > pheatmap(data_log2, […]