Hi Eric, You can do something like this to check if a particular letter (token) is in an alphabet:
Alphabet myAlphabet = ... ; // get your alphabet from somewhere SymbolTokenization st = myAlphabet.getTokenization("token"); String token = "X"; // the token to check for boolean alphaContainsToken = true; try { st.parseToken("X"); // see if your alphabet contains the letter X } catch (IllegalSymbolException e) { alphaContainsToken = false; } if (alphaContainsToken) System.out.println("Alphabet DOES contain token "+token); else System.out.println("Alphabet DOES NOT contain token "+token); cheers, Richard Richard Holland Bioinformatics Specialist GIS extension 8199 --------------------------------------------- This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its content to any other person. Thank you. --------------------------------------------- > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Eric Buckley > Sent: Wednesday, September 07, 2005 10:14 PM > To: biojava-l@biojava.org > Subject: [Biojava-l] is valid character > > > I was wondering if there is a way to check if a character is > valid within an > alphabet. For example I want to do some preprocessing on a > string before I > convert the string to a SymbolList using DNATools. However if > an invalid > character exists in the string an Exception will be thrown, > so I would first > like to remove (or replace) all of the invalid characters. > > Eric Buckley > > _______________________________________________ > Biojava-l mailing list - Biojava-l@biojava.org > http://biojava.org/mailman/listinfo/biojava-l > _______________________________________________ Biojava-l mailing list - Biojava-l@biojava.org http://biojava.org/mailman/listinfo/biojava-l