生信人

找回密码
立即注册
搜索
热搜: 活动 交友 discuz
发新帖

0

收听

12

听众

279

主题
发表于 2022-9-14 09:53:10 | 查看: 1034| 回复: 0
一、散点图
  1. m <- read.table("prok_representative.csv",sep = ",",header = T);  
  2. x <- m[,2]
  3. y <- m[,4]  
  4. plot(x,y,pch=16,xlab="Genome Size",ylab="Genes");  
  5. fit <- lm(y~x);  
  6. abline( fit,col="blue",lwd=1.8 );  
  7. rr <- round( summary(fit)$adj.r.squared,2);  
  8. intercept <- round( summary(fit)$coefficients[1],2);  
  9. slope <- round( summary(fit)$coefficients[2],2);  
  10. eq <- bquote( atop( "y = " * .(slope) * " x + " * .(intercept), R^2 == .(rr) ) );  
  11. text(12,6e3,eq);
复制代码

基因组大小与基因数目相关性散点图

二、基因长度分布直方图
  1. #基因长度分布图
  2. x <- read.table("H37Rv.gff",sep = "\t",header = F,skip = 7,quote = "")  
  3. x <- x[x$V3=="gene",]  
  4. # x <- x %>% dplyr::filter(V3 == 'gene')
  5. x <- abs(x$V5-x$V4)+1  
  6. # x <- x %>% dplyr::mutate(gene_len=abs(V5-V4)+1)
  7. # head(x$gene_len)
  8. length(x)  
  9. range(x)  
  10. hist(x)  
  11. hist(x,breaks = 80)  
  12. ?hist
  13. hist(x,breaks = 'Sturges')
  14. hist(x,breaks = c(0,500,1000,1500,2000,2500,15000))  
  15. hist(x,breaks = 80,freq = F)  
  16. hist(x,breaks = 80,density = T)  
  17. hist(rivers,density = T,breaks = 10)  
  18. ?hist  
  19. pdf(file = 'hist.pdf')
  20. h <- hist(x,nclass=80,col="pink",xlab="Gene Length (bp)",main="Histogram of Gene Length");  
  21. rug(x);
  22. xfit<-seq(min(x),max(x),length=100);
  23. yfit<-dnorm(xfit,mean=mean(x),sd=sd(x));
  24. yfit <- yfit*diff(h$mids[1:2])*length(x);
  25. lines(xfit, yfit, col="blue", lwd=2);
  26. dev.off()
复制代码

基因长度分布直方图

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

您需要登录后才可以回帖 登录 | 立即注册

QQ|Archiver|手机版|小黑屋|生信人

GMT+8, 2024-5-7 10:49 , Processed in 0.037683 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表