[Biojava-l] ProfileHMM Serialization Problem

mark.schreiber at novartis.com mark.schreiber at novartis.com
Fri Mar 17 02:50:34 UTC 2006


He did fix a number of problems, although possibly not all,

Which version are you using?

Can you send a stack trace?

- Mark

Mark Schreiber
Research Investigator (Bioinformatics)

Novartis Institute for Tropical Diseases (NITD)
10 Biopolis Road
#05-01 Chromos
Singapore 138670
www.nitd.novartis.com

phone +65 6722 2973
fax  +65 6722 2910





Todd Riley <toddri at eden.rutgers.edu>
03/17/2006 10:33 AM

 
        To:     Mark Schreiber/GP/Novartis at PH
        cc:     biojava-l-bounces at portal.open-bio.org, biojava-l at biojava.org
        Subject:        ProfileHMM Serialization Problem


Hello all,

I am having a problem with serialized ProfileHMM objects.  I can read in 
one serialized ProfileHMM object, but never more than one (I can't even 
read in the same serialized object again.)  It appears that the problem 
lies with the AlphabetManager. Maybe a clash with alphabet names and/or 
indexes?  I looked in the archives and found the problem seemed to exist 
back in Oct of 2002.  Has this ever been addressed?  Any help here would 
be greatly appreciated.

Thanks,
Todd
RE: [Biojava-l] Re: Biojava-l digest, Vol 1 #776 - 5 msgs
Schreiber, Mark
Tue, 08 Oct 2002 13:11:33 -0700
Yup,

