[Biojava-dev] Gaps and EmptyAlphabet

mark.schreiber at group.novartis.com mark.schreiber at group.novartis.com
Tue Feb 24 20:05:14 EST 2004


Hi Matthew,

The following shows the problem. It appears to be that gap.getMatches() 
gives an EmptyAlphabet. Instead I propose that it should give an Alphabet 
that contains only itself. Also, is there any reason why a Gap shouldn't 
be Atomic? After all if getMatches() returns itself and it's not really 
divisible within it's parent Alphabet then I think it should be Atomic.

Why do I care I hear you ask?? Well, if it were Atomic and matched itself 
then I could make a special case of Distribution that actually stored the 
weight of gaps.

public class FunWithGaps {
  public static void main(String[] args) {
    Alphabet dna = DNATools.getDNA();
    Symbol gap = dna.getGapSymbol();
 
    FiniteAlphabet a = (FiniteAlphabet)gap.getMatches(); //EmptyAlphabet
    System.out.println(a.size() == 0); //true
 
 
    //won't loop as hasNext() is false
    for (Iterator iter = a.iterator(); iter.hasNext(); ) { 
      Symbol sym = (Symbol)iter.next();
      System.out.println(sym.getName());
    }
 
    System.out.println(a.contains(gap)); //false!!
  }
}







Matthew Pocock <matthew_pocock at yahoo.co.uk>
Sent by: biojava-dev-bounces at portal.open-bio.org
02/24/2004 07:41 PM

 
        To:     Mark Schreiber/GP/Novartis at PH
        cc:     biojava-dev at open-bio.org
        Subject:        Re: [Biojava-dev] Gaps and EmptyAlphabet


Mark, could you post some example code? This smells like it's a 
boundary-condition bug. The maths says it does match itself, so we have 
got the alphabet wrong.

We should have included a 'gap' Symbol sub-interface, but it's too late 
now. Symbols and alpphabets will be much cleaner next time around, but 
oopy programming realy doesn't make it easy to do very relational / 
group-theoretical things without jumping through hoops, as extention vs 
specialisation are both modelled by inheritance but are realy orthogonal 
processes.

Matthew

mark.schreiber at group.novartis.com wrote:

>The gap symbol getMatches method returns the EmptyAlphabet.
>
>This has the slightly weird result that the gap symbol doesn't match 
>itself!? I'm sure Bertrand Russell could write a book on that. I just 
>think it's plain weird. Wouldn't it be better if the getMatches for a gap 

>returned an FiniteAlphabet containing only the gap symbol??
>
>- Mark
>
>Mark Schreiber
>Principal Scientist (Bioinformatics)
>
>Novartis Institute for Tropical Diseases (NITD)
>1 Science Park Road
>#04-14 The Capricorn
>Singapore 117528
>
>phone +65 6722 2973
>fax  +65 6722 2910
>
>_______________________________________________
>biojava-dev mailing list
>biojava-dev at biojava.org
>http://biojava.org/mailman/listinfo/biojava-dev
>
> 
>

_______________________________________________
biojava-dev mailing list
biojava-dev at biojava.org
http://biojava.org/mailman/listinfo/biojava-dev





More information about the biojava-dev mailing list