[BioSQL-l] Bio::Seq and sequence version numbers

Marc Logghe Marc.Logghe at devgen.com
Mon Nov 10 09:39:10 EST 2003


Hi,

> -----Original Message-----
> From: William Kenworthy [mailto:billk at iinet.net.au]
> Sent: Monday, November 10, 2003 2:34 PM
> To: BioSQL List
> Subject: [BioSQL-l] Bio::Seq and sequence version numbers
> 
> 
> Hi I am using the following to retrieve a seq object
> 
> $seq = Bio::Seq->new(-accession_number => "AL022723",
>                      -namespace        => "bioperl");
> 
> This fails to retrieve the sequence because it defaults to a 
> version of
> "0", and this sequence is at version 4.  It works if I set it to
> "-version=>"4", but usually you dont know what version you 
> are trying to
> retrieve.  Is there a way of forcing a wildcard for version, or an
> alternate method that ignores it?  
I think when you use the find_by_unique_key, you have to know the accession number AND version (after all you want to fetch a *unique* record; in case more versions are available, the system does not know which one you want).
find_by_query might be a valid alternative.
# set up the query template
my $query  = Bio::DB::Query::BioQuery->new(
        -datacollections => [ "Bio::PrimarySeqI e",  "BioNamespace=>Bio::PrimarySeqI db"  ],
        -where => [ "e.accession_number = ?", "db.namespace = 'bioperl'" ] ,
        -order  => ["e.version"]  
);

# perform the query with the desired value
my $result = $adp->find_by_query($query, -name => 'test', -values => ['AL022723']);
my $seq = $result->next_object; # gives you the first sequence object from the ordered list

HTH,
Marc



More information about the BioSQL-l mailing list