[Biojava-dev] Pairwise Alignment methods

Mark Schreiber markjschreiber at gmail.com
Fri Jan 25 03:43:30 UTC 2008


On Jan 25, 2008 10:06 AM, Felipe Albrecht <felipe.albrecht at gmail.com> wrote:
> Hi,
>
> is not possible to add into the SequenceAlignment interface something like:
> "double doAlignmentAndGetTheScore(SymbolList symbolList1, SymbolList
> symbolList2)"?
> Okay, the name is horrible, but you know what it means.
>

You could but you would break backwards compatibility with anyone who
implemented this interface previously.  We have sometimes done this in
biojava but we would need to make sure it will break no ones code.
Another option would be to extend the interface with another that adds
this method (not very tidy I know).

>
> > While ultra optimized algorithms where once a major
> > feature of bioinformatics this is becoming less necessary as standard
> > desktops are now equivalent to the super computers of 5 years ago.
>
> Okay, but do not forget that the bioinformatics data size is growing faster
> than the computer processing and main memory capacity.
>
> What im trying to say is that the actual methods are fast [and light] enough
> for do 1, 10, 100, 1000 pairwise alignments, but not for 10k, 100k or in my
> case, 65k * 65k.

One could also argue that Smith Waterman is not ideal for large
sequences. I think it is o(NM) or something.

> Really, I dont see problems of having optimized functions for specifics
> operations, as unix phylosofies: "do small programs for specifics things,
> for big things join then" (Something like it :-) ).
>

Yes, this would be an argument for workflow or service oriented
architecture built from multiple inter operable biojava sub-projects.
This is obviously not what biojava is. Indeed biojava is not even an
application you just use it to build applications. Maybe for your use
case you could use biojava to handle the I/O and then do the more
efficient SW using your own code. BioJava is a collection of objects
that are (somewhat) related and interoperable. It doesn't mean you
have to use biojava throughout your application.

- Mark

