您好,登錄后才能下訂單哦!
本篇內容主要講解“perl怎么畫韋恩圖”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“perl怎么畫韋恩圖”吧!
用法如下:
perl venn_up_or_down.pl -in All_DEG_venn.xls -id1 left_DEG.final.xls -id2 right_DEG.final.xls -k trans_full_table.xls -od out
該腳本的輸入文件都為轉錄組分析結果文件,All_DEG_venn.xls是畫韋恩圖時生成的,*_DEG.final.xls分別是兩個差異組合的。trans_full_table.xls是總的所有基因統計文件。
Usage Forced parameter: -in All_DEG_venn.xls <infile> must be given -od outdir <dir> must be given -id1 left DEG.final.xls <infile> must be given -id2 right DEG.final.xls <infile> must be given -k noRef_trans_full_table.xls (kegg anno) <infile> must be given Other parameter: -h Help document
腳本代碼:
#!/usr/bin/perl -w use strict; use warnings; use Getopt::Long; use Data::Dumper; use Config::General; use Cwd qw(abs_path getcwd); use FindBin qw($Bin $Script); use File::Basename qw(basename dirname); use Math::BigFloat; use Bio::SeqIO; use Bio::Seq; my $version = "1.3"; ## prepare parameters ####################################################################### ## ------------------------------------------------------------------------------------------- ## GetOptions my %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 <<"Usage End."; Description: $version:lefse analysis Usage Forced parameter: -inAll_DEG_venn.xls<infile> must be given -od outdir <dir> must be given -id1 left DEG.final.xls <infile> must be given -id2 right DEG.final.xls <infile> must be given -k noRef_trans_full_table.xls (kegg anno) Other parameter: -h Help document Usage End. exit; } open(IN,"$opts{in}")||die "open file $opts{in} failed.\n"; my %left; my %right; my %center; while(<IN>){ next if(/^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 "open file $opts{k} failed.\n"; open(ID1,"$opts{id1}")||die "open file $opts{id1} failed.\n"; open(ID2,"$opts{id2}")||die "open file $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>){ next if(/^#/); chomp; my @line = split("\t"); $deg1{$line[0]} = $_; } close(ID1); my %deg2; while(<ID2>){ next if(/^#/); chomp; my @line = split("\t"); $deg2{$line[0]} = $_; } close(ID2); open(UP,">$opts{od}/left_up.txt")||die "open file $opts{od}/left_up.txt failed.\n"; open(DOWN,">$opts{od}/left_down.txt")||die "open file $opts{od}/left_down.txt failed.\n"; while((my $key,my $value) = each %left){ my @line = split("\t",$deg1{$key}); if($line[7] eq "up"){ print UP "$deg1{$key}\t$kegg{$key}\n"; } if($line[7] eq "down"){ print DOWN "$deg1{$key}\t$kegg{$key}\n"; } } close(UP); close(DOWN); open(UP,">$opts{od}/right_up.txt")||die "open file $opts{od}/right_up.txt failed.\n"; open(DOWN,">$opts{od}/right_down.txt")||die "open file $opts{od}/right_down.txt failed.\n"; while((my $key,my $value) = each %right){ my @line = split("\t",$deg2{$key}); if($line[7] eq "up"){ print UP "$deg2{$key}\t$kegg{$key}\n"; } if($line[7] eq "down"){ print DOWN "$deg2{$key}\t$kegg{$key}\n"; } } close(UP); close(DOWN); open(UP,">$opts{od}/center_up.txt")||die "open file $opts{od}/center_up.txt failed.\n"; open(DOWN,">$opts{od}/center_down.txt")||die "open file $opts{od}/center_down.txt failed.\n"; open(DIFF,">$opts{od}/center_diff.txt")||die "open file $opts{od}/center_diff.txt failed.\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"){ print UP "$deg1{$key}\t$deg2{$key}\t$kegg{$key}\n"; }elsif($line1[7] eq "down" && $line2[7] eq "down"){ print DOWN "$deg1{$key}\t$deg2{$key}\t$kegg{$key}\n"; }else{ print DIFF "$deg1{$key}\t$deg2{$key}\t$kegg{$key}\n"; } } close(UP); close(DOWN); close(DIFF);
到此,相信大家對“perl怎么畫韋恩圖”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。