不明白你要干啥,你是有一些基因ID,想把对应的基因序列提取出来到一个新文件,还是只是把fasta序列中的ID提取出来?问问题要明确,不要让人歧义:
perl遍历hash:
while(($key, $value) = each(%HASH)) {
# do something with $key and $value
}
#-----------------------------
foreach $key (keys %HASH) {
$value = $HASH{$key};
# do something with $key and $value
}
#-----------------------------
# %food_color per the introduction
while(($food, $color) = each(%food_color)) {
print "$food is $color.\n";
}
# Banana is yellow.
#
# Apple is red.
#
# Carrot is orange.
#
# Lemon is yellow.
foreach $food (keys %food_color) {
my $color = $food_color{$food};
print "$food is $color.\n";
}
处理fasta序列可以使用bioperl:
文章链接:https://www.omicsclass.com/article/179