Perl 如何读取参考线(从RN、RT、RA、RC、RX、RP、RL开始)并打印所有

Perl 如何读取参考线(从RN、RT、RA、RC、RX、RP、RL开始)并打印所有,perl,bioinformatics,bioperl,Perl,Bioinformatics,Bioperl,各位好,, 关于Perl模块,我遇到了一个问题,因为我正在使用这个模块从一个平面文件中检索一些特定的行,该文件包含我在代码中提到的多组信息(这是Bio::Parse::SwissProt.pm的示例代码)。但问题是,每当我们使用这段代码时,Refs语句中都会出现问题。它在c:/wamp/bin/perl/site/lib/bio/parse/swissprot.pm第345行尝试修改只读值时出错。输入文件如下所示 输入文件(平面文件) 脚本C部分:/wamp/bin/perl/bin/perl.

各位好,, 关于Perl模块,我遇到了一个问题,因为我正在使用这个模块从一个平面文件中检索一些特定的行,该文件包含我在代码中提到的多组信息(这是Bio::Parse::SwissProt.pm的示例代码)。但问题是,每当我们使用这段代码时,Refs语句中都会出现问题。它在
c:/wamp/bin/perl/site/lib/bio/parse/swissprot.pm
第345行尝试修改只读值时出错。输入文件如下所示

输入文件(平面文件)

脚本C部分:/wamp/bin/perl/bin/perl.exe

输出应类似于

ID   P72354_STAAU            Unreviewed;       575 AA.
AC   P72354;
DT   01-FEB-1997, integrated into UniProtKB/TrEMBL.
DT   01-FEB-1997, sequence version 1.
DT   29-MAY-2013, entry version 79.
DE   SubName: Full=ATP-binding cassette transporter A;
GN   Name=abcA;
OS   Staphylococcus aureus.
OC   Bacteria; Firmicutes; Bacilli; Bacillales; Staphylococcus.
OX   NCBI_TaxID=1280;
RN   [1]
RP   NUCLEOTIDE SEQUENCE.
RC   STRAIN=NCTC 8325;
RX   PubMed=8878592;
RA   Henze U.U., Berger-Bachi B.;
RT   "Penicillin-binding protein 4 overproduction increases beta-lactam
RT   resistance in Staphylococcus aureus.";
RL   Antimicrob. Agents Chemother. 40:2121-2125(1996).
RN   [2]
RP   NUCLEOTIDE SEQUENCE.
RC   STRAIN=NCTC 8325;
RX   PubMed=9158759;
RA   Henze U.U., Roos M., Berger-Bachi B.;
RT   "Effects of penicillin-binding protein 4 overproduction in
RT   Staphylococcus aureus.";
RL   Microb. Drug Resist. 2:193-199(1996).
 CC   -!- SIMILARITY: Belongs to the ABC transporter superfamily.
CC   -----------------------------------------------------------------------
CC   Copyrighted by the UniProt Consortium, see http://www.uniprot.org/terms
CC   Distributed under the Creative Commons Attribution-NoDerivs License
CC   -----------------------------------------------------------------------
DR   EMBL; X91786; CAA62898.1; -; Genomic_DNA.
DR   ProteinModelPortal; P72354; -.
DR   SMR; P72354; 335-571.
DR   GO; GO:0016021; C:integral to membrane; IEA:InterPro.
DR   GO; GO:0005524; F:ATP binding; IEA:UniProtKB-KW.
DR   GO; GO:0042626; F:ATPase activity
DR   GO; GO:0006200; P:ATP catabolic process; IEA:GOC.
DR   InterPro; IPR003593; AAA+_ATPase.
DR   InterPro; IPR003439; ABC_transporter-like.
DR   InterPro; IPR017871; ABC_transporter_CS.
DR   InterPro; IPR017940; ABC_transporter_type1.
DR   InterPro; IPR001140; ABC_transptr_TM_dom.
DR   InterPro; IPR011527; ABC_transptrTM_dom_typ1.
DR   InterPro; IPR027417; P-loop_NTPase.
DR   Pfam; PF00664; ABC_membrane; 1.
DR   Pfam; PF00005; ABC_tran; 1.
DR   SMART; SM00382; AAA; 1.
DR   SUPFAM; SSF90123; ABC_TM_1; 1.
DR   SUPFAM; SSF52540; SSF52540; 1.
DR   PROSITE; PS50929; ABC_TM1F; 1.
DR   PROSITE; PS00211; ABC_TRANSPORTER_1; 1.
DR   PROSITE; PS50893; ABC_TRANSPORTER_2; 1.
PE   3: Inferred from homology;
KW   ATP-binding; Nucleotide-binding.
SQ   SEQUENCE   575 AA;  64028 MW;  F7E30A85971719B9 CRC64;
     MKRENPLFFL FKKLSWPVGL IVAAITISSL GSLSGLLVPL FTGRIVDKFS VSHINWNLIA
     LFGGIFVINA LLSGLGLYLL SKIGEKIIYA IRSVLWEHII QLKMPFFDKN ESGQLMSRLT
     DDTKVINEFI SQKLPNLLPS IVTLVGSLIM LFILDWKMTL LTFITIPIFV LIMIPLGRIM
     QKISTSTQSE IANFSGLLGR VLTEMRLVKI SNTERLELDN AHKNLNEIYK LGLKQAKIAA
     VVQPISGIVM LLTIAIILGF GALEIATGAI TAGTLIAMIF YVIQLSMPLI NLSTLVTDYK
     KAVGASSRIY EIMQEPIEPT EALEDSENVL IDDGVLSFEH VDFKYDVKKI LDDVSFQIPQ
     GQVSAFVGPS GSGKSTIFNL IERMYEIESG DIKYGLESVY DIPLSKWRRK IGYVMQSNSM
     MSGTIRDNIL YGINRHVSDE ELINYAKLAN CHDFIMQFDE GYDTLVGERG LKLSGGQRQR
     IDIARSFVKN PDILLLDEAT ANLDSESELK IQEALETLME GRTTIVIANR LSTIKKAGQI
     IFLDKGQVTG KGTHSELMAS HAKYKNFVVS QKLTD
