[Biojava-l] RE: Sequence serialization exception - AlphabetManager problem?

Mark Southern msouthern at exsar.com
Mon Sep 29 18:45:07 EDT 2003


Appologies for following up on my own post. What follows is a simpler test
than the serialization I attempted before.

Consider the bit of code below and corresponding error message;

For some reason, the protein sequence is being treated as a dna sequence. Is
there something I am missing with respect to how AlphabetManager treats dna
and protein alphabets? 

Any explainations would be most welcome.

Thanks again,

Mark.


//------------------------------------------------------------------------

public static void main(String[] args) throws Exception{
        String seqFile = "c:\\temp\\KAP0_BOVIN.swiss";
         SequenceIterator iter = (SequenceIterator)
SeqIOTools.fileToBiojava(SeqIOConstants.SWISSPROT
 
,new BufferedReader( new FileReader( seqFile ) ) );
        Sequence seq = iter.nextSequence();
        SeqIOTools.biojavaToFile( SeqIOConstants.SWISSPROT,  System.out,
seq );
}


org.biojava.bio.symbol.IllegalSymbolException: Symbol ALA not found in
alphabet DNA
        at
org.biojava.bio.symbol.AbstractAlphabet.validate(AbstractAlphabet.java:278)
        at
org.biojava.bio.symbol.AlphabetManager$ImmutableWellKnownAlphabetWrapper.val
idate(AlphabetManager.java:1423)
        at
org.biojava.bio.seq.io.CharacterTokenization._tokenizeSymbol(CharacterTokeni
zation.java:178)
        at
org.biojava.bio.seq.io.CharacterTokenization.tokenizeSymbol(CharacterTokeniz
ation.java:191)
        at
org.biojava.bio.symbol.AlphabetManager$WellKnownTokenizationWrapper.tokenize
Symbol(AlphabetManager.java:1276)
        at
org.biojava.bio.seq.io.AbstractGenEmblFileFormer.formatTokenBlock(AbstractGe
nEmblFileFormer.java:337)
        at
org.biojava.bio.seq.io.EmblFileFormer.addSymbols(EmblFileFormer.java:211)
rethrown as org.biojava.bio.symbol.IllegalAlphabetException: DNA not
tokenizing
        at
org.biojava.bio.seq.io.EmblFileFormer.addSymbols(EmblFileFormer.java:224)
        at
org.biojava.bio.seq.io.SeqIOEventEmitter.getSeqIOEvents(SeqIOEventEmitter.ja
va:125)
rethrown as org.biojava.bio.BioError: An internal error occurred processing
symbols
        at
org.biojava.bio.seq.io.SeqIOEventEmitter.getSeqIOEvents(SeqIOEventEmitter.ja
va:137)
        at
org.biojava.bio.seq.io.EmblLikeFormat.writeSequence(EmblLikeFormat.java:289)
        at
org.biojava.bio.seq.io.EmblLikeFormat.writeSequence(EmblLikeFormat.java:253)
        at
org.biojava.bio.seq.io.SeqIOTools.writeSwissprot(SeqIOTools.java:316)
        at org.biojava.bio.seq.io.SeqIOTools.seqToFile(SeqIOTools.java:1078)
        at
org.biojava.bio.seq.io.SeqIOTools.biojavaToFile(SeqIOTools.java:870)
        at com.exsar.test.SerializeTest.main(SerializeTest.java:24)



-----Original Message-----
From: Mark Southern [mailto:msouthern at exsar.com] 
Sent: Monday, September 29, 2003 2:01 PM
Cc: 'biojava-l at biojava.org'
Subject: Sequence serialization exception


I am getting the following exception when trying to serialize a protein
sequence. I am using biojava 1.3. Can anyone please explain to me why?
 
Many thanks,
 
Mark.
 
 
java.io.InvalidObjectException: Couldn't resolve symbol:SER
        at
org.biojava.bio.symbol.AlphabetManager$WellKnownAtomicSymbol$OPH.readResolve
(AlphabetManager.java:1441)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:911)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1655)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1603)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1271)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:452)
        at
org.biojava.bio.seq.impl.SimpleSequence.readObject(SimpleSequence.java:119)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:452)
        at org.biojava.bio.seq.ViewSequence.readObject(ViewSequence.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
        at java.util.HashMap.readObject(HashMap.java:985)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
        at java.util.HashMap.readObject(HashMap.java:986)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
        at com.exsar.hdex.model.calc.Test.main(Test.java:104)

 





More information about the Biojava-l mailing list