Cool. Looks good. Commit away. Could you add some javadocs (class & constructor)?
Matthew Singh, Nimesh wrote: > I've created a class called AlignmentSequenceIterator that I intend to put in >the org.biojava.bio.seq package. It will do the real work. I've also added > public SequenceIterator sequenceIterator() { > return new AlignmentSequenceIterator(this); > } > to each alignment class. It should work fine in every alignment, because >AlignmentSequenceIterator uses the getLabels and symbolListForLabel methods from the >Alignment interface. > > If this is fine, then I'll upload everything later today. If you have any >suggestions for changes, then let me know. > > Nimesh > > > Here is the cod for AlignmentSequenceIterator: > > public class AlignmentSequenceIterator implements SequenceIterator { > private Alignment align; > private Iterator labels; > private SequenceFactory sf; > public AlignmentSequenceIterator(Alignment align) { > this.align = align; > labels = align.getLabels().iterator(); > sf = new SimpleSequenceFactory(); > } > public boolean hasNext() { > return labels.hasNext(); > } > public Sequence nextSequence() throws NoSuchElementException, BioException { > if (!hasNext()) { > throw new NoSuchElementException("No more sequences in the alignment."); > } > else { > try { > Object label = labels.next(); > SymbolList symList = align.symbolListForLabel(label); > Sequence seq = sf.createSequence(symList, label.toString(), >label.toString(), null); > return seq; > } catch (Exception e) { > throw new BioException(e, "Could not read sequence"); > } > } > } > } > _______________________________________________ > Biojava-l mailing list - [EMAIL PROTECTED] > http://biojava.org/mailman/listinfo/biojava-l > _______________________________________________ Biojava-l mailing list - [EMAIL PROTECTED] http://biojava.org/mailman/listinfo/biojava-l