[Biojava-l] String for Symbol

Thomas Down td2@sanger.ac.uk
Thu, 14 Dec 2000 20:21:15 +0000


On Thu, Dec 14, 2000 at 09:55:07AM -0800, Emig, Robin wrote:
> 	I would like to add a method for BasisSymbol
> 
> String getTokensString()
> or 
> String getTokens()
> 
> which would return a string consisting of all the tokens for that symbol.
> This would be useful for actual crossproduct symbols such as  [act]. Right
> now the get token returns a unique but uncomprehendable char for getToken,
> and in order to get the string of tokens you have to iterate through a list
> from getSymbols(). It was suggested that and additional method of String
> getToken() be implemented, but I thought it would be better if the two
> methods where less ambiguous.
> 
> Any comments....

I can see the point of this, and would be inclined to agree
(although why only BasisSymbol and not Symbol) except...

I've been kind-of suspicious of the idea of tokens attached
to Symbols.  They're useful fo the simple protein and DNA
alphabets, but otherwise rather problematic.  As a result,
I'd like to remove the tokens from the symbols themselves, and
instead have `Stringifier' objects that are responsible for
encapsulating code to convert Symbols and SymbolLists into
textual representation -- in other words the exact opposite
of SymbolParser objects.

We'd still want to leave the getName() method on symbols,
since they're very useful for debugging. (note, I've
fixed this so it now always gives a sensible answer for
ambiguous and crss-product symbols).

I was planning to leave this change 'til after the 1.1
release, although I guess it could be bought forward.
But I guess this could be reconsidered if you need more
sophisticated stringification behaviour now.

Happy hacking,

  Thomas.
-- 
``If I was going to carry a large axe on my back to a diplomatic
function I think I'd want it glittery too.''
           -- Terry Pratchett