[Biojava-dev] Phred symbol deserialization

Matthew Pocock matthew_pocock at yahoo.co.uk
Tue Apr 13 10:07:05 EDT 2004


Hi,

I have changed how symbols like those used by phread are serialized. 
They should now be converted into per-machine singletons. I have not 
tested extensively though. Could you see if the next nightly build fixes 
your problem? If it does, then it's likely we have serialization working 
sanely for all cross-product symbols and therefore for all alignments. 
If not, then back to the drawing board.

Matthew

Eric Haugen wrote:

>I've found that when I deserialize a Phred symbol (SimpleAtomicSymbol from the Phred alphabet == (DNA x SubIntegerAlphabet[0..99]) ), I get a brand new SimpleAtomicSymbol instead of the one already contained in the Phred alphabet.  So PhredTools.getPhredAlphabet().contains( symbol ) returns false for that symbol.
>
>The following kludgy addition to SimpleAtomicSymbol.java makes it work:
>
>import org.biojava.bio.program.phred.PhredTools;
>...
>  static final long serialVersionUID = -8426550133605911655l;
>
>  protected Object readResolve() throws java.io.InvalidObjectException {
>      Object result = this;
>      if ((this.getSymbols().size() == 2)
>      && Annotation.EMPTY_ANNOTATION.equals( this.getAnnotation() )) {
>          try {
>              Symbol symbol = PhredTools.getPhredAlphabet().getSymbol( this.getSymbols() );
>              if (symbol != null) {
>                  result = symbol;
>              }
>          } catch (Exception ignored) {
>              // Must not be a Phred symbol
>          }
>      }
>      return result;
>  }
>
>This causes as a side effect the initialization of the 400-symbol phred alphabet whenever ANY SimpleAtomicSymbol is deserialized.   And SimpleAtomicSymbol shouldn't have to know about various alphabets...
>So, I'm hoping someone else has a better idea.  Should AlphabetManager keep track of all cross-product symbols that should be singletons?
>
>Thanks,
>
>Eric
>
>  
>



More information about the biojava-dev mailing list