用perl查找DNA序列中的核苷酸 [英] Find nucleotides in DNA sequence with perl
问题描述
输入序列DNA: ACTAAAAATACAAAAATTAGCCAGGCGTGGTGGCAC(序列的长度为33) 输入位置:(12)
我希望结果是第12个核苷酸为AAA的位置.
我毫不费力地找到该职位的氨基酸.下面是我目前的代码.
print "ENTER THE FILENAME OF THE DNA SEQUENCE:= ";
$DNAfilename = <STDIN>;
chomp $DNAfilename;
unless ( open(DNAFILE, $DNAfilename) ) {
print "Cannot open file \"$DNAfilename\"\n\n";
}
@DNA = <DNAFILE>;
close DNAFILE;
$DNA = join( '', @DNA);
print " \nThe original DNA file is:\n$DNA \n";
$DNA =~ s/\s//g;
print" enter the number ";
$po=<STDIN>;
@pos=$DNA;
if ($po>length($DNA))
{
print" no data";
}
else
{
print " @pos\n\n";
}
请告知我如何找到DNA序列上的位置.
my $nucleotide = substr $DNA, $po, 3;
这将从位置$po
的3个核苷酸直到$po+2
,并将其分配给$nucleotide
.
I have the sequence DNA and I want to find nucleotide of the sequence at the position which was chosed by people. Below is the example:
Enter the sequence DNA: ACTAAAAATACAAAAATTAGCCAGGCGTGGTGGCAC (the length of sequence is 33) Enter the position: (12)
I hope the result is the position number 12 the nucleotides are AAA.
I have no problem finding the amino acid of the position. Below is the current code I have.
print "ENTER THE FILENAME OF THE DNA SEQUENCE:= ";
$DNAfilename = <STDIN>;
chomp $DNAfilename;
unless ( open(DNAFILE, $DNAfilename) ) {
print "Cannot open file \"$DNAfilename\"\n\n";
}
@DNA = <DNAFILE>;
close DNAFILE;
$DNA = join( '', @DNA);
print " \nThe original DNA file is:\n$DNA \n";
$DNA =~ s/\s//g;
print" enter the number ";
$po=<STDIN>;
@pos=$DNA;
if ($po>length($DNA))
{
print" no data";
}
else
{
print " @pos\n\n";
}
Please advice how can I find the position at the DNA sequence.
my $nucleotide = substr $DNA, $po, 3;
This will take the 3 nucleotides from positions $po
upto $po+2
and assign it to $nucleotide
.
这篇关于用perl查找DNA序列中的核苷酸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!