[Biojava-l] RE: Sequence serialization exception -
AlphabetManagerproblem?
Mark Southern
msouthern at exsar.com
Tue Sep 30 09:30:37 EDT 2003
Hi Mark,
I did also have an error with binary serialization. I was just trying to
approach to problem from a different direction. B/c that also was a problem
with finding / determining a protein symbol, i wondered if was coming from
AlphabetManager rather than the Swissprot writing. I include below the code
fragment along with the serialization error.
Best regards,
Mark.
public static void main(String[] args) throws Exception{
File file = new File("c:\\temp\\sequence.ser");
String seqFile = "c:\\temp\\KAP0_BOVIN.swiss";
SequenceIterator iter = (SequenceIterator) SeqIOTools.fileToBiojava(
SeqIOConstants.SWISSPROT
,
new BufferedReader( new FileReader( seqFile ) ) );
Sequence seq = iter.nextSequence();
System.out.println("\nWriting Sequence object");
ObjectOutputStream out = new ObjectOutputStream( new
FileOutputStream(file) );
out.writeObject( seq );
out.flush();
out.close();
System.out.println("\nReading Sequence object");
ObjectInputStream in = new ObjectInputStream( new
FileInputStream(file) );
seq = (Sequence) in.readObject();
in.close();
}
Writing Sequence object
Reading Sequence object
java.io.InvalidObjectException: Couldn't resolve symbol:ALA
at
org.biojava.bio.symbol.AlphabetManager$WellKnownAtomicSymbol$OPH.readResolve
(AlphabetManager.java:1480)
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.readObject(ObjectInputStream.java:324)
at com.exsar.test.SerializeTest.main(SerializeTest.java:38)
Exception in thread "main"
-----Original Message-----
From: Schreiber, Mark [mailto:mark.schreiber at agresearch.co.nz]
Sent: Tuesday, September 30, 2003 6:28 AM
To: msouthern at exsar.com; biojava-l at biojava.org
Subject: RE: [Biojava-l] RE: Sequence serialization exception -
AlphabetManagerproblem?
Hi -
I was a bit thrown off at first cause I thought you meant there was an error
in binary serialization. There seems to be a problem with SwissProt writing.
I've commited an addition to SeqIOToolsTest in biojava live that replicates
the error but I haven't got time to track it down just yet. If some one else
doesn't get it I'll probably find it tommorrow.
- Mark
-----Original Message-----
From: Mark Southern [mailto:msouthern at exsar.com]
Sent: Tue 30/09/2003 10:45 a.m.
To: biojava-l at biojava.org
Cc:
Subject: [Biojava-l] RE: Sequence serialization exception -
AlphabetManagerproblem?
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)
_______________________________________________
Biojava-l mailing list - Biojava-l at biojava.org
http://biojava.org/mailman/listinfo/biojava-l
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================
More information about the Biojava-l
mailing list