[Biojava-l] Multiple Sequence Alignment Viewer
Kalle Näslund
kalle.naslund at genpat.uu.se
Thu May 8 12:21:34 EDT 2003
Nathan Whitehouse wrote:
>Dear all,
>
> I've used biojava on and off for some time, and I've
>always found it useful.
>
> I'm not sure how to proceed with my current problem,
>though I'm sure someone has done it already.
>
> I basically need a way to visualize a set of
>sequences which need to be aligned.
>
> Can anybody point me in the right direction on this?
> Is there an easy tool to visualize multiple
>alignments?
>
>
Hi!
Biojava can render alignments, its just that its not immediately obvious
how =P
The "simple" approach is to take the Sequences you want to render, and
insert
them into a SimpleAlignment object. The next step is to take a
TranslatedSequencePanel
and connect your Alignment to it.
What you need to do next is to setup the renderers that will render your
alignment.
Start with a MultiLineRenderer. To the MultiLineRenderer you connect one
AlignmentRenderer
for each sequence in the alignment. Each AlignmentRenderer should have
the label of the sequence
it should render set on it. And in the end you connect a
SymbolSequenceRenderer to each
AlignmentRenderer. So, for an Alignment with three sequences,labeled
seq1,seq2 and seq3,
the renderer tree would look like this.
AlignmentRenderer --- SymbolSequenceRenderer
/ label=labelForSeq1
/
/
MultilineRenderer --- AlignmentRenderer --- SymbolSequenceRenderer
\ label=labelForSeq2
\
\
AlignmentRenderer --- SymbolSequenceRenderer
label=labelForSeq3
( notice that you can reuse the SymbolSequenceRenderer and dont need
three separate
classes, you can just attach the same Instance to each of the
AlignmentRenderers.
This is the prefered way if you want all sequences to be rendered the
same way )
And this setup will give you a basic multiple alignment renderer.
BUT ! If you try this, it will fail, and it will fail because none of
the Sequence
rendering components in biojava can render SymbolLists ( and in bj an
Alignment is a
SymbolList ), they all render only Sequence objects. there are two
solutions to this
that i can come upp with.
The first solution is to modify TranslatedSequencePanel to accept
SymbolLists
( this is a very easy thing to do, it only requires a few lines of code
to be
changed, i have done this, and if you find it hard, i cand send you a
diff of my changes ).
The alternative, witch i havent tried, but i think should work, atleast
in theory, is to just
create a Sequence, with your Alignment as the SymbolList. And then feed
it to the
TranslatedSequencePanel.
mvh Kalle
More information about the Biojava-l
mailing list