Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

shows overlapped matches, changed print style and removed some bugs.

  • Loading branch information...
commit baea409d2d21b6fb0dd8f0dcebd2ac8b0bd090e0 1 parent c2d6513
@pablohess authored
View
15 css/dn.a.nalyzer.css
@@ -25,8 +25,12 @@ body {
}
textarea {
min-height: 300px;
- min-width: 765px;
- max-width: 765px;
+ min-width: 920px;
+ max-width: 920px;
+}
+h3 {
+ padding-top: 4px;
+ padding-bottom: 4px;
}
li {
padding: 5px;
@@ -60,10 +64,15 @@ textarea.text {
font-family: Courier;
}
div.tab {
- width: 840px;
+ width: 980px;
}
span.selection {
font-weight: bold;
background: #2779AA;
color: white;
+}
+span.selectionOverlapped {
+ font-weight: bold;
+ background: #AA00AA;
+ color: white;
}
View
12 css/print.dn.a.nalyzer.css
@@ -15,7 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
-#tabs, #title, button, .ui-dialog-titlebar {
+* {
+ font-size: 16pt;
+}
+
+#tabs, #title, button, .ui-dialog-titlebar, .ui-dialog-buttonset {
display: none;
}
@@ -27,5 +31,9 @@
span.selection {
font-weight: bold;
- color: red;
+ color: #3789BB;
+}
+span.selectionOverlapped {
+ font-weight: bold;
+ color: #AA00AA;
}
View
4 dn.a.nalyzer.html
@@ -73,8 +73,8 @@
</div>
<div id="tabs-4" style="font-family:Courier;">
<h3>Examples</h3>
- CCND1 Exon 1: Chromosome 11: 69,455,805 - 69,456,329 <button id="pasteExampleCCND1">Paste Example</button><br>
- CCND2 Exon 1: Chromosome 12: &nbsp;4,382,888 - &nbsp;4,383,451 <button id="pasteExampleCCND2">Paste Example</button>
+ <div>CCND1 Exon 1: Chromosome 11: 69,455,805 - 69,456,329 <button id="pasteExampleCCND1">Paste Example</button></div>
+ <div>CCND2 Exon 1: Chromosome 12: &nbsp;4,382,888 - &nbsp;4,383,451 <button id="pasteExampleCCND2">Paste Example</button></div>
<br><br>
<h3>Informations</h3>
View
57 js/dnaAnalyzer.js
@@ -15,10 +15,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
+function initDialog(searchString) {
+ $("#"+SEARCHRESULT_FORM).dialog('option', 'title', 'Search Result');
+ if (searchString == "") {
+ $(":button:contains('Mark all')").hide();
+ $(":button:contains('Previous')").hide();
+ $(":button:contains('Next')").hide();
+ $(":button:contains('Mark just one')").hide();
+ }
+}
+
function changeTitle(from, to, length) {
$("#"+SEARCHRESULT_FORM).dialog('option', 'title', 'Search Result:&nbsp;&nbsp;&nbsp;from ' + from + ' to ' + to + ', length: ' + length);
}
+function changeTitleAll(count, countOverlapping) {
+ $("#"+SEARCHRESULT_FORM).dialog('option', 'title', 'Search Result:&nbsp;&nbsp;&nbsp;' + count + ' matches, ' + countOverlapping + ' are overlapped');
+}
+
function prepareSearchContentPrevious(textarea, input, start) {
if (input.length > 0) {
var part1 = textarea.substring(0,start);
@@ -63,6 +77,45 @@ function prepareSearchContentNext(textarea, input, start) {
return textarea.indexOf(input, start);
}
+function markAll(textarea, input) {
+ var start = 0;
+ var count = 0;
+ var countOverlapping = 0;
+ if (input.length > 0 && textarea.indexOf(input, start) != -1) {
+ var parts = "";
+ while (textarea.indexOf(input, start) != -1) {
+ var index = textarea.indexOf(input, start);
+ var part1 = textarea.substring(start, index);
+ var tmp = index;
+ var last = index;
+ while (true) {
+ var current = textarea.indexOf(input, tmp + 1);
+ if (current == -1) {
+ break;
+ }
+ if (current >= last + input.length) {
+ break;
+ }
+ last = current;
+ ++tmp;
+ }
+ ++count;
+ countOverlapping += (tmp - index);
+ var part2 = textarea.substring(index, index + (tmp - index) + input.length);
+ if (tmp - index > 0) {
+ parts = parts + part1 + "<span class=\"selectionOverlapped\">" + part2 + "</span>";
+ } else {
+ parts = parts + part1 + "<span class=\"selection\">" + part2 + "</span>";
+ }
+ start = index + input.length + (tmp - index);
+ }
+ parts = parts + textarea.substring(start, textarea.length);
+ document.getElementById(SEARCHRESULT_CONTENT).innerHTML = formatContent(parts, 5, 10, 50);
+
+ changeTitleAll(count + countOverlapping, countOverlapping);
+ }
+}
+
function inverseAT(at) {
at = at.replace(/t/g,"x"); // T --> X
at = at.replace(/a/g,"t"); // A --> T
@@ -112,7 +165,7 @@ function formatContent(str, space, block, newLine) {
}
}
- if (array[index] == "<") {
+ while (array[index] == "<") {
htmlTag = true;
for (;array[index] != ">";++index) {
ret += array[index];
@@ -121,7 +174,7 @@ function formatContent(str, space, block, newLine) {
++index;
}
} else {
- if (array[index] == "<") {
+ while (array[index] == "<") {
htmlTag = false;
for (;array[index] != ">";++index) {
ret += array[index];
View
35 js/onDocumentLoad.js
@@ -19,7 +19,6 @@ var index = 0;
$(function() {
$(document).keydown(function(event) {
- console.log(event.keyCode);
if (isCtrl(event.keyCode)) {
ctrlDown = true;
}
@@ -166,14 +165,17 @@ $(function() {
$("#"+BUTTON_SEARCH_DNA).click(function() {
index = prepareSearchContentNext(getValue(TEXTAREA_DNA), getValue(INPUT_DNA), 0);
$("#"+SEARCHRESULT_FORM).dialog("open");
+ initDialog(getValue(INPUT_DNA));
});
$("#"+BUTTON_SEARCH_DNA_COMP).click(function() {
index = prepareSearchContentNext(getValue(TEXTAREA_DNA_COMP), getValue(INPUT_DNA_COMP), 0);
$("#"+SEARCHRESULT_FORM).dialog("open");
+ initDialog(getValue(INPUT_DNA_COMP));
});
$("#"+BUTTON_SEARCH_RNA).click(function() {
index = prepareSearchContentNext(getValue(TEXTAREA_RNA), getValue(INPUT_RNA), 0);
$("#"+SEARCHRESULT_FORM).dialog("open");
+ initDialog(getValue(INPUT_RNA));
});
$("#"+BUTTON_CCND1).click(function() {
pasteExample(CCND1Chromosome11);
@@ -188,16 +190,31 @@ $(function() {
width: 840,
modal: true,
open: function() {
- $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:eq(2)').focus();
+ $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:eq(2)').focus();
+ $(":button:contains('Mark all')").show();
+ $(":button:contains('Previous')").show();
+ $(":button:contains('Next')").show();
+ $(":button:contains('Mark just one')").hide();
},
buttons: {
- Cancel: function() {
- $(this).dialog("close");
+ 'Mark all': function() {
+ $(":button:contains('Mark all')").hide();
+ $(":button:contains('Previous')").hide();
+ $(":button:contains('Next')").hide();
+ $(":button:contains('Mark just one')").show();
+ markAll(getValue(TEXTAREA_DNA), getValue(INPUT_DNA));
},
- Previous: function() {
+ 'Mark just one': function() {
+ $(":button:contains('Mark just one')").hide();
+ $(":button:contains('Mark all')").show();
+ $(":button:contains('Previous')").show();
+ $(":button:contains('Next')").show();
+ index = prepareSearchContentNext(getValue(TEXTAREA_DNA), getValue(INPUT_DNA), index);
+ },
+ 'Previous': function() {
index = prepareSearchContentPrevious(getValue(TEXTAREA_DNA), getValue(INPUT_DNA), ++index);
},
- Next: function() {
+ 'Next': function() {
index = prepareSearchContentNext(getValue(TEXTAREA_DNA), getValue(INPUT_DNA), ++index);
},
Print: function() {
@@ -209,10 +226,10 @@ $(function() {
}
}
window.print();
+ },
+ Cancel: function() {
+ $(this).dialog("close");
}
- },
- close: function() {
- allFields.val("").removeClass("ui-state-error");
}
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.