//
[1]
  NUCLEOTIDE SEQUENCE.
  STRAIN=NCTC 8325;
  PubMed=8878592;
  Henze U.U., Berger-Bachi B.;
  "Penicillin-binding protein 4 overproduction increases beta-lactam
  resistance in Staphylococcus aureus.";
  Antimicrob. Agents Chemother. 40:2121-2125(1996).
[2]
  NUCLEOTIDE SEQUENCE.
  STRAIN=NCTC 8325;
  PubMed=9158759;
  Henze U.U., Roos M., Berger-Bachi B.;
  "Effects of penicillin-binding protein 4 overproduction in
  Staphylococcus aureus.";
  Microb. Drug Resist. 2:193-199(1996).
</code></pre>

在互联网上搜索之后,您似乎正在使用软件包中的
SWISS::Entry
,并且您(或某人)作为独立项目下载了
Bio::Parse::SwissProt
。我对这两个项目都不熟悉,但您只需从BioPerl使用
Bio::SeqIO
即可获得所需信息。以下是获取参考的示例:

#!usr/bin/env perl

use strict;
use warnings;
use Bio::SeqIO;

my $usage = "perl $0 swiss-file\n";
my $infile = shift or die $usage;

my $io = Bio::SeqIO->new(-file => $infile, -format => 'swiss');
my $seqio = $io->next_seq;
my $anno_collection = $seqio->annotation;

for my $key ( $anno_collection->get_all_annotation_keys ) {
    my @annotations = $anno_collection->get_Annotations($key);
    for my $value ( @annotations ) {
        if ($value->tagname eq "reference") {
            my $hash_ref = $value->hash_tree;
            for my $key (keys %{$hash_ref}) {
                print $key,": ",$hash_ref->{$key},"\n" if defined $hash_ref->{$key};
            }
        }
    }
}
运行此命令可提供所需的信息:

authors: Henze U.U., Berger-Bachi B.
location: Antimicrob. Agents Chemother. 40:2121-2125(1996).
title: "Penicillin-binding protein 4 overproduction increases beta-lactam resistance in Staphylococcus aureus."
pubmed: 8878592
authors: Henze U.U., Roos M., Berger-Bachi B.
location: Microb. Drug Resist. 2:193-199(1996).
title: "Effects of penicillin-binding protein 4 overproduction in Staphylococcus aureus."
pubmed: 9158759

BioPerl是解析这些类型文件的有用页面。如果您想获取条目,然后解析它们,您可以在上面的示例中使用并添加几行代码。我知道这不是对您的具体问题的回答,但它是一个解决方案,您会发现许多人可以帮助您使用BioPerl。

您说错误在Perl模块的第345行,但您只显示了16行。您是否显示了第345行,如果是,是哪一行?错误消息的全文是什么?您显示的代码有两个分配给
$refs
,中间没有任何内容;这看起来很可疑。@AdrianHHH 365行与perl模块/bio/parse/swissprot.pm相关,与我的代码无关。。。。我粘贴了两条参考线,因为我想向您展示我是如何使用此代码的(我知道它们彼此不相关,但它们是从文件中检索参考线的两种方法,所以我粘贴了两条参考线)……最后,代码运行得很好,但我认为问题在于我缺少了一些检索引用值的调用,因为“$entry\u name\n”;打印“$seq_len\n”我得到了这些线路的结果。非常感谢您的及时回复和宝贵的时间。。。。。。。。。。这正是我对Bio::Parse::SwissProt模块的理解。。非常感谢……@Megharshney,我不完全理解你的评论。你是说这个答案正是你想要的,还是说这仍然是你试图用另一个模块做的?我的观点是,使用BioPerl可能更容易,因为我在上面发布了一个可行的解决方案,更多的人将能够提供帮助。是的,我的意思是,我以您的代码的形式得到了我的答案(这正是我想用Bio::DB::Swissprot模块提取的内容)@Megharshney,我很高兴它解决了您的问题。您可以将问题标记为“已解决”,除非您正在寻找其他类型的解决方案。如果是,请解释,这样我可以扩展我的答案。事实上,我的问题已经解决了,但我想知道,当我使用Bio::DB::Swissprot模块时,我哪里不正确,因为如果我得到了另外两个字段,那么这意味着我错误地使用了错误的调用来获取参考线。
authors: Henze U.U., Berger-Bachi B.
location: Antimicrob. Agents Chemother. 40:2121-2125(1996).
title: "Penicillin-binding protein 4 overproduction increases beta-lactam resistance in Staphylococcus aureus."
pubmed: 8878592
authors: Henze U.U., Roos M., Berger-Bachi B.
location: Microb. Drug Resist. 2:193-199(1996).
title: "Effects of penicillin-binding protein 4 overproduction in Staphylococcus aureus."
pubmed: 9158759