diff --git a/src/couchapp/secreton/templates/Copy of secretion_system.html b/src/couchapp/secreton/templates/Copy of secretion_system.html deleted file mode 100644 index 7ed1b56279691e8edec8257645908f6b0fef6838..0000000000000000000000000000000000000000 --- a/src/couchapp/secreton/templates/Copy of secretion_system.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - secretion system {{code}} - - - - - - - -

Secretion system {{code}}

- -

Replicon

- -
-
-

Genes

- - - - - - - - - - - {{#genes}} - - - - - - - {{/genes}} - -
Gene-codeGene-IdProtein-lengthStrandBeginEndMatchFull-scoreE-valueBest-domain-scoreBest-domain-evalueC-valueCoverage-profileMatch-beginMatch-end
{{code}}{{id}}{{protein_length}}{{strand}}{{begin}}{{end}}{{match}}{{full_score}}{{e_value}}{{best_domain_score}}{{best_domain_evalue}}{{c_value}}{{coverage_profile}}{{match_begin}}{{match_end}}
- - - - \ No newline at end of file diff --git a/src/couchapp/secreton/templates/secretion_system.html b/src/couchapp/secreton/templates/secretion_system.html index a2c0b86cceec3736d4a0d7d2a5c6f87d959051ee..f5571e271801cb100bab80de16f3d88b8e6cfc69 100644 --- a/src/couchapp/secreton/templates/secretion_system.html +++ b/src/couchapp/secreton/templates/secretion_system.html @@ -2,7 +2,7 @@ secretion system {{code}} - + @@ -16,209 +16,232 @@ $.couch.db(dbname).openDoc( docID, { success:function( doc ) { - var min = doc.genes[0].begin ; - var max = 0; - for( var i = 0 ;imax){max = end;} - } - var paper_w= $("#genes_schema").width(); - var paper_h= 250; - var genome_offset= 45; - var genes_offset= 10; - var coef= (paper_w - (genome_offset+genes_offset)*2 )/(max - min); - var genome_orig= min; - var Y_genome= 55 ; - - Raphael.fn.draw_genome = function(){ - var genome_l = paper_w -(2* genome_offset); - return this.path( ["M", genome_offset , Y_genome, "h", genome_l ,"a25,5 -1 0,1 0,5h",(-1*(genome_l)),"a25,5 0 0,1 0,-5z" ]).attr({fill: "#aaa", stroke:"#aaa", "stroke-width":"1"} ); - }; - - var Gene = function Gene( gene_info ){ - var g_arrow = paper.draw_gene(gene_info); - this.arrow = g_arrow[0]; - this.popup = paper.draw_gene_popup( g_arrow[1] , g_arrow[2] , gene_info); - this.arrow.mouseover( gene_show.bind(this)); - this.arrow.mouseout( gene_hide.bind(this) ); - this.zoom = gene_zoom; - this.translate = gene_translate; - }; - - Raphael.fn.draw_gene_popup = function( start, stop, gene_info ){ - var popup = this.set(); - var label = this.set(); - var txt = {font: '12px Helvetica, Arial', fill: "#fff"}; - var title = {font: '12px Helvetica, Arial', fill: "#aaf"}; - label.push(this.text(60, 12, "gene id: "+gene_info.id ).attr(title)); - label.push(this.text(60, 27, "begin: "+gene_info.begin ).attr(txt)); - label.push(this.text(60, 42, "end: "+gene_info.end ).attr(txt)); - label.hide(); - popup.push( label ); - var frame = this.popup( start +( (stop -start)/2 ) , 100, label , "bottom").attr({fill: "#000", stroke: "#666", "stroke-width": 2, "fill-opacity": .7}); - frame.hide(); - popup.push( frame ); - return popup; - }; - - Raphael.fn.draw_gene = function( gene_info ){ - var arrow_beg = Math.round((gene_info.begin - genome_orig)*coef)+genome_offset+genes_offset; - var arrow_end = Math.round((gene_info.end - genome_orig)*coef)+genome_offset+genes_offset; - var bd_l = Math.round((arrow_end - arrow_beg)*3/5); - var hd_l = Math.round((arrow_end - arrow_beg)*2/5); - var arrow ; - if( gene_info.strand =='D' ){ - arrow = this.path( ["M", arrow_beg, Y_genome-28, "m0 20h", bd_l, "v-20l", hd_l, " 30l", (-1*hd_l),"30v-20h",(-1*bd_l),"z"]); - }else{ - arrow = this.path( ["M", arrow_beg, Y_genome-28, "m0 30l",hd_l, "-30v20h", bd_l, "v20h", (-1*bd_l),"v20z"]); - } - if(!gene_info.match){ - arrow.attr({fill: "white", stroke: "black", "stroke-dasharray": "-", "fill-opacity": 0.5}); - }else{ - var color=$( ".gene_"+gene_info.match).css( "backgroundColor" ); - arrow.attr({fill: color, stroke: "none", "stroke-dasharray": "-", "fill-opacity": 0.9}); - } - return [arrow , arrow_beg ,arrow_end ]; - }; - - function gene_zoom( factor , ori ){ - var bf_box = this.arrow.getBBox(); - this.arrow.scale( factor, 1 , ori ,Y_genome ); - var af_box = this.arrow.getBBox(); - this.popup.translate( (af_box.x+(af_box.width/2 )) - (bf_box.x+(bf_box.width /2 )) , 0); - }; - function gene_translate( dx , dy ){ - var bf_box = this.arrow.getBBox(false); - this.arrow.translate( dx , dy ); - var af_box = this.arrow.getBBox(false); - this.popup.translate((af_box.x + (af_box.width /2 )) - (bf_box.x + (bf_box.width /2 )) , (af_box.y-bf_box.y)); - }; - function gene_show(){ - this.popup.show(); - }; - function gene_hide(){ - this.popup.hide(); - }; - - Raphael.fn.control = function( x , y , genes , genome ){ - var west= this.path( ["M", x-40, y]+ "l20 -12 a70, 40 0 0,0 0, 24z").attr({fill:"blue"});//West - west.mousedown( function(){ - for(var i = 0 ;i 0){ - intOverallDelta++; - genome.scale( 1.25, 1 , objEvent.pageX ,Y_genome ); - for(var i = 0 ;imax){max = end;} + all_protein_length = all_protein_length + doc.genes[i].protein_length + } + var paper_w= $("#genes_schema").width(); + var paper_h= 250; + var genome_offset= 45; + var genes_offset= 10; + var inter_gene = 50; + if( max == 0){ + min = 0; + max = all_protein_length + (( doc.genes.length -1) * inter_gene ); + } + var coef= (paper_w - (genome_offset+genes_offset)*2 )/(max - min); + var genome_orig= min; + var Y_genome= 55 ; + Raphael.fn.draw_genome = function(){ + var genome_l = paper_w -(2* genome_offset); + return this.path( ["M", genome_offset , Y_genome, "h", genome_l ,"a25,5 -1 0,1 0,5h",(-1*(genome_l)),"a25,5 0 0,1 0,-5z" ]).attr({fill: "#aaa", stroke:"#aaa", "stroke-width":"1"} ); + }; + + var Gene = function Gene( gene_info , previous_gene ){ + if (gene_info.begin){ + this.begin = gene_info.begin; + this.end= gene_info.end; + }else{ + this.begin = previous_gene + inter_gene + this.end = this.begin + gene_info.protein_length + } + //this.begin and end are begin and end on the genome (in base) + var g_arrow = paper.draw_gene( this.begin, this.end, gene_info, previous_gene); + this.arrow = g_arrow[0]; + //g_arrow[1] and [2] are begin and end on the paper (in px) + this.popup = paper.draw_gene_popup( g_arrow[1] , g_arrow[2] , gene_info); + this.arrow.mouseover( gene_show.bind(this)); + this.arrow.mouseout( gene_hide.bind(this) ); + this.zoom = gene_zoom; + this.translate = gene_translate; + }; + + Raphael.fn.draw_gene_popup = function( start, stop, gene_info ){ + var popup = this.set(); + var label = this.set(); + var txt = {font: '12px Helvetica, Arial', fill: "#fff"}; + var title = {font: '12px Helvetica, Arial', fill: "#aaf"}; + label.push(this.text(60, 12, "Gene-Id: "+gene_info.id ).attr(title)); + if(gene_info.match){ + label.push(this.text(60, 27, "match: "+gene_info.match ).attr(txt)); + } + label.push(this.text(60, 42, "protein length: "+gene_info.protein_length).attr(txt)); + label.hide(); + popup.push( label ); + var frame = this.popup( start +( (stop -start)/2 ) , 100, label , "bottom").attr({fill: "#000", stroke: "#666", "stroke-width": 2, "fill-opacity": .7}); + frame.hide(); + popup.push( frame ); + return popup; + }; + + Raphael.fn.draw_gene = function( begin , end , gene_info , previous_gene ){ + var arrow_beg = Math.round((begin - genome_orig)*coef)+genome_offset+genes_offset; + var arrow_end = Math.round((end - genome_orig)*coef)+genome_offset+genes_offset; + var body_l = Math.round((arrow_end - arrow_beg)*3/5); + var head_l = Math.round((arrow_end - arrow_beg)*2/5); + var arrow ; + if( gene_info.strand =='D' ){ + arrow = this.path( ["M", arrow_beg, Y_genome-28, "m0 20h", body_l, "v-20l", head_l, " 30l", (-1*head_l),"30v-20h",(-1*body_l),"z"]); + }else if( gene_info.strand =='C' ){ + arrow = this.path( ["M", arrow_beg, Y_genome-28, "m0 30l",head_l, "-30v20h", body_l, "v20h", (-1*body_l),"v20z"]); + }else{ + var width = arrow_end-arrow_beg; + var height = 20 ; + arrow = this.rect( arrow_beg, Y_genome-8, width , height ); + } + if(!gene_info.match){ + arrow.attr({fill: "white", stroke: "black", "stroke-dasharray": "-", "fill-opacity": 0.5}); + }else{ + var color=$( ".gene_"+gene_info.match).css( "backgroundColor" ); + arrow.attr({fill: color, stroke: "none", "stroke-dasharray": "-", "fill-opacity": 0.9}); + } + return [arrow , arrow_beg ,arrow_end ]; + }; + + function gene_zoom( factor , ori ){ + var bf_box = this.arrow.getBBox(); + this.arrow.scale( factor, 1 , ori ,Y_genome ); + var af_box = this.arrow.getBBox(); + this.popup.translate( (af_box.x+(af_box.width/2 )) - (bf_box.x+(bf_box.width /2 )) , 0); + }; + function gene_translate( dx , dy ){ + var bf_box = this.arrow.getBBox(false); + this.arrow.translate( dx , dy ); + var af_box = this.arrow.getBBox(false); + this.popup.translate((af_box.x + (af_box.width /2 )) - (bf_box.x + (bf_box.width /2 )) , (af_box.y-bf_box.y)); + }; + function gene_show(){ + this.popup.show(); + }; + function gene_hide(){ + this.popup.hide(); + }; + + Raphael.fn.control = function( x , y , genes , genome ){ + var west= this.path( ["M", x-40, y]+ "l20 -12 a70, 40 0 0,0 0, 24z").attr({fill:"blue"});//West + west.mousedown( function(){ + for(var i = 0 ;i 0){ + intOverallDelta++; + genome.scale( 1.25, 1 , objEvent.pageX ,Y_genome ); + for(var i = 0 ;iError document not found

" } });