[Biojava-l] regarding code (Richard Holland)

Deepak Sheoran sheoran143 at gmail.com
Sat Jul 17 23:05:44 UTC 2010

  The problem which I think Indu Pandey is having is with following 
method  from latest version of biojava:

     public RichSequence getRichSequence(String id) throws 
IllegalIDException, BioException {
         try {
             // Build the query object
             String queryText = "from Sequence where name = ?";     
**************///// instead of "name" it should be "accession"
             Object query = this.createQuery.invoke(this.session, new 
             // Set the parameters
             query = this.setParameter.invoke(query, new Object[]{new 
Integer(0), id});
             // Get the results
             List result = (List)this.list.invoke(query,(Object[]) null);
             // If the result doesn't just have a single entry, throw an 
             if (result.size()==0) throw new IllegalIDException("Id not 
found: "+id);
             else if (result.size()>1) throw new 
IllegalIDException("Multiple records found with that id - use 
getRichSequences: "+id);
             // Return the found object, if found - null if not.
             return (RichSequence)result.get(0);
         } catch (Exception e) {
             // Throw the exception with our nice message
             throw new RuntimeException("Error while trying to load by 
id: "+id,e);

Either biojava or Indu should change this method from having "name" to 
"accession" because in biosql.bioentry table "name" and "accession" are 
not same, in most case they are equal, but its not necessary. Thus even 
if you are querying the database with a valid accession number you won't 
get any record back in some cases. Also we should update the 
documentation which indicate that it query "name" column from bioentry 
table and not the accession column.

Deepak Sheoran

On 7/17/2010 11:00 AM, biojava-l-request at lists.open-bio.org wrote:
> Send Biojava-l mailing list submissions to
> 	biojava-l at lists.open-bio.org
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.open-bio.org/mailman/listinfo/biojava-l
> or, via email, send a message with subject or body 'help' to
> 	biojava-l-request at lists.open-bio.org
> You can reach the person managing the list at
> 	biojava-l-owner at lists.open-bio.org
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Biojava-l digest..."
> Today's Topics:
>     1. regarding code (indu pandey)
>     2. Re: regarding code (Richard Holland)
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l

More information about the Biojava-l mailing list