perl怎么画韦恩图
perl怎么画韦恩图
本篇内容主要讲解“perl怎么画韦恩图”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“perl怎么画韦恩图”吧!
用法如下:
perlvenn_up_or_down.pl-inAll_DEG_venn.xls-id1left_DEG.final.xls-id2right_DEG.final.xls-ktrans_full_table.xls-odout
该脚本的输入文件都为转录组分析结果文件,All_DEG_venn.xls是画韦恩图时生成的,*_DEG.final.xls分别是两个差异组合的。trans_full_table.xls是总的所有基因统计文件。
UsageForcedparameter:-inAll_DEG_venn.xls<infile>mustbegiven-odoutdir<dir>mustbegiven-id1leftDEG.final.xls<infile>mustbegiven-id2rightDEG.final.xls<infile>mustbegiven-knoRef_trans_full_table.xls(kegganno)<infile>mustbegivenOtherparameter:-hHelpdocument
脚本代码:
#!/usr/bin/perl-wusestrict;usewarnings;useGetopt::Long;useData::Dumper;useConfig::General;useCwdqw(abs_pathgetcwd);useFindBinqw($Bin$Script);useFile::Basenameqw(basenamedirname);useMath::BigFloat;useBio::SeqIO;useBio::Seq;my$version="1.3";##prepareparameters#########################################################################-------------------------------------------------------------------------------------------##GetOptionsmy%opts;GetOptions(\%opts,"in=s","id1=s","id2=s","k=s","od=s","h");if(!defined($opts{in})||!defined($opts{id1})||!defined($opts{k})||!defined($opts{id2})||!defined($opts{od})||defined($opts{h})){print<<"UsageEnd.";Description:$version:lefseanalysisUsageForcedparameter:-inAll_DEG_venn.xls<infile>mustbegiven-odoutdir<dir>mustbegiven-id1leftDEG.final.xls<infile>mustbegiven-id2rightDEG.final.xls<infile>mustbegiven-knoRef_trans_full_table.xls(kegganno)Otherparameter:-hHelpdocumentUsageEnd.exit;}open(IN,"$opts{in}")||die"openfile$opts{in}failed.\n";my%left;my%right;my%center;while(<IN>){nextif(/^all_id/);chomp;my@line=split("\t",$_);if($line[1]ne"-"&&$line[2]eq"-"){$left{$line[0]}=$line[0];}if($line[1]eq"-"&&$line[2]ne"-"){$right{$line[0]}=$line[0];}if($line[1]ne"-"&&$line[2]ne"-"){$center{$line[0]}=$line[0];}}close(IN);open(IN,"$opts{k}")||die"openfile$opts{k}failed.\n";open(ID1,"$opts{id1}")||die"openfile$opts{id1}failed.\n";open(ID2,"$opts{id2}")||die"openfile$opts{id2}failed.\n";my%kegg;while(<IN>){chomp;my@line=split("\t");if(/^#/){print"$line[23]\n\n";}$kegg{$line[0]}=$line[23];}close(IN);my%deg1;while(<ID1>){nextif(/^#/);chomp;my@line=split("\t");$deg1{$line[0]}=$_;}close(ID1);my%deg2;while(<ID2>){nextif(/^#/);chomp;my@line=split("\t");$deg2{$line[0]}=$_;}close(ID2);open(UP,">$opts{od}/left_up.txt")||die"openfile$opts{od}/left_up.txtfailed.\n";open(DOWN,">$opts{od}/left_down.txt")||die"openfile$opts{od}/left_down.txtfailed.\n";while((my$key,my$value)=each%left){my@line=split("\t",$deg1{$key});if($line[7]eq"up"){printUP"$deg1{$key}\t$kegg{$key}\n";}if($line[7]eq"down"){printDOWN"$deg1{$key}\t$kegg{$key}\n";}}close(UP);close(DOWN);open(UP,">$opts{od}/right_up.txt")||die"openfile$opts{od}/right_up.txtfailed.\n";open(DOWN,">$opts{od}/right_down.txt")||die"openfile$opts{od}/right_down.txtfailed.\n";while((my$key,my$value)=each%right){my@line=split("\t",$deg2{$key});if($line[7]eq"up"){printUP"$deg2{$key}\t$kegg{$key}\n";}if($line[7]eq"down"){printDOWN"$deg2{$key}\t$kegg{$key}\n";}}close(UP);close(DOWN);open(UP,">$opts{od}/center_up.txt")||die"openfile$opts{od}/center_up.txtfailed.\n";open(DOWN,">$opts{od}/center_down.txt")||die"openfile$opts{od}/center_down.txtfailed.\n";open(DIFF,">$opts{od}/center_diff.txt")||die"openfile$opts{od}/center_diff.txtfailed.\n";while((my$key,my$value)=each%center){my@line1=split("\t",$deg1{$key});my@line2=split("\t",$deg2{$key});if($line1[7]eq"up"&&$line2[7]eq"up"){printUP"$deg1{$key}\t$deg2{$key}\t$kegg{$key}\n";}elsif($line1[7]eq"down"&&$line2[7]eq"down"){printDOWN"$deg1{$key}\t$deg2{$key}\t$kegg{$key}\n";}else{printDIFF"$deg1{$key}\t$deg2{$key}\t$kegg{$key}\n";}}close(UP);close(DOWN);close(DIFF);
到此,相信大家对“perl怎么画韦恩图”有了更深的了解,不妨来实际操作一番吧!这里是恰卡编程网网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
推荐阅读
-
牵引力教育 你的PHP真的学好了?
PHP:HypertextPreprocessorPHP是一种HTML内嵌式的语言(类似IIS上的ASP...
-
PHP代码优化技巧总结
-
关于php免费学的几个网站?从初级到高级使用的资料
php的一个定义PHP又名超文本预处理器,是一种通用开源脚本语言。PHP主要适用于Web开发领域,语法吸收了C语言、Ja...
-
PHP到底能做什么,我大学里怎么没有PHP这科
-
perl如何提取GFF中所有转录本的位置信息
perl如何提取GFF中所有转录本的位置信息本篇内容主要讲解“pe...
-
perl怎么从gff文件中提取对应转录本ID的基因结构信息
perl怎么从gff文件中提取对应转录本ID的基因结构信息本篇内容...
-
perl如何分离NR NT库
perl如何分离NRNT库这篇文章主要为大家展示了“perl如何...
-
perl怎么对组装结果中GAP左右批量设计引物
perl怎么对组装结果中GAP左右批量设计引物本文小编为大家详细介...
-
perl对应的gff文件格式是什么
perl对应的gff文件格式是什么本文小编为大家详细介绍“perl...
-
perl怎么提取基因组所有基因的启动子序列
perl怎么提取基因组所有基因的启动子序列这篇“perl怎么提取基...