Language
Login
Language Setting
X
English
日本語 [Japanese]
about this App
forked:Interactive association matrix
useful
0
Loading...
window.onresize = function() { repaint(); }; function apply_linkdata_table(LinkData) { // console.log(LinkData); // LinkData.getWorks(); tkjs.controller.create_ui_components(); console.log("LINKDATA is "); console.log(LinkData); // if (typeof LinkData === 'undefined') { // var LinkData = myLD; // } var work = LinkData.getWorks(); if (typeof work !== 'string') { work = work[0]; } console.log("workID:" + work); var file = LinkData.getFiles(work); if (typeof file !== 'string') {file = file[0]; } console.log("fileID:" + file); var prop = LinkData.getProperties(work, file); console.log(prop); var subj = LinkData.getSubjects(work, file); console.log(subj); var i, j; console.log(tkjs); console.log(tkjs.cluster); console.log(tkjs.cluster.TreeGenerator); var tree = new tkjs.cluster.TreeGenerator(); var data = {}; var x_, y_; var column_alias = [3, 4, 5, 6]; if (prop[3].indexOf('+') >= 0 || prop[3].toLowerCase().indexOf('plus') >= 0) { column_alias = [6, 5, 4, 3]; } for (i = 0; i < subj.length; i++) { var xelem = LinkData.getObjects(work, file, subj[i], prop[1]).toString(); var yelem = LinkData.getObjects(work, file, subj[i], prop[2]).toString(); var counts = []; for (j = 0; j < 4; j++) { var col_ = column_alias[j]; var obj = LinkData.getObjects(work, file, subj[i], prop[col_]).toString(); counts.push(parseInt(obj, 10)); } var lod_dist = 0; if (!data[xelem]) { data[xelem] = {}; } if (!data[yelem]) { data[yelem] = {}; } data[xelem][yelem] = data[yelem][xelem] = counts; if (counts[1] <= 0 || counts[2] <= 2) { if (counts[0] > 0 && counts[3] > 0) { lod_dist = 100; } else { lod_dist = -100; } } else if (counts[0] <= 0 || counts[3] <= 0) { lod_dist = 100; } else { var odds = counts[0] * counts[3] / (counts[1] * counts[2]); lod_dist = - Math.log(odds) / Math.log(2); } tree.set_distance(xelem, yelem, lod_dist); } console.log('clustering'); tree.execute_clustering(); var sorted = tree.get_labels(); var table = []; //console.log(data); for (i = 0; i < sorted.length; i++) { for (j = 0; j < i; j++) { //console.log(sorted[i] + " , " + sorted[j]); table.push(data[sorted[i]][sorted[j]]); } } var n_ = sorted.length; var matrix = new tkjs.cluster.DataMatrix(n_ * (n_ - 1) / 2, table); tkjs.cluster.cluster = tree.tree; tkjs.cluster.matrix = matrix;//.counts; tkjs.controller.set_viewer(); } window.onload = function() { console.log(LinkData); console.log(LinkData.getWorks()); apply_linkdata_table(LinkData); }; function _dummy() { var limit = 5; var count = 0; $.each(LinkData.getWorks(), function(workKey, workValue) { console.log("Work:" + workKey + " / " + workValue); // $("#result").append("<h3>Work: " + workValue + "</h3>"); $.each(LinkData.getFiles(workValue), function(fileKey, fileValue) { console.log("File:" + fileKey + " / " + fileValue); var subjects = LinkData.getSubjects(workValue, fileValue); var properties = LinkData.getProperties(workValue, fileValue); // console.log(subjects); // console.log(properties); var counts = []; var data = {title:fileValue}; var retval = {linkdata:data}; data.elements = []; data.table = []; var cluster = ""; var dict = {}; var i, j, k; var N = subjects.length; var titles = []; var gene_counts = []; for (i = 0; i < N; i++) { console.log(i); for (j = 1; j < 3; j++) { var cell = LinkData.getObjects(workValue, fileValue, subjects[i], properties[j]).toString(); console.log(cell); var found =false; for (k = 0; k < titles.length; k++) { if (titles[k] === cell) { found = true; break; } } if (!found) { console.log(cell); titles.push(cell); } } var cnts = []; for (j = 0; j < 4; j++) { cnts.push(parseInt(LinkData.getObjects(workValue, fileValue, subjects[i], properties[j + 2]), 10)); } gene_counts.push(cnts); } console.log(titles); data.elements = titles; data.table = gene_counts; // var num_elements = Math.floor(0.5 + (1 + 8 * N) * 0.5 + 0.5);//len(subjects) * 2; //a = (n + 1) n / 2, n^2 + n - 2a = 0, n = 1/2 + (1+8a)/2 // data.matrix = []; // for ( i = 0; i < N; i++) { // var cnt = []; // for (j = 0; j < 4; j++) { // cnt.push(parseInt(LinkData.getObjects(workValue, fileValue, subjects[i], properties[j + 3]), 10)); // } // data.matrix.push(cnt); // } counts.push(data); console.log(data); initialize({linkdata:data}); }); }); }
body { margin:0px; padding:0px; } #control { position:absolute; left;0px; width:100%; top:0px; height:20px; } #contents { position:absolute; top:20px; bottom:150px; left:0px; width:100%; } #matrixcanvas { position:absolute; left:0px; width:60%; top:0px; height:90%; } #individualsection { position:absolute; right:0px; width:40%; top:0px; height:100%; } #venndiagramcanvas { position:absolute; top:0px; left:0px; height:75%; width:100%; } #statresults { position:absolute; left:0px; top:75%; left:0px; width:100%; height:25%; font-family:monospace; overflow:hidden; } #vennstock { position:absolute; left:0px; width:100%; bottom:0px; height:150px; overflow:hidden; } #preference table td,th { width:33%; white-space:nowrap; color:white; } .colorsample { position:absolute; margin:auto; width:14px; height:14px; border:1px solid gray; }
<body> <div id="result"></div> <div id="control"> <select id="dataselect"></select> <div id="optionbutton"></div> </div> <div id="contents"> <canvas id="matrixcanvas"></canvas> <div id="individualsection"> <canvas id="venndiagramcanvas"></canvas> <div id="statresults"> <div id="colourPicker"></div> </div> </div> </div> <div id="vennstock"> </div> <div id="preference"> <table style="width:100%"> <tr> <td>Dendrogram</td> <td> <input type="checkbox" id="dendrogramcheck" /> <label for="dendrogramcheck" checked> </label> </td><td></td></tr> <tr><td>Color scale</td><td style="white-space:nowrap"><div id="colorslider"></div></td><td><span id="colorslidervalue"></span></td></tr> <tr><td>P-value</td><td style="white-space:nowrap"><div id="pvalueslider"></div></td><td><span id="pvalueslidervalue"></span></td></tr> <tr><td>Color</td><td><div id="leftcolorpicker" class="colorsample"></div></td><td><div id="rightcolorpicker" class="colorsample"></div></td></tr> </table> </div> </body>
Preview
Input Data
ReadMe
Snapshots
LinkData Work
Table Data
GSE1986 upregulated genes
Contributor:taendo
Update:Sep 25, 2012
110 Downloads, 1 Applications
Upregulated genes in various mouse tissues
Upregulated_genes_GSE1986
Add LinkData work(LinkData)
Link http://app.linkdata.org/run/app1s69i?tab=readme
Initial content
jquery-1.7.1.min.js
jquery-ui-1.8.18.min.js
http://tk-venn2.appspot.com/js/tklib.js
http://tk-venn2.appspot.com/js/tkstat.js
http://tk-venn2.appspot.com/js/tkcluster.js
http://tk-venn2.appspot.com/js/tkcolor.js
http://tk-venn2.appspot.com/js/tktree.js
Work
Add
Clear
insert work id or work name.