|
|
Line 80: |
Line 80: |
| }); | | }); |
| | | |
- | // reverse complement function
| |
- | function reverseComplement(sequence)
| |
- | {
| |
- | var output = "";
| |
- |
| |
- | for(j=0;j<sequence.length;j++)
| |
- | {
| |
- | if(sequence.charAt(j) == "G")
| |
- | output = "C" + output;
| |
- |
| |
- | if(sequence.charAt(j) == "C")
| |
- | output = "G" + output;
| |
- |
| |
- | if(sequence.charAt(j) == "T")
| |
- | output = "A" + output;
| |
- |
| |
- | if(sequence.charAt(j) == "A")
| |
- | output = "T" + output;
| |
- |
| |
- | if(sequence.charAt(j) == "N")
| |
- | output = "N" + output;
| |
- | }
| |
- |
| |
- | return output;
| |
- |
| |
- | }
| |
- |
| |
- | // findCustom function
| |
- | $("#findcustom").click(function() {
| |
- |
| |
- | //get DNA sequence
| |
- | var testseq = $("#sequence").val();
| |
- | //to uppercase
| |
- | testseq = testseq.toUpperCase();
| |
- |
| |
- | //get zinc finger arrays for searching
| |
- | var bottomzf = $("#bottom").val();
| |
- | var topzf = $("#top").val();
| |
- | //to uppercase
| |
- | bottomzf = bottomzf.toUpperCase();
| |
- | topzf = topzf.toUpperCase();
| |
- |
| |
- | var ntpCheck = /[GCTAN]{9}/;
| |
- | if (!(bottomzf.match(ntpCheck)&&
| |
- | topzf.match(ntpCheck)&&
| |
- | (bottomzf.length=="9")&&
| |
- | (topzf.length=="9"))){
| |
- | alert("You must enter a valid sequence of nine nucleotides containing G,T,C,A, or N.");
| |
- | return;
| |
- | }
| |
- |
| |
- | //transform bottom zf to reverse complement
| |
- | bottomzf = reverseComplement(bottomzf);
| |
- |
| |
- | alert(bottomzf);
| |
- | alert(topzf);
| |
- |
| |
- |
| |
- | /*
| |
- | //start building regular expression from ZF fingers
| |
- | var siteExp = "(" + bottomzf.replace(/n/gi,"\\w");
| |
- |
| |
- | //add in x NTPs between first and second finger
| |
- | var nucgap = document.getElementById("gap").value;
| |
- | for(i=0;i<nucgap;i++){
| |
- | siteExp = siteExp + "\\w";
| |
- | }
| |
- |
| |
- | //finish building regular expression
| |
- | siteExp = siteExp + topzf.replace(/n/gi,"\\w") + "){1}";
| |
- |
| |
- | //construct regular expression and find all instances of desired sequence in the test sequence
| |
- | var array1 = new RegExp(siteExp, "gi");
| |
- | var array2 = testseq.match(array1);
| |
- |
| |
- | //error message if no sequences found
| |
- | if(testseq.search(array1) == -1)
| |
- | {
| |
- | document.getElementById("results").innerHTML = "No results found.";
| |
- | //if results are found, build table to display results
| |
- | } else {
| |
- |
| |
- | var revComp = "";
| |
- | var seqtwo = "";
| |
- |
| |
- | table = "<table><tr><td colspan='4'><b>Zinc Finger Binding Site Candidates</b></td></tr><td><b>Location</b></td><td><b>Bottom Sequence</b></td><td><b>Top Sequence</b></td><td><b>Entire Sequence (top strand perspective)</b></td>";
| |
- |
| |
- | for(i=0;i<array2.length;i++)
| |
- | {
| |
- | array1.test(testseq);
| |
- |
| |
- | table = table + "<tr>";
| |
- | //subtract 18 nucleotides, nucgap inter-ZF nucleotides, +1 for index correction for location of binding site
| |
- | table = table + "<td>" + (array1.lastIndex - 18 - nucgap) + "</td>";
| |
- | seqbottom = reverseComplement(array2[i].substring(0,9));
| |
- | table = table + "<td>" + seqbottom + "</td>";
| |
- | table = table + "<td>" + array2[i].substring(array2[i].length - 9,array2[i].length) + "</td>";
| |
- | table = table + "<td>" + array2[i] + "</td>";
| |
- | table = table + "</tr>";
| |
- | }
| |
- |
| |
- | table = table + "</table><br /><br />"
| |
- |
| |
- | document.getElementById("results").innerHTML = table;
| |
- | }
| |
- | */
| |
- | });
| |
| | | |
| // end jQuery | | // end jQuery |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">