如何利用perl快速筛选差异基因?
我们只要将我们的input.txt文件和perl脚本放到同一个文件下,然后双击相应的脚本就可以得到我们的结果文件。
下面我们就将代码放在这里:
筛选上调差异基因的代码:
#!/usr/bin/perl -w
open IN,"<input.txt";
open OUT,">up.txt";
while (<IN>) {
chomp;
my @gene=split /\s+/,$_;
if ($gene[1] <=0.05 && $gene[3] >=2) {
print OUT "$_\n";
}
else {
next;
}
}
close IN;
close OUT;
筛选下调差异基因的代码:
#!/usr/bin/perl -w
open IN,"<input.txt";
open OUT,">up.txt";
while (<IN>) {
chomp;
my @gene=split /\s+/,$_;
if ($gene[1] <=0.05 && $gene[3] <=-2) {
print OUT "$_\n";
}
else {
next;
}
}
close IN;
close OUT;
赞 (0)