[BioRuby] Bioruby HTML output
Pjotr Prins
pjotr.public14 at thebird.nl
Sat Jan 16 08:30:41 UTC 2010
On Sat, Jan 16, 2010 at 02:36:02PM +0900, Tomoaki NISHIYAMA wrote:
> > I am going to add a 'master' switch for escaping of HTML. The default
> > will be with escaping.
>
> How do you think to test if the object responds to to_html
> and then call to_html else pass to escapeHTML.
In this case the object to convert to HTML is a String and part of
Bio::Alignment. Later implementations of Bio::Alignment could use a
Bio::Sequence.id (or something Naohisa wrote me). It would mean we
would have to create a Bio::Sequence::Descriptor object, which would
contain several specialistic 'output' generators.
This is a recurrent idea we need to discuss.
I think *all* HTML based stuff should be in its own objects - and its
own tree (I have created bio/output/html for that purpose).
I think it is a bad idea to clutter regular BioRuby code with HTML
specific stuff. Likewise for other outputs, as you pointed out, like
plotting. Output should live in
bio/lib/output/html
bio/lib/output/plot
bio/lib/output/gtk
bio/lib/output/rails (perhaps)
(etc)
that way display code never pollutes the simple Bio::Sequence object,
for example. You'll get Bio::Html::Sequence for that - or my
preferred naming Bio::HtmlSequence.
Now if Bio::HtmlSequence could be plugged into Bio::Alignment - the
latter would not care - and we could adapt the HtmlSequence info to
show embedded hrefs.
That would be the proper way to handle it. No testing of methods
(like to_html), but use the object structure to define what is
supported (and not).
Until we implement that (get Bio::Alignment to support arbitrary
Sequence objects) I think the master switch is fine. I have updated
my branch. Default behaviour is escaping. If a user (like me) wants
it otherwise, it is allowed.
Pj.
More information about the BioRuby
mailing list