miRNA与靶基因相关性作图

miRNA与靶基因相关性作图

下图为miRNA与靶基因相关性图,这里简单介绍下如何作图。

attachments-2018-08-j50GrHcx5b63ddfb7c8df.jpg首先,要生成作图的输入文件,有脚本,用法如下:

perl  Correlation_analysis.pl  -mirna Donkey_E_vs_Donkey_T.DEG.final.xls  -DE_tar targets.final.xls  -list bta.mir2target.list  -out Correlation_analysis_input.txt
其中Donkey_E_vs_Donkey_T.DEG.final.xls是差异miRNA表达量文件;targets.final.xls是靶基因表达量文件;bta.mir2target.list 是miRNA与靶基因对应文件。
Donkey_E_vs_Donkey_T.DEG.final.xls与targets.final.xls格式相同,如下所示:
#ID     Donkey2_E_Count Donkey1_T_Count Donkey2_E_TPM   Donkey1_T_TPM   FDR     log2FC  regulated
bta-miR-106a    26      113     1.164865        54.990056       3.20268371822863e-08    4.02066488557677        up
bta-miR-10a     166025  1771    7438.335738     861.835296      0.000238871249442218    -4.55148673628311       down
bta-miR-135a    5631    114     252.2829        55.476693       0.00268305048158635     -3.62181067749427       down
bta-miR-135b    25      89      1.120063        43.310752       6.41785537824902e-07    3.73045876228641        up
bta-miR-141     1201    2       53.807807       0.973275        2.17196461482771e-07    -6.91926313309958       down
bta-miR-182     1882    33      84.318313       16.059043       0.00119553585103038     -3.81519649022355       down
bta-miR-183     1544    40      69.175066       19.465506       0.00778797871791981     -3.25606929861198       down
bta-miR-187     0       18      0       8.759478        6.10013036195234e-07    5.24714335099614        up
bta-miR-196a    2871    31      128.627989      15.085767       0.000103494675187443    -4.51281538763237       down
bta.mir2target.list格式如下:
bta-let-7a-3p   EAS0021476;EAS0000070;EAS0013638;EAS0001074;EAS0004577;EAS0006787;EAS0008899;EAS0013962;EAS0017655;EAS0005413;EAS0006009
bta-let-7a-5p   EAS0008419;EAS0003830;EAS0009803;EAS0011296;EAS0005793;EAS0004645;EAS0014772
bta-let-7b      EAS0017817;EAS0013474;EAS0008780;EAS0018405;EAS0017359;EAS0017674;EAS0020797;EAS0015379;EAS0011272;EAS0010435;EAS0013631
bta-let-7c      EAS0006104;EAS0004549;EAS0003321;EAS0010481;EAS0021491;EAS0015994;EAS0001788;EAS0002956;EAS0007473;EAS0008880;EAS0007345;EAS0003066
bta-let-7d      EAS0005004;EAS0009924;EAS0020635;EAS0002650;EAS0011574

最后生成的文件如下所示:

miRNA   Gene    log2Ratio_miR   log2Ratio_Gene
bta-let-7c      EAS0003321      -1.43072567351625       1.37874741391777
bta-let-7c      EAS0007345      -1.43072567351625       1.11756970634256
bta-let-7c      EAS0003066      -1.43072567351625       1.67994238012443
bta-let-7c      EAS0017368      -1.43072567351625       3.05079253633835
bta-let-7c      EAS0004422      -1.43072567351625       1.50329494091278
bta-let-7c      EAS0003988      -1.43072567351625       1.18612566219656
bta-let-7c      EAS0005608      -1.43072567351625       1.89027598062113
bta-let-7c      EAS0012078      -1.43072567351625       3.50870147552217
bta-let-7c      EAS0015105      -1.43072567351625       1.06781330535694
bta-let-7c      EAS0020084      -1.43072567351625       1.10413933910007

有了输入文件,然后就可以作图了,作图脚本比较简单,用法:

Rscript correlation_analysis.R -i Correlation_analysis_input.txt -n Correlation_analysis

脚本代码:

library(ggplot2)
library('getopt');
spec = matrix(c(
'help' , 'h', 0, "logical","for help",
'input' , 'i', 1, "character","input file ,required",
'name' , 'n', 1, "character","photo name"
), byrow=TRUE, ncol=5);
opt = getopt(spec);
print_usage <- function(spec=NULL){
cat(getopt(spec, usage=TRUE));
q(status=1);
}
if ( !is.null(opt$help) ) { print_usage(spec) }
if ( is.null(opt$input) ){ print_usage(spec) }
if ( is.null(opt$name) ){ opt$name = "Correlation analysis" }

point <- read.table(opt$input,sep="\t",header = TRUE,comment.char = "")

p <- ggplot(point, aes(x=log2Ratio_miR, y=log2Ratio_Gene)) + geom_point(size=0.01,colour="red")+
theme(
######取消默认的背景颜色方框等
panel.background = element_rect(fill = "transparent",colour = "black"), 
panel.grid.minor = element_blank(), 
panel.grid.major = element_blank(),
plot.background = element_rect(fill = "transparent",colour = "black"))
#输出文件名称
png_name=paste(opt$name, ".png", sep="")
pdf_name=paste(opt$name, ".pdf", sep="")
#输出pdf格式图片
pdf(pdf_name,width =3,height = 3)
print(p)
dev.off()
#输出png格式图片
png(png_name,width =2000,height =2000,res = 500,units = "px")
print(p)
dev.off()


  • 发表于 2018-08-03 13:02
  • 阅读 ( 8348 )
  • 分类:perl

0 条评论

请先 登录 后评论
安生水
安生水

347 篇文章

作家榜 »

  1. omicsgene 699 文章
  2. 安生水 347 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. xun 82 文章
  6. 红橙子 78 文章
  7. rzx 74 文章
  8. CORNERSTONE 72 文章