[Biojava-dev] OrderN problem

Schreiber, Mark mark.schreiber@agresearch.co.nz
Mon, 25 Nov 2002 14:55:24 +1300


Hi -

The following code highlights an anomaly in the treatment of Alphabets
by the OrderNDistributions

    FiniteAlphabet ordern =
        (FiniteAlphabet)AlphabetManager.alphabetForName("(DNA x DNA x
DNA x DNA)");
    FiniteAlphabet ordern2 =
        (FiniteAlphabet)AlphabetManager.alphabetForName("((DNA x DNA x
DNA) x DNA)");

    System.out.println(ordern == ordern2);

    Distribution d =
OrderNDistributionFactory.DEFAULT.createDistribution(ordern);

    Distribution d2 =
OrderNDistributionFactory.DEFAULT.createDistribution(ordern2);

    System.out.println(d.getAlphabet() == d2.getAlphabet());

    System.out.println(((OrderNDistribution)d).getConditioningAlphabet()
                       ==
((OrderNDistribution)d2).getConditioningAlphabet());

    System.out.println(((OrderNDistribution)d).getConditionedAlphabet()
                       ==
((OrderNDistribution)d2).getConditionedAlphabet());

This will return false, false, true, true which is clearly not at all
logical. The problem seems to stem from the fact that the two Alphabets
are treated somewhat equally by the OrderNDistribution factory.

Some possible solutions include:

1) Don't allow alphabets like (DNA x DNA x DNA) which don't specify the
conditioning alphabet
2) Have it convert its alphabet to make things consistent.
3) Document the anomaly!!!!
4) do something smarter than 1 to 3?

- Mark


Mark Schreiber PhD
Bioinformatics
AgResearch Invermay
PO Box 50034
Mosgiel
New Zealand
 
PH:   +64 3 489 9175
FAX:  +64 3 489 3739

=======================================================================
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.
=======================================================================