[Biojava-dev] Identifying EmissionStates

Schreiber, Mark mark.schreiber at agresearch.co.nz
Wed Jul 9 13:13:20 EDT 2003


OK I'm a dumb ass,

I forgot that a StatePath is an Alignment and the correct way to do it
is to get the State part of the Alignment as follows

  if (sp.symbolAt(sp.STATES, i)  ==  es1)
    //do something

I hope someone else learnt something from my noise on the mailing list
:(

- Mark



> -----Original Message-----
> From: Schreiber, Mark 
> Sent: Wednesday, 9 July 2003 12:03 p.m.
> To: biojava-dev at biojava.org
> Subject: [Biojava-dev] Identifying EmissionStates
> 
> 
> Hi -
> 
> I was wondering what the recommended proceedure for 
> identifying and emission state in a StatePath is.
> 
> If I create two states:
> 
>     int[] adv = {1};
>     Distribution biased = 
> OrderNDistributionFactory.DEFAULT.createDistribution(a);
>     Distribution unbiased  = new 
> UniformDistribution((FiniteAlphabet)a);
> 
>     SimpleEmissionState es1 = new 
> SimpleEmissionState("1",Annotation.EMPTY_ANNOTATION,
>                                     adv, biased);
>     SimpleEmissionState es2 = new 
> SimpleEmissionState("2",Annotation.EMPTY_ANNOTATION,
>                                     adv, unbiased);
> 
> And then get the StatePath:
> 
>   StatePath sp = dp.viterbi(sla,ScoreType.PROBABILITY);
> 
> I seem to have no easy way to do either of the following:
> 
>     for(int i = 1; i <= sp.length(); i++){
>       if(sp.symbolAt() == es1)
>         //do something
>     }
> 
> Or this:
> 
>     for(int i = 1; i <= sp.length(); i++){
>       if(sp.symbolAt().equalrs(es1))
>         //do something
>     }
> 
> I can identify them using the name of the state but this is 
> pretty painful, there must be a better way??
> 
> - Mark 
> ==============================================================
> =========
> 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-dev mailing list
> biojava-dev at biojava.org 
> http://biojava.org/mailman/listinfo/biojava-dev
> 
=======================================================================
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.
=======================================================================



More information about the biojava-dev mailing list