summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2015-03-10 16:58:49 +0100
committergebele <gebele@in-silico.ch>2015-03-10 16:58:49 +0100
commit12002a6390b10c3c12462936484ba967da2478e4 (patch)
treef8d7ef0f8253a11a5232a5d0a3823e548e3ccbe7
parent941ef6c04f98195a571920f2daf66b41a763ff22 (diff)
marked links >;resize body if large table;setup sdf
-rw-r--r--application.rb25
-rw-r--r--views/neighbors.haml4
-rw-r--r--views/predict.haml23
-rw-r--r--views/prediction.haml15
-rw-r--r--views/style.scss6
5 files changed, 53 insertions, 20 deletions
diff --git a/application.rb b/application.rb
index 981ee0b..360db1d 100644
--- a/application.rb
+++ b/application.rb
@@ -49,7 +49,30 @@ get '/prediction/:neighbor/details/?' do
haml :details, :layout => false
end
-
+=begin
+# sdf representation for datasets
+#TODO fix 502 errors from compound service
+get '/predict/:dataset_uri/sdf/?' do
+ uri = CGI.unescape(params[:dataset_uri])
+ $logger.debug uri
+ bad_request_error "Not a dataset uri." unless URI.dataset? uri
+ dataset = OpenTox::Dataset.find uri
+ @compounds = dataset.compounds
+ @data_entries = dataset.data_entries
+ sum=""
+ @compounds.each_with_index{ |c, idx|
+ sum << c.inchi
+ sum << c.sdf.sub(/\n\$\$\$\$/,'')
+ @data_entries[idx].each{ |f,v|
+ sum << "> <\"#{f}\">\n"
+ sum << v.join(", ")
+ sum << "\n\n"
+ }
+ sum << "$$$$\n"
+ }
+ send_file sum, :filename => "#{dataset.title}.sdf"
+end
+=end
# fingerprints for compound in predictions
get '/prediction/:model_uri/:type/:compound_uri/fingerprints/?' do
@type = params[:type]
diff --git a/views/neighbors.haml b/views/neighbors.haml
index 603f920..33ea688 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -98,7 +98,7 @@
%tr
%td.compound
%a{:href => to("/prediction/#{CGI.escape(neighbor_compound.uri)}/details"), :id=>"link#{count_rs}#{count}", :target=>"details"}
- Names and synonymes
+ Names and synonymes >
%img{:src=>"#{neighbor_compound.uri}/image", :alt=>"Compound image not available", :title=>"#{neighbor_compound.smiles}", :width=>"150px"}
%td
- if c.class == String
@@ -110,7 +110,7 @@
%td
- if @type =~ /classification/i
- if p.data_entries[count][3] != nil
- %a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@type}/#{CGI.escape(neighbor_compound.uri)}/significant_fragments"), :id=>"link#{count_rs}#{count}sf", :target=>"details"} Significant fragments
+ %a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@type}/#{CGI.escape(neighbor_compound.uri)}/significant_fragments"), :id=>"link#{count_rs}#{count}sf", :target=>"details"} Significant fragments >
- if @type =~ /regression/i
- if p.data_entries[count][3] != nil
%a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@type}/#{CGI.escape(neighbor_compound.uri)}/significant_fragments"), :id=>"link#{count_rs}#{count}sf", :target=>"details"} Descriptors
diff --git a/views/predict.haml b/views/predict.haml
index bed0837..b37d6ab 100644
--- a/views/predict.haml
+++ b/views/predict.haml
@@ -14,9 +14,9 @@
function checksmiles () {
if (document.form.identifier.value == "") {
alert("Please draw or insert a chemical structure.");
- //$("img.circle").hide();
+ $("img.circle").hide();
document.form.identifier.focus();
- $('#progressBar').hide();
+ //$('#progressBar').hide();
return false;
};
return true;
@@ -30,8 +30,8 @@
});
if (checked == false){
alert("Please select an endpoint.");
- //$("img.circle").hide();
- $('#progressBar').hide();
+ $("img.circle").hide();
+ //$('#progressBar').hide();
return false;
};
return true;
@@ -48,9 +48,9 @@
document.form.identifier.value = document.JME.smiles() ;
};
};
- //function showcircle(){
- //$("img.circle").show();
- //};
+ function showcircle(){
+ $("img.circle").show();
+ };
// whole site content needs to be in one form. Input and checkboxes are proofed by js functions.
%form{:name => "form", :action => to('/predict'), :method => "post", :enctype => "multipart/form-data", :onsubmit => "return !!(checksmiles() & checkboxes())" }
@@ -130,10 +130,12 @@
%br
%p{:style=>"display:inline"}= "Feature Dataset: "
%a{:href=>"#{to("/predict/#{CGI.escape(model[RDF::OT.featureDataset])}")}", :title=>"download"} rdf
+ -#%a{:href=>"#{to("/predict/#{CGI.escape(model[RDF::OT.featureDataset])}")}/sdf", :title=>"download"} sdf
%br
%br
%p{:style=>"display:inline"}= "Training Dataset: "
%a{:href=>"#{to("/predict/#{CGI.escape(model[RDF::OT.trainingDataset])}")}", :title=>"link opens in new window."} rdf
+ -#%a{:href=>"#{to("/predict/#{CGI.escape(model[RDF::OT.trainingDataset])}/sdf")}", :title=>"link opens in new window."} sdf
%br
- unless model.metadata[RDF::OT.crossValidation].nil?
%h3 Validation:
@@ -153,8 +155,9 @@
%h1
3. Predict
%td{:style=>"width:10%;align:center;valign:middle;"}
- %input{ :type => "submit", :id => "submit", :value=>">>", :onclick => "(progress(1,$('#progressBar')) & getsmiles() & checkboxes())", :style=>"cursor: pointer;display:inline;width:50px;height:50px;border-radius: 50%;color:#2b2b2b;text-align:center;text-decoration:none;background:#f76700;box-shadow: 0 0 5px white;font-weight:bold;"}
+ %input{ :type => "submit", :id => "submit", :value=>">>", :onclick => "(showcircle() & getsmiles() & checkboxes())", :style=>"cursor: pointer;display:inline;width:50px;height:50px;border-radius: 50%;color:#2b2b2b;text-align:center;text-decoration:none;background:#f76700;box-shadow: 0 0 5px white;font-weight:bold;"}
%td{:style=>"align:center;valign:middle;"}
- #progressBar{:style=>"width: 400px;height: 22px;border:1px solid #2b2b2b;background-color:gray;display:none;"}
- #bar{:style =>"width:0;height: 100%;color: #fff;text-align: right;line-height: 22px;background-color: #0099ff;"}
+ %img{:src=>"/images/wait30trans.gif", :class=>"circle", :style=>"display:none;background-color:white;margin-left:10%;border:solid 1px;vertical-align:middle;"}
+ -##progressBar{:style=>"width: 400px;height: 22px;border:1px solid #2b2b2b;background-color:gray;display:none;"}
+ -##bar{:style =>"width:0;height: 100%;color: #fff;text-align: right;line-height: 22px;background-color: #0099ff;"}
diff --git a/views/prediction.haml b/views/prediction.haml
index 0bd0ea9..99b7527 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -1,3 +1,10 @@
+:javascript
+ // increase body width if more than 2 models selected
+ window.onload = function(){
+ var plusSize = ("#{@predictions.size}" > 2 ) ? ("#{@predictions.size}" * 100) : 0;
+ var width = $(window).width() + plusSize;
+ $("body").width(width);
+ };
.predictions
.back
%h1
@@ -14,9 +21,9 @@
%tbody
%tr
- %td{:id=>"compound", :style=>"width: 200px;vertical-align:top;"}
+ %td{:id=>"compound", :style=>"vertical-align:top;"}
%a{:href => to("/prediction/#{CGI.escape(@compound.uri)}/details"), :id=>"linkCompound", :target=>"details_overview"}
- Names and synonyms
+ Names and synonyms >
%img{:src=>"#{@compound.uri}/image", :alt=>"Compound image not available", :title=>"#{@compound.smiles}", :width=>"150", :height=>"150"}
%p
:javascript
@@ -118,7 +125,7 @@
/TODO add tooltip for significant ftagments and descriptors
- if @model_type[count] =~ /classification/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0)
/ Significant fragments:
- %a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[count]}/#{CGI.escape(@compound.uri)}/fingerprints"), :id=>"linkPredictionSf", :title=>"", :target=>"details_overview"}Significant fragments
+ %a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[count]}/#{CGI.escape(@compound.uri)}/fingerprints"), :id=>"linkPredictionSf", :title=>"", :target=>"details_overview"}Significant fragments >
:javascript
$(function() {
$("a#linkPredictionSf").on('click', function(e) {
@@ -137,7 +144,7 @@
%p
- if c != ''
%a{:href=> "#tabs", :id=>"link#{count}"}
- %b Neighbors
+ %b Neighbors >
:javascript
$("a#link#{count}").click(function () {
$(".results").show();
diff --git a/views/style.scss b/views/style.scss
index a068ab1..4021d1f 100644
--- a/views/style.scss
+++ b/views/style.scss
@@ -105,8 +105,8 @@ body {
border: 1px solid #dad9c7;
padding-left: 1em;
padding-top: 0.5em; }
- .content .overview #overview tr td #compound {
- width: 200px; }
+ .content .overview #overview tr td#compound {
+ width: 250px; }
.content .overview #overview tr td b.c {
color: #d42200; }
.content .overview #overview tr td b.n {
@@ -207,7 +207,7 @@ body {
box-shadow: (1px 1px 1px rgba(white, 1) inset, -1px -1px 5px rgba($black, 0.3) inset);
padding-left: 1em; }
.results .tablesorter tbody .compound {
- width: 200px;
+ width: 250px;
padding: 0.2em; }
.results .tablesorter tbody .n {
color: #5c8533; }