[Biojava-dev] RichSequence.Tools.enrich(..) generateNoSuchElementException

Richard HOLLAND hollandr at gis.a-star.edu.sg
Sun Jan 22 21:42:17 EST 2006


Hello all.

There was indeed a bug (in the constructor of SimpleRichFeature) which
is now fixed, but Mark is right about using the appropriate BioJavaX
parser instead to do this task.

I've added a new module in biojava-live in CVS -
org.biojavax.bio.seq.db.ncbi.GenbankSequenceDB. See the
getRichSequence(), getRichSequenceDB() and getRichSequences() methods
for details.

Your sample code will work with the new module after you do this:

	1. 	Import org.biojavax.bio.seq.db.ncbi.GenbankSequenceDB
instead of org.biojava.bio.seq.db.GenbankSequenceDB
	2. 	change
			Sequence seq = sequenceIterator.nextSequence();
		to
			RichSequence seq =
(RichSequence)sequenceIterator.nextSequence();
	3. 	delete the line that calls enrich().

(Note: GenbankSequenceDB should probably be tidied up a little and made
to implement some kind of common interface, maybe RichSequenceDB?
Comments please.)

cheers,
Richard

Richard Holland
Bioinformatics Specialist
GIS extension 8199
---------------------------------------------
This email is confidential and may be privileged. If you are not the
intended recipient, please delete it and notify us immediately. Please
do not copy or use it for any purpose, or disclose its content to any
other person. Thank you.
---------------------------------------------


> -----Original Message-----
> From: mark.schreiber at novartis.com 
> [mailto:mark.schreiber at novartis.com] 
> Sent: Monday, January 23, 2006 10:03 AM
> To: Janko Diminic
> Cc: biojava-dev at biojava.org; Richard HOLLAND
> Subject: Re: [Biojava-dev] RichSequence.Tools.enrich(..) 
> generateNoSuchElementException
> 
> 
> Hi -
> 
> Will have a look into this.
> 
> However, the enrich method is not the ideal way to do this. 
> The method 
> will do it's best to make a Sequence into a RichSequence but 
> it usually 
> cannot do a great job. Your best bet would be to use NCBI 
> eutils to get 
> sequences in GenBank or XML and then put them through the appropriate 
> parser to directly generate a RichSequence.
> 
> As a todo, we should update GenbankSequenceDB to provide RichSequence 
> instances (or deprecate it and provide an alternative).
> 
> - Mark
> 
> 
> 
> 
> 
> Janko Diminic <jdiminic at gmail.com>
> Sent by: biojava-dev-bounces at portal.open-bio.org
> 01/21/2006 02:52 PM
> 
>  
>         To:     biojava-dev at biojava.org
>         cc:     (bcc: Mark Schreiber/GP/Novartis)
>         Subject:        [Biojava-dev] 
> RichSequence.Tools.enrich(..) generate 
> NoSuchElementException
> 
> 
> Hi, RichSequence.Tools.enrich(seq) generate NoSuchElementException 
> exception:
> 
> // Samples.java class
> 
>     Set param = new HashSet();
>     param.add("AJ278573");   // NCBI accession
> 
>     GenbankSequenceDB genBank = new GenbankSequenceDB();
>     SequenceDB sequences = genBank.getSequences(param);
> 
>     sequenceIterator = sequences.sequenceIterator();
> 
> while (sequenceIterator.hasNext()) {
>         try {
>               Sequence seq = sequenceIterator.nextSequence();
>               RichSequence enrichSeq = RichSequence.Tools.enrich(seq);
>   //line:92,  here throw NoSuchElementException ???
> 
>               session.saveOrUpdate("Sequence", enrichSeq);
> 
>               } catch (NoSuchElementException e) {
>                      e.printStackTrace();
>               }
>         }
> 
> 
> 
> java.util.NoSuchElementException
>     at 
> java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHas
hMap.java:367)
>     at 
> java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:376)
>     at 
> org.biojavax.bio.seq.SimpleRichFeature.<init>(SimpleRichFeatur
> e.java:96)
>     at 
> org.biojavax.bio.seq.SimpleRichSequence.createFeature(SimpleRi
> chSequence.java:323)
>     at 
> org.biojavax.bio.seq.RichSequence$Tools.enrich(RichSequence.java:434)
>     at hr.Samples.main(Samples.java:92)
> 
> 
> Do you know way?
> Thanks for the help.
> 
> 
> 
> --
> Janko Diminic
> 
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at biojava.org
> http://biojava.org/mailman/listinfo/biojava-dev
> 
> 
> 
> 



More information about the biojava-dev mailing list