• forked:Javascript heat-map
Import an externally hosted application
Check style

  • JavaScript
  • CSS
  • HTML
  • Images
  • Input Data
  • ReadMe
  • forked:Javascript heat-map
  • jquery-1.7.1.min.js  
  •  
  • history

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
 100
 
if(typeof Example==="undefined"||!Example){var Example = {};}
if (typeof tkjs === 'undefined' || !tkjs) {var tkjs = {};}
if (typeof tkjs.heatmap === 'undefined' || !tkjs.heatmap) {tkjs.heatmap = {};}
if (typeof tkjs.heatmap.view === 'undefined' || !tkjs.heatmap.view) {tkjs.heatmap.view = {};}
 
// LinkData.getObjects(workId, fileId, sbjId, propId)
tkjs.heatmap.load_linkdata = function() {
    var prop, work, works, workId, filename, filenames, fileId, subjects, subject, subjectId, property, properties, propertyId, row, col, rows, cols, line, header, genelist, samplelist, cell, i, j, genes, values, hm, prop2, samples;
    works = LinkData.getWorks();
    console.log("HANDLING SUCKING LINKDATA");
    console.log("works=" + works);
    console.log(typeof(works));
    hm = null;
    for (prop in works) {
        if (works.hasOwnProperty(prop)) {
            console.log(works[prop]);
            workId = works[prop];
            console.log('workId = ' + workId);
            filenames = LinkData.getFiles(workId);
            console.log('filenames = ' + filenames);
            console.log(typeof(filenames));
            console.log(filenames[0]);
            filename = filenames[0];
            properties = LinkData.getProperties(workId, filename);
            subjects = LinkData.getSubjects(workId, filename);
//          console.log("properties : " + (typeof properties))
            //console.log(properties);
//          console.log("subjects : " + (typeof subjects));
//          console.log(subjects);
            cols = properties.length - 1;
            rows = subjects.length;
            genes = [];
            property = properties[0];
            for (i = 0; i < subjects.length; i++) {
                cell = LinkData.getObjects(workId, filename, subjects[i], property);
                genes.push(cell.toString().split(',')[0]);
            }
            samples = [];
            for (i = 2; i < properties.length; i++) {
                property = properties[i].toString().split('#');
                samples.push(property[property.length - 1]);
            }
            console.log(samples);
            //console.log(
//          console.log(tkjs.heatmap.HeatMap);
            hm = new tkjs.heatmap.HeatMap(genes);
            hm.set_color_scale(4.0);
            for (i = 0; i < samples.length; i++) {
                values = [];
                for (j = 0; j < subjects.length; j++) {
                    cell = parseFloat(LinkData.getObjects(workId, filename, subjects[j], properties[i + 2]).toString());
                    values.push(cell);
                }
                hm.set_array(samples[i], new Float32Array(values));
                console.log(samples[i] + " : " + values);
            }
//          for (i = 0; i < properties.
//          hm.set_array(
            for (i = 0; i < subjects.length; i++) {
                line = "";
                for (j = 0; j < properties.length; j++) {
                    cell = LinkData.getObjects(workId, filename, subjects[i], properties[j]);
                    if (j === 0) {
                        line = cell;
                    } else {
                        line += ", " + parseFloat(cell).toFixed(2);
                    }
                }
                console.log(line);
            if (i >= 10) { break;}
            }           
            break;
        }
    }
    console.log("BYE SUCKING LINKDATA");
    return hm;
};
 
 
Example.getWorks = function() {
    return LinkData.getWorks();
};
Example.getFiles = function(workId) {
    return LinkData.getFiles(workId);
};
Example.getSubjects = function(workId, fileName) {
    return LinkData.getSubjects(workId, fileName);
};
Example.getProperties = function(workId, fileName) {
    return LinkData.getProperties(workId, fileName);
};
Example.getObjects = function(workId, fileName, subject, property) {
    return LinkData.getObjects(workId, fileName, subject, property);
};
 
window.onload = function() {
    var hm;
    hm = tkjs.heatmap.load_linkdata();
    
    if (hm === null) {
jquery-1.7.1.min.js
Playing...

jquery-1.7.1.min.js