perl怎么画韦恩图

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怎么画韦恩图”有了更深的了解,不妨来实际操作一番吧!这里是恰卡编程网网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

发布于 2022-03-18 22:46:45
收藏
分享
海报
0 条评论
31
上一篇:Rocks集群系统如何安装与维护 下一篇:R语言怎么设置颜色
目录

    0 条评论

    本站已关闭游客评论,请登录或者注册后再评论吧~

    忘记密码?

    图形验证码