Hi Ben -

If your Sequence contains any ambiguous Symbols (eg for DNA n,y,r,w etc), they will 
not be AtomicSymbols they will be BasisSymbols. BasisSymbols are made up of one or 
more AtomicSymbols.

If this is the case you need to use Solution 2 from the same page 
(http://www.biojava.org/docs/bj_in_anger/CountResidues.htm). Actually Solution 2 is 
the better of the two as it is more flexible.

If this still doesn't work send me the sequence and I'll take a look.

- Mark


> -----Original Message-----
> From: Ben Good [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, 25 November 2003 9:43 p.m.
> To: [EMAIL PROTECTED]
> Subject: [Biojava-l] anger error
> 
> 
> Hi,
> 
>   Trying to implement this bit from biojava in anger ("How do 
> count the 
> residues in a sequence").
> 
> Count counts = new IndexedCount ((FiniteAlphabet)seq.getAlphabet());
>                                       //iterate through the 
> Symbols in seq
>                                               for (Iterator i 
> = seq.iterator(); i.hasNext();){
>                                               AtomicSymbol 
> sym = (AtomicSymbol)i.next();
>                                               
> counts.increaseCount (sym,1.0);
>                                               }
> 
> It compiles but gives a class cast exception when I try to run it.  
> Won't accept (AtomicSymbol)i.next();
> 
> It seems that seq.iterator() returns an iterator over Symbols and not 
> AtomicSymbols?
> 
> any ideas?
> 
> thanks
> -Ben
> 
> _______________________________________________
> Biojava-l mailing list  -  [EMAIL PROTECTED] 
> http://biojava.org/mailman/listinfo/biojava-l
> 
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================

_______________________________________________
Biojava-l mailing list  -  [EMAIL PROTECTED]
http://biojava.org/mailman/listinfo/biojava-l

Reply via email to