Remove format_blast_results method and code for custom hit hyperlinks.

These were outdated by recent changes, SHA: d377d3bc in particular. Custom hit
hyperlinks will be back. format_blast_results isn't needed anymore.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Remove to_fasta.

to_fasta was meant to add a def line to query sequence, if missing; and
uniquify query sequence ids by appending a number to duplicates.

Older versions of BLAST+ used to crash if query didn't have def line. BLAST+
2.2.25 (SequenceServer's minimum requirement) and higher handle missing def
line in query sequence gracefully. Thus adding def line to the query isn't
needed anymore.

Uniquification of query sequence ids came as a fix for #109. However, recent
changes (SHA: d377d3bc in particular ) obsoletes the fix. BLAST+ internally
numbers the query sequences 1, 2, 3, ..., n. Numbering done by BLAST+ is
available in XML output, on which our HTML result is now based. We use the
numbering done by BLAST+ to created unique HTML ids and thus index doesn't fail
anymore.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Lessen clutter in BLAST results.

* Use padding instead of boxes to lend structure to the content.
* Databases searched is now shown for each query. This my change further.
* Index of hits (SHA: 9c8d0229) adds limited value but introduces
  several complications. We will revert to tabular view of hits as before.

Unrelated: Refactored custom.css as it made the job easy.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Apply error class around query sequence textarea.

Had broken in SHA: 5ca85a2a.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Regression: Pre-select if only one database present.

Looks like this was broken for a very long time (SHA: db9f3dfc).

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Graphical overview of blast hits.

This patch adds the graphical overview feature to SequenseServer,
thereby allowing easy inspection of query hits and navigation. The
design is inspired by NCBI's Blast page and further improved upon for
better clarity.

 * A color gradient is used to indicate the importance of hits obtained.
 * Query sequence shown on top in thin red bar to indicate scale.
 * Hits are sorted and displayed according to increasing evalues.

...

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Adding strandedness of hits using arrow caps.

We add the strandedness of hits based on the value obtained from hframe.

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Can handle more than one hsp per hit.

* This patch fixes the earlier loophole which showed only one HSP per hit
  query.
* A critical bug causing only one query to show up in case of
  multi query blast with similar ID's was fixed.
* result.erb now incorporates the changes required to show multiple hsps
  per hit. However, a little formatting fixes might occur later.

[ap: re-indent to two spaces instead of four]

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Resinstate tabular view of alignments

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Removed extra decimal digits in E value

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Moved total score and min evalue computation to blast.rb

[ap: indentation fixes]

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Can show multiple HSP(s) in overview graph.

* Changes to blast.rb which carry out the conversion of parsed strings
  suitable number formats. Removes to_i kind of code for result.erb.
* Can now display all HSP(s) per hit in overview graphic. The color for
  HSP(s) remain same, and we follow the same gradient display scheme as
  before.

[ap: indentation fixes]

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Revert: Accession no, Remove: defline from tabular view.

Also, changed the display color of hits to follow grey gradient than
blue. Legend/Key is now well spaced from other hit boxes. Arrow caps
are functional as before, though not very pretty in cases when hsps are
very close.

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
Change semantics of the BLAST wrapper.

SequenceServer::Blast is now a module meant to be mixed with
SequenceServer::App.

Do BLAST param validation in blast.rb.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Request user to report 500 errors to admin or forum; remove not_found handler.

Any runtime error unless specifically handled is trapped as internal server
error (500) by SS and shown to the user with the full backtrace, requesting
them to report it to the admin of the SS installation or the public forum.

Removed not_found handler since it depended on 500.erb which I tweaked
specifically for 500 (internal server) errors. Sinatra, in production, shows a
page with heading (and only a heading) "No Found" for 404 errors which is
almost as good as what we previously had. We can install a more helpful 400
page later.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Inform users about network and server timeout errors.

Timeout or network errors previously appeared to the user as "a flicker of
spinner followed by no results or an empty modal", leaving them to figure
out for themselves what exactly happened. Not good.

Detecting timeout errors is tricky. We can be sure that the response will be
empty if server timed-out. But empty response can be caused due to myriad of
network issues.

So we check for empty response and notify users that either the server timed
out (and hence she should contact admin), or there's a temporary network issue
(and hence she should try again later). As a laster resort, the user should
seek help on the forum.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Round off bit score during display.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Pretty print evalue and right align numbers in tabular view.

Numbers look better when right aligned.

TODO: extract into formatting of evalue into a helper function.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Re-instate sequence retrieval.

We provide a link to FASTA for each hit like before. But we don't provide a
link to FASTA for all hits like before. Instead, we provide a link to FASTA
of all hits per query now.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Send Blast::Report instance to result.erb.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>