> On Jan 24, 2008 11:26 PM, Mark Schreiber <markjschreiber at gmail.com> wrote:
> > Hi Felipe -
> >
> > I agree your method is more efficient but I think it violates the
> > SequenceAlignment interface which would cause compatibility problems.
> > I also wonder what should happen if a user calls the getAlignment()
> > method if you have only calculated a score.
> >
> > instanceof is potentially expensive but it is nothing compared to
> > actually performing the SmithWaterman.
> >
> > Biojava is somewhat memory heavy but this is largely because it is
> > object oriented. Certainly something in C would be lighter and faster
> > but the whole point in using Java is the relative benefits of object
> > oriented design.  While ultra optimized algorithms where once a major
> > feature of bioinformatics this is becoming less necessary as standard
> > desktops are now equivalent to the super computers of 5 years ago.
> >
> > I actually find the SW and NW to be reasonably fast. This is because
> > all the heavy lifting is done in loops that the JVM presumably
> > compiles and executes natively.
> >
> > - Mark
> >
> >
> >
> >
> >
> > On Jan 25, 2008 3:40 AM, Felipe Albrecht <felipe.albrecht at gmail.com >
> wrote:
> > > Hello,
> > >
> > > I saw the commit and I think that this solution is not the better.
> > > I think it because you are creating internally two Sequence and probably
> the
> > > programmer will not use others alignment information,  he will use only
> the
> > > score.
> > >
> > > Because it, I think that if you have 2 SymbolList, just do the alignment
> and
> > > return the score, as I did.Otherwise, If the programmer want the "visual
> > > alignment", he should create externally the SimpleSequences, it is, not
> the
> > > method must do it.
> > >
> > > IMHO, one [serious] problem in biojava is the memory consumption, it
> have
> > > not "lightweight" classes or methods that do the things quickly. Because
> it,
> > > may be is a good choice to have a method that simply gives the alignment
> > > score, and not do the others things, like backtracking. Another think,
> the
> > > cost of the "instanceof" is high.
> > >
> > > Thank you,
> > >
> > > Felipe Albrecht
> > >
> > >
> > >
> > >
> > > On Jan 24, 2008 11:35 AM, Mark Schreiber <markjschreiber at gmail.com>
> wrote:
> > > > Hi -
> > > >
> > > > I have just commited changes that let you use SymbolLists in all parts
> > > > of the NW and SW SequenceAlignment objects.
> > > >
> > > > As you suggested I made the matrix a method local variable. I also
> > > > removed calls to the garbage collector.
> > > >
> > > > This can be checked out from SVN.
> > > >
> > > > - Mark
> > > >
> > > >
> > > >
> > > >
> > > > On Jan 24, 2008 9:05 PM, Felipe Albrecht <felipe.albrecht at gmail.com >
> > > wrote:
> > > > > If you prefer, I can send a diff and should I do the same thing in
> > > > > SequenceAlignment and NeedlemanWunsch classes?
> > > > >
> > > > > Thank  you,
> > > > >
> > > > > Felipe Albrecht
> > > > >
> > > > >
> > > > >
> > > > > On Jan 24, 2008 5:50 AM, Mark Schreiber < markjschreiber at gmail.com >
> > > wrote:
> > > > > > Hi Felipe -
> > > > > >
> > > > > > Thanks for the input on this. As a general rule the GC should
> never be
> > > > > > called from code. Generally this degrades performance of the JVM.
> > > > > > Unless there is a very good reason I will remove this. Probably
> you
> > > > > > are right a method parameter may work better.
> > > > > >
> > > > > > - Mark
> > > > > >
> > > > > > On Jan 24, 2008 1:47 PM, Felipe Albrecht
> <felipe.albrecht at gmail.com>
> > > > > wrote:
> > > > > > > Hello,
> > > > > >
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > I think that it can be solved by a simple way:
> > > > > > > Implement (or just copy and cut) a pairwiseAlignment utilizing
> > > SymboList
> > > > > as
> > > > > > > parameters and do no creating a alignment, just the calculating
> it
> > > and
> > > > > > > returning the value.
> > > > > > >
> > > > > > > Another thing that is a bit stange for me, is the utilization of
> > > garbage
> > > > > > > collector direcly, that is: The field "scoreMatrix" is a class
> > > field,
> > > > > why at
> > > > > > > the end of pairwiseAlignment it is set to null and the garbage
> > > collector
> > > > > > > run? It is not better (and simpler) to use scoreMatrix as method
> > > > > variable?
> > > > > > >
> > > > > > > I'm annexing the class code with my changes that is doing well
> the
> > > (4^8)
> > > > > *
> > > > > > > (4^8) SymbolList pairwise alignments that I am needing :-)
> > > > > > >
> > > > > > > Thank you,
> > > > > > >
> > > > > > > Felipe Albrecht
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >  On Jan 23, 2008 6:50 AM, Mark Schreiber <
> markjschreiber at gmail.com
> > > >
> > > > > wrote:
> > > > > > > > Hi Felipe -
> > > > > > > >
> > > > > > > > I agree this is a barrier to ease of use. Even if Sequences
> are
> > > > > > > > required internally for some obscure reason there is no reason
> why
> > > > > > > > dummy Sequences cannot be made inside the aligner.  These
> > > sequences
> > > > > > > > could be given names like 'query' and 'subject' or even 'seq1'
> and
> > > > > > > > 'seq2'.
> > > > > > > >
> > > > > > > > I will take a look at adding some methods.
> > > > > > > >
> > > > > > > > Best regards,
> > > > > > > >
> > > > > > > > - Mark
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Jan 23, 2008 2:58 PM, Felipe Albrecht
> > > <felipe.albrecht at gmail.com >
> > > > > > > wrote:
> > > > > > > > > Hello all,
> > > > > > > > >
> > > > > > > > > I have a simple question about pairwise alignment classes
> > > > > (SmithWaterman
> > > > > > > and
> > > > > > > > > NeedlemanWunsch):
> > > > > > > > > Why it is necessary two Sequence for alignment and not two
> > > > > SymbolList?
> > > > > > > > >
> > > > > > > > > Example, I have a SymbolList collection to align between
> then,
> > > > > > > > > by this way I need to create some "dummies"  Sequence for to
> do
> > > the
> > > > > > > > > alignment.
> > > > > > > > >
> > > > > > > > > Reading the source, I saw that the unique field that is
> > > exclusive to
> > > > > > > > > Sequence is the name, for the alignment output,
> > > > > > > > > but if I need only the alignment result, it is useless.
> > > > > > > > >
> > > > > > > > > It is not possible to override the pairwiseAlignment to
> accept
> > > > > > > SymbolList or
> > > > > > > > > may be a new method that the parameters are 2 SymbolList and
> > > returns
> > > > > the
> > > > > > > > > alignment score?
> > > > > > > > >
> > > > > > > > > Thank you
> > > > > > > > >
> > > > > > > > > Felipe Albrecht
> > > > > > > > > _______________________________________________
> > > > > > > > > biojava-dev mailing list
> > > > > > > > > biojava-dev at lists.open-bio.org
> > > > > > > > > http://lists.open-bio.org/mailman/listinfo/biojava-dev
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>



More information about the biojava-dev mailing list