[Biojava-l] Problem using SimpleAlphabet

Lachlan Coin lc1@sanger.ac.uk
Sat, 23 Mar 2002 12:57:18 +0000 (GMT)


For some reason, I am having trouble adding an AtomicSymbol as an  indexed
member of a SimpleAlphabet (i.e I can add it as a member of the alphabet,
but the method I use to add it doesn't create an indice for it).

e.g. I use 

	SimpleAlphabet() alph = new SimpleAlphabet();
	alph.setName("Protein Domains);
	....
	//iterate over alphabet names ...
	AtomicSymbol symb = AlphabetManager.createSymbol(token, name, ann);
	alph.addSymbol(symb);
	
which works fine, however, when I try for some symbol symb1 added to  the
alphabet in the step above:
	
	AlphabetIndex alphindex =
			AlphabetManager.getAlphabetIndex(alph);
System.out.println(alphindex.indexForSymbol(AtomicSymbol) symb1);

Then at run-time I am told that:
	org.biojava.bio.BioError: Assertion Failure: Symbol 110
was not an indexed member of the alphabet Protein Domains despite being in
the alphabet.



As an aside I'm not sure if I would be better of using IntegerAlphabet, as
the names of the members of the alphabet are integers (representing Pfam
protein domains, indexed from 1 to 3600).  However, as far as I could
tell, IntegerAlphabet does not have a addSymbol() method, which meant that
I could not use it to construct a new alphabet.

Thanks in advance for any ideas.


Lachlan