用perl查找DNA序列中的核苷酸 [英] Find nucleotides in DNA sequence with perl

查看:129
本文介绍了用perl查找DNA序列中的核苷酸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有DNA序列,我想在人们选择的位置找到该序列的核苷酸.下面是示例:

输入序列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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