[BioRuby] Bioruby HTML output

Toshiaki Katayama ktym at hgc.jp
Thu Jan 21 14:05:42 UTC 2010


Dear Pj,

I looked your code and had a feeling that we should use some template system.
If HTML tags are hard coded in the library as you did, it will be very hard to modify them by the user.

Besides, what version of the HTML specification did you have in mind?
This is my first time to see the <p> tag is used in the form of <p />. Is it valid?
I also think decorations should be separated to the CSS layer and you should avoid to use the <font> tag, especially when you are trying to distribute your code as a part of the library.


As for the file location, I still like the way Naohisa has suggested.
Although, I'm not sure the internal node 'output/html' is necessary for 'bio/alignment/output/html/alignment.rb'.
Anyway, we need to try every approach to learn pros and cons.

With your proposal, we may have a tree like this:

--------------------------------------------------
for bio/alignment.rb and bio/db/kegg/compound.rb and bio/db/genbank.rb ...

bio/output/html/html_alignment.rb (Bio::Html::Alignment)
bio/output/html/html_kegg_compound.rb (Bio::Html::KEGG::COMPOUND)
bio/output/html/html_genbank.rb  (Bio::Html::GenBank)
 :

bio/output/rdf/rdf_kegg_compound.rb (Bio::RDF::KEGG::COMPOUND)
bio/output/rdf/rdf_genbank.rb (Bio::RDF::GenBank)
 :

bio/output/fasta/fasta_genbank.rb (Bio::FASTA::GenBank)
bio/output/fasta/fasta_kegg_genes.rb (Bio::FASTA::KEGG::GENES)
 :

bio/output/gff/gff_genbank.rb (Bio::GFF::GenBank)
 :
--------------------------------------------------

apparently, the class names for output formats conflict with existing classes (e.g. Bio::FASTA, Bio::GFF) and we need to look into each sub directories to find which output format is supported for a particular database.


If we gather templates of output formats along with the database classes:

--------------------------------------------------
for bio/alignment.rb:
bio/alignment/alignment.html.erb
 :

for bio/db/kegg/compound.rb:
bio/db/kegg/compound/compound.rdf.erb
bio/db/kegg/compound/compound.tut.erb
bio/db/kegg/compound/compound.html.erb
 :

for bio/db/genbank.rb:
bio/db/genbank/genbank.rdf.erb
bio/db/genbank/genbank.gff.erb
bio/db/genbank/genbank.html.erb
bio/db/genbank/genbank.fasta.erb
 :
--------------------------------------------------

However, this is still a desk plan and we need to try more (we already started for RDF).

Toshiaki


On 2010/01/20, at 16:36, Pjotr Prins wrote:

> Dear Toshiaki,
> 
> On Wed, Jan 20, 2010 at 01:21:54AM +0900, Toshiaki Katayama wrote:
>>> I really would like all HTML to be in one sub-tree. Also XML, RDF and
>>> whatnot. When it is 'business' logic it should be in database. When it
>>> is output transformations it is not 'business' logic any longer.
>> 
>> I'm not sure about HTML but FASTA and RDF, for example, are tightly
>> related to the original database format/contents. So, I proposed
>> to have methods to generate formatted string in each database class.
>> 
>> There can be many ways to design OO class trees and to find the best
>> way to represent/abstract things is always a difficult task.
> 
> I wrote a nice alignment HTML output generator. Which also displays PAML
> output. Currently it is in bio/output/html/htmlalignment.rb and the
> class is named Bio::Html::Alignment. 
> 
> For the current Bioruby, where do you want to put that? I don't feel
> it should be cluttering alignment.rb. Naohisa has suggested
> bio/alignment/output/html/alignment.rb instead. I feel uncomfortable
> with this. But it is kinda consistent with above, tightly relating it
> to the alignment object.
> 
> What do you think of the class name?
> 
> The code is in my color-alignment branch, see
> 
>  http://github.com/pjotrp/bioruby/tree/color-alignment
> 
> Is anyone else interested in this type of discussion? We can take it
> off-list.
> 
> Pj.





More information about the BioRuby mailing list