[Bioperl-l] Problems to get secondary accessions from an object

Brian Osborne brian_osborne at cognia.com
Wed Nov 9 11:20:01 EST 2005


Stephan,

Your code looks correct - are you sure that your sequences have secondary
accessions? The bioperl-live code retrieves these accessions correctly, my
script is below.

Brian O.

#!/usr/bin/perl

use strict;
$ENV{BIOPERL_INDEX_TYPE} = "SDBM_File";
$ENV{BIOPERL_INDEX} = ".";
use Bio::Index::Swissprot;

my @accs = qw(P09651
                  P12942
                  P13798
                  P58428);
my $file_name = "multiple.sw";
my $inx = Bio::Index::Swissprot->new(-filename => $file_name . ".idx",
                                                  -write_flag => 1);
$inx->id_parser(\&get_id);
$inx->make_index($file_name);

for my $acc (@accs) {
    my $seq = $inx->fetch($acc);
    print $seq->seq(),"\n";
    my @seconds = $seq->get_secondary_accessions;
    print "@seconds\n";
}

sub get_id {
    my $line = shift;
    $line =~ /AC\s+([A-Z]\d+);/;
    $1;
}




On 11/9/05 9:19 AM, "stephan" <stephan.rosecker at ish.de> wrote:

> Hi,
> 
> I have problems to get the secondary_accessions from an seq object.
> 
> E.G
> 
> $inx = Bio::Index::Swissprot->new($Index_File_Name);
> $prot = $inx->fetch( $accarray[ $_[0] ] );
> #"$accarray[ $_[0]" is an array of accessions
> 
> print "Description: " . $prot->description . "\n";
> print "Accessions: " .$sec . "\n";
> print "Species: " . $prot->species->binomial() . "\n";
> print "Length: " . $prot->length . "\n";
> #this looks good
> 
> @a = $prot->get_secondary_accessions;
> #@a is empty!
> 
> Seems that $prot is not a reference to a rich:seq object or somthing
> other is wrong.
> 
> Hope that someone can help me.
> 
> regards
> stephan
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list