On Wed, Jan 16, 2002 at 07:00:44PM +0100, Michal Kurowski wrote: > Hi, > According to some previous posts it seems I've got an usual beginner > mistake in here. When I type "javac seq/TestEmbl.java" I got: > > seq/TestEmbl.java:23: cannot resolve symbol > symbol : class SymbolParser > location: class seq.TestEmbl > SymbolParser rParser = alpha.getParser("token"); > ^ > seq/TestEmbl.java:23: cannot resolve symbol > symbol : method getParser (java.lang.String) > location: interface org.biojava.bio.symbol.Alphabet > SymbolParser rParser = alpha.getParser("token");
No, it's a usual developer (me, in this case) not-checking-that- things-compile mistake -- sorry! I've attached a corrected version. The only changes are: SymbolParser -> SymbolTokenization getParser(String name) -> getTokenization(String name); This is the correct API for the forthcoming 1.2 release series. Hope this helps, Thomas. PS. Note that these demos are all a bit old. Most people would actually use the convenient method: SeqIOTools.readEmbl(); You might like to look at TestEmbl2.java to see how this is used.
package seq; import java.io.*; import org.biojava.bio.*; import org.biojava.bio.symbol.*; import org.biojava.bio.seq.*; import org.biojava.bio.seq.io.*; public class TestEmbl { public static void main(String [] args) { try { if(args.length != 1) { throw new Exception("Use: TestEmbl emblFile"); } File emblFile = new File(args[0]); SequenceFormat eFormat = new EmblLikeFormat(); BufferedReader eReader = new BufferedReader( new InputStreamReader(new FileInputStream(emblFile))); SequenceBuilderFactory sFact = new EmblProcessor.Factory(SimpleSequenceBuilder.FACTORY); Alphabet alpha = DNATools.getDNA(); SymbolTokenization rParser = alpha.getTokenization("token"); SequenceIterator seqI = new StreamReader(eReader, eFormat, rParser, sFact); while(seqI.hasNext()) { Sequence seq = seqI.nextSequence(); System.out.println(seq.getName() + " has " + seq.countFeatures() + " features"); eFormat.writeSequence(seq, System.out); System.out.println("pigs"); } } catch (Throwable t) { t.printStackTrace(); System.exit(1); } } }