加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl应用:从NCBI提供的信息中获取需要的序列(下)use Scalar

发布时间:2020-12-15 21:02:36 所属栏目:大数据 来源:网络整理
导读:use strict;use warnings;my $annotation =' ';my $dna =' ';my $record =' ';my $save_input_separator =$/;open (DNAFILENAME,'f:perlstrawberry.gb')||die("can not open the file!");$/ = "//n";$record = DNAFILENAME;($annotation,$dna) = ($reco



use strict;
use warnings;

my $annotation =' ';
my $dna =' ';
my $record =' ';
my $save_input_separator =$/;

open (DNAFILENAME,'f:perlstrawberry.gb')||die("can not open the file!");
$/ = "//n";
$record = <DNAFILENAME>;
($annotation,$dna) = ($record=~/^(LOCUS.*ORIGINs*n) (.*)//n/s);
print "$annotation nnn$dnan";

这里面关键就是用到了模式匹配:

($annotation,$dna) = ($record=~/^(LOCUS.*ORIGINs*n) (.*)//n/s);

这一行表示,如果在$record中可以匹配到(Locus.*ORIGINs*n) ? 和(.*) ? 那么就将第一个括号中的数值赋给$annotation,把第二个括号中匹配的内容赋给$dna.

另外一个就是$/这个变量的用法。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读