[Bioperl-l] parsing entrezgene file (lost data)

Smithies, Russell Russell.Smithies at agresearch.co.nz
Tue Jul 5 21:55:19 UTC 2011


It is in there, just takes a bit of getting at.
Frequent use of Data::Dumper to work out where you are helps.



use warnings;
use strict;
use Bio::ASN1::EntrezGene;
use Data::Dumper;

my $parser = Bio::ASN1::EntrezGene->new('file' => "entrezgene.asn");
while(my $result = $parser->next_seq){
    $result = $result->[0] if(ref($result) eq 'ARRAY');
    foreach my $l (@{$result->{locus}}){
        foreach my $p (@{$l->{products}}){

          my $nuc_gi = $p->{seqs}->[0]->{whole}->[0]->{gi};
          my $nuc_acc = $p->{accession};

          my $prot_gi = $p->{products}->[0]->{seqs}->[0]->{whole}->[0]->{gi};
          my $prot_acc = $p->{products}->[0]->{accession};

          print "$nuc_gi, $nuc_acc\t$prot_gi, $prot_acc \n";
        }
    }
}



--Russell

> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of Carnë Draug
> Sent: Monday, 4 July 2011 2:39 p.m.
> To: bioperl mailing list
> Subject: [Bioperl-l] parsing entrezgene file (lost data)
> 
> Hi
> 
> I've been trying to get some data from an ASN.1 entrezgene file.
> However, I can't seem to access some of the data on the file.  I've
> read the Feature-annotations page on the wiki (even fixed a bug in
> there) but still nothing. So I used Data::Dumper to look at the Seq and
> Annotation objects and couldn't see it in there at all although it's on
> the original file (attached).
> 
> The data I want from the sequence are the ids "NM_002105" and
> "NP_002096" which show up several times on the file. However, when I do
> this:
> 
> use Data::Dump;
> use Bio::SeqIO;
> my $file = $ARGV[0];
> my $seqio_object = Bio::SeqIO->new(-file => $file, -format =>
> 'entrezgene'); my $seq_object = $seqio_object->next_seq; print
> Dumper($seq_object);
> 
> I can't find 002105 or 002096 anywhere on the output.
> 
> Am I doing something wrong? How can I solve this?
> 
> Thanks in advance,
> Carnë Draug
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================




More information about the Bioperl-l mailing list