[Biojava-dev] More problems with gaps

Lachlan Coin lc1 at sanger.ac.uk
Mon Apr 28 14:12:29 EDT 2003


Hi,

I've been tracking down a bug to do with the use of gaps in cross product
alphabets.
The problem is that a gap symbol is not atomic, and hence when I use a cross product
alphabet, and I use the getSymbol(List syms) method of this cross product
alphabet, if any of the symbols in syms are gaps, the method returns a
SimpleSymbol with name "[]" (it should return a BasisSymbol).

I have commited a test in org.biojava.bio.symbol.AlphabetManagerTest which
demonstrates this:

public void testGapInCrossProductAlphabet() throws Exception{
	Alphabet alph = AlphabetManager.alphabetForName("(PROTEIN x
PROTEIN)");
	List s = new ArrayList();
	s.add(AlphabetManager.getGapSymbol());
	s.add(ProteinTools.createProtein("V").symbolAt(1));
	Symbol sym = alph.getSymbol(s);
	List l  = ((BasisSymbol)sym ).getSymbols();
	assertEquals(s.get(0), l.get(0));
	assertEquals(s.get(1), l.get(1));
    }


It falls over when it tries to cast to a BasisSymbol.

Any ideas on how to fix this?

The approach which makes most sense to me is to make the gap symbol
atomic.  Is this an option at all?

Thanks,

Lachlan




More information about the biojava-dev mailing list