It needs fixing, serialization and BioJava just don't seem to play that
well :(

The question is what kind of API. The attractive part about
serialization is that when it works you get back what you started with.
You can also do RMI. The downside of the XML model is you don't get back
what you had before, you get back a MarkovModel, all of your custom
designed methods etc are lost. 

Two ways I can see to get around this. One right a wrapper class that
makes your custom model and the thing returned by the XMLMarkovModel
look the same (look like the same interface generally). The other option
is to mimic something like JAXB (not JAXB though as it won't cope well
with BioJava flyweight symbols and alphabets). Somewhere the class name
is stored in the XML and through the wonders of introspection things are
returned to how they were. This generally requires the class to be
designed as a valid bean, or at least point to a nice FactoryClass or
something.

Ultimately this would be good for all of BioJava. I know people hate the
idea of another XML format but I think that there really isn't one that
represents what we are trying to do here. You could also write XSLT to
transform into XML flavours that aren't as interested in gory details
such as classnames etc which are needed for serialization.

Just my $0.02

- Mark


> -----Original Message-----
> From: Matthew Pocock [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, 9 October 2002 7:08 a.m.
> To: Lachlan Coin; [EMAIL PROTECTED]
> Subject: Re: [Biojava-l] Re: Biojava-l digest, Vol 1 #776 - 5 msgs
> 
> 
> Hi,
> 
> HMM serialization (or persistance) seems to be an
> ongoing problem for people. We (OK - I) wrote this
> code a long time ago, back in the dark ages when I
> didn't know much about programming. Does anyone want
> to fix this mess once and for all, and write a HMM
> persistance API? It sounds like that would be a realy
> helpfull thing to have.
> 
> Matthew
> 
>  --- Lachlan Coin <[EMAIL PROTECTED]> wrote: > Hi
> > 
> > Having made a mistake in serialising HMMs before -
> > are you writing your
> > serialised object at several points in the code?
> > Unless you write all of
> > the models at the same point, they will not work
> > when you read them back
> > in.
> > 
> > Cheers,
> > 
> > Lachlan
> > 
> > >
> > > Message: 1
> > > Subject: RE: [Biojava-l] Create DP object from
> > profileHMM class file
> > > Date: Tue, 8 Oct 2002 08:53:41 +1300
> > > From: "Schreiber, Mark"
> > <[EMAIL PROTECTED]>
> > > To: "Tisanai" <[EMAIL PROTECTED]>,
> > <[EMAIL PROTECTED]>
> > >
> > > Hi -
> > >
> > > The error is coming from the 64th line of your
> > program (at
> > > T_Zscore.main(T_Zscore.java:64))
> > >
> > > I can see two places that the error might be
> > coming from but I need to
> > > know which line is the 64th line of the program.
> > >
> > > Is it: ProfileHMM model = (ProfileHMM)
> > ois_md.readObject();
> > >
> > > Or is it: dp[i] =
> > DPFactory.DEFAULT.createDP(model);
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Tisanai
> > [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, 8 October 2002 2:40 a.m.
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [Biojava-l] Create DP object from
> > profileHMM class file
> > > >
> > > >
> > > > Hi
> > > >
> > > >    By this code I would like to create DP object
> > from several
> > > > phmm file.
> > > >
> > > >        for(int
> > i=0;i<md_out_lst.align.length;i++){
> > > >         String model_out_name =
> > md_out_lst.align[i];
> > > >         File md_file = new File(model_out_name);
> > > >
> > > >         FileInputStream fis_md = new
> > FileInputStream(md_file);
> > > >         ObjectInputStream ois_md = new
> > ObjectInputStream(fis_md);
> > > >         ProfileHMM model = (ProfileHMM)
> > ois_md.readObject();
> > > >         ois_md.close();
> > > >         dp[i] =
> > DPFactory.DEFAULT.createDP(model);
> > > >        }
> > > >
> > > >    I found that  it always stuck at the second file (i=2). If 
there is only one file in my list this code will
> > work fine. But if there is more than one file in the list when it try 
to
> > > > create the second dp object (dp[1]). This kind of error will shown 
out:
> > > >
> > > >             org.biojava.bio.BioError: State d-15
> > is known in
> > > > states  but is not listed in the transFrom table
> > > >         at
> > > >
> >
> org.biojava.bio.dp.SimpleMarkovModel.transitionsFrom(SimpleMar
> > > > kovModel.java:227)
> > > >         at
> > > >
> >
> org.biojava.bio.dp.DP$HMMOrderByTransition.transitionsTo(DP.java:599)
> > > >             at
> > > >
> >
> org.biojava.bio.dp.DP$HMMOrderByTransition.compare(DP.java:586)
> > > >         at org.biojava.bio.dp.DP.stateList(DP.java:123)
> > > >         at org.biojava.bio.dp.DP.update(DP.java:353)
> > > >         at
> >
> org.biojava.bio.dp.onehead.SingleDP.update(SingleDP.java:49)
> > > >         at org.biojava.bio.dp.DP.<init>(DP.java:377)
> > > >         at
> >
> org.biojava.bio.dp.onehead.SingleDP.<init>(SingleDP.java:41)
> > > >         at
> > > >
> >
> org.biojava.bio.dp.DPFactory$DefaultFactory.createDP(DPFactory
> > > .java:53)
> > > >         at T_Zscore.main(T_Zscore.java:64)
> > > >
> > > >     How can I fix my code?
> > > >
> > > > Thank
> > > > Tisanai
> > > >
> > > > _______________________________________________
> > > > Biojava-l mailing list  -  [EMAIL PROTECTED] 
> > > > 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.
> > >
> >
> ==============================================================
> =========
> > 
> > _______________________________________________
> > Biojava-l mailing list  -  [EMAIL PROTECTED] 
> > http://biojava.org/mailman/listinfo/biojava-l
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts 
> http://uk.my.yahoo.com >
_______________________________________________
> Biojava-l mailing list  -  [EMAIL PROTECTED] 
> 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.
=======================================================================
_______________________________________________
Biojava-l mailing list  -  [EMAIL PROTECTED]
http://biojava.org/mailman/listinfo/biojava-l

[Biojava-l] Re: Biojava-l digest, Vol 1 #776 - 5 msgs Lachlan Coin 





More information about the Biojava-l mailing list