Team:Heidelberg/js/notebook tree

From 2014.igem.org

(Difference between revisions)
 
(22 intermediate revisions not shown)
Line 1: Line 1:
-
var svg;
+
function md5cycle(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=ff(n,r,i,s,t[0],7,-680876936);s=ff(s,n,r,i,t[1],12,-389564586);i=ff(i,s,n,r,t[2],17,606105819);r=ff(r,i,s,n,t[3],22,-1044525330);n=ff(n,r,i,s,t[4],7,-176418897);s=ff(s,n,r,i,t[5],12,1200080426);i=ff(i,s,n,r,t[6],17,-1473231341);r=ff(r,i,s,n,t[7],22,-45705983);n=ff(n,r,i,s,t[8],7,1770035416);s=ff(s,n,r,i,t[9],12,-1958414417);i=ff(i,s,n,r,t[10],17,-42063);r=ff(r,i,s,n,t[11],22,-1990404162);n=ff(n,r,i,s,t[12],7,1804603682);s=ff(s,n,r,i,t[13],12,-40341101);i=ff(i,s,n,r,t[14],17,-1502002290);r=ff(r,i,s,n,t[15],22,1236535329);n=gg(n,r,i,s,t[1],5,-165796510);s=gg(s,n,r,i,t[6],9,-1069501632);i=gg(i,s,n,r,t[11],14,643717713);r=gg(r,i,s,n,t[0],20,-373897302);n=gg(n,r,i,s,t[5],5,-701558691);s=gg(s,n,r,i,t[10],9,38016083);i=gg(i,s,n,r,t[15],14,-660478335);r=gg(r,i,s,n,t[4],20,-405537848);n=gg(n,r,i,s,t[9],5,568446438);s=gg(s,n,r,i,t[14],9,-1019803690);i=gg(i,s,n,r,t[3],14,-187363961);r=gg(r,i,s,n,t[8],20,1163531501);n=gg(n,r,i,s,t[13],5,-1444681467);s=gg(s,n,r,i,t[2],9,-51403784);i=gg(i,s,n,r,t[7],14,1735328473);r=gg(r,i,s,n,t[12],20,-1926607734);n=hh(n,r,i,s,t[5],4,-378558);s=hh(s,n,r,i,t[8],11,-2022574463);i=hh(i,s,n,r,t[11],16,1839030562);r=hh(r,i,s,n,t[14],23,-35309556);n=hh(n,r,i,s,t[1],4,-1530992060);s=hh(s,n,r,i,t[4],11,1272893353);i=hh(i,s,n,r,t[7],16,-155497632);r=hh(r,i,s,n,t[10],23,-1094730640);n=hh(n,r,i,s,t[13],4,681279174);s=hh(s,n,r,i,t[0],11,-358537222);i=hh(i,s,n,r,t[3],16,-722521979);r=hh(r,i,s,n,t[6],23,76029189);n=hh(n,r,i,s,t[9],4,-640364487);s=hh(s,n,r,i,t[12],11,-421815835);i=hh(i,s,n,r,t[15],16,530742520);r=hh(r,i,s,n,t[2],23,-995338651);n=ii(n,r,i,s,t[0],6,-198630844);s=ii(s,n,r,i,t[7],10,1126891415);i=ii(i,s,n,r,t[14],15,-1416354905);r=ii(r,i,s,n,t[5],21,-57434055);n=ii(n,r,i,s,t[12],6,1700485571);s=ii(s,n,r,i,t[3],10,-1894986606);i=ii(i,s,n,r,t[10],15,-1051523);r=ii(r,i,s,n,t[1],21,-2054922799);n=ii(n,r,i,s,t[8],6,1873313359);s=ii(s,n,r,i,t[15],10,-30611744);i=ii(i,s,n,r,t[6],15,-1560198380);r=ii(r,i,s,n,t[13],21,1309151649);n=ii(n,r,i,s,t[4],6,-145523070);s=ii(s,n,r,i,t[11],10,-1120210379);i=ii(i,s,n,r,t[2],15,718787259);r=ii(r,i,s,n,t[9],21,-343485551);e[0]=add32(n,e[0]);e[1]=add32(r,e[1]);e[2]=add32(i,e[2]);e[3]=add32(s,e[3])}function cmn(e,t,n,r,i,s){t=add32(add32(t,e),add32(r,s));return add32(t<<i|t>>>32-i,n)}function ff(e,t,n,r,i,s,o){return cmn(t&n|~t&r,e,t,i,s,o)}function gg(e,t,n,r,i,s,o){return cmn(t&r|n&~r,e,t,i,s,o)}function hh(e,t,n,r,i,s,o){return cmn(t^n^r,e,t,i,s,o)}function ii(e,t,n,r,i,s,o){return cmn(n^(t|~r),e,t,i,s,o)}function md51(e){txt="";var t=e.length,n=[1732584193,-271733879,-1732584194,271733878],r;for(r=64;r<=e.length;r+=64){md5cycle(n,md5blk(e.substring(r-64,r)))}e=e.substring(r-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<e.length;r++)i[r>>2]|=e.charCodeAt(r)<<(r%4<<3);i[r>>2]|=128<<(r%4<<3);if(r>55){md5cycle(n,i);for(r=0;r<16;r++)i[r]=0}i[14]=t*8;md5cycle(n,i);return n}function md5blk(e){var t=[],n;for(n=0;n<64;n+=4){t[n>>2]=e.charCodeAt(n)+(e.charCodeAt(n+1)<<8)+(e.charCodeAt(n+2)<<16)+(e.charCodeAt(n+3)<<24)}return t}function rhex(e){var t="",n=0;for(;n<4;n++)t+=hex_chr[e>>n*8+4&15]+hex_chr[e>>n*8&15];return t}function hex(e){for(var t=0;t<e.length;t++)e[t]=rhex(e[t]);return e.join("")}function md5(e){return hex(md51(e))}function add32(e,t){return e+t&4294967295}var hex_chr="0123456789abcdef".split("");if(md5("hello")!="5d41402abc4b2a76b9719d911017c592"){function add32(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}}
-
var color = d3.scale.category20();
+
-
var firstDate = 1403301600;//1407861000;
+
var svg;
-
var date = firstDate;
+
var color = d3.scale.category20();
-
var heightOfSecond = 100 / 86400; // = 300 Pixel per day?!
+
var firstDate = 1401573600;//1407861000;
-
var viewportHeight = 300/heightOfSecond;
+
var date = firstDate;
-
var bufferHeight = 1000/heightOfSecond;
+
-
var scrollSpeed = 6000; // = 20 minutes
+
-
+
-
var width = 1;
+
-
var height = 1;
+
-
var bigNodes = []; //Contains [{containsDate(), [data]},...]
+
var heightOfSecond = 100 / 86400; // = 300 Pixel per day?!
-
var bigLinks = [];
+
var viewportHeight = 300/heightOfSecond;
 +
var bufferHeight = 1000/heightOfSecond;
 +
var scrollSpeed = 6000; // = 20 minutes
 +
 +
var width = 1;
 +
var height = 1;
-
var fnodes = [];
+
var bigNodes = []; //Contains [{containsDate(), [data]},...]
-
var flinks = [];
+
var bigLinks = [];
-
var force;
+
-
var node;
+
var fnodes = [];
-
var link;
+
var flinks = [];
 +
var force;
-
var selectedProject;
+
var node;
 +
var link;
-
var unhighlightedData = []
+
var selectedProject;
-
var jsonFiles = ["1388530800_1388530800.txt","1401804000_1402234200.txt","1402567200_1403101800.txt","1403301600_1403690400.txt","1403953200_1404511200.txt","1404585000_1405166400.txt","1405267200_1405871100.txt","1405980000_1406584800.txt","1406642400_1407238860.txt","1407251220_1407841200.txt","1407861000_1408447800.txt","1408474800_1409074200.txt","1409083200_1409662800.txt","1409768100_1410364800.txt","1410379200_1410962400.txt","1411034400_1411639200.txt","1411642800_1412200800.txt"];//["1412829220_1412978399.txt", "1412978399_1413064799.txt"];
+
var unhighlightedData = []
-
+
-
var mapping = {
+
-
    "p/3cuNZHSvzbmc5wGLz" : "Make a liquid culture",
+
-
    "p/3wt4jvadcLzkvFn9X" : "Make a liquid culture",
+
-
    "p/4jCgLAziJ2DSmmcvR" : "Streak bacteria onto an agar plate",
+
-
    "p/53yEPDJz7oRihLz3M" : "Dilute DNA",
+
-
    "p/5K8vL8t4egnG8SRtc" : "PCA",
+
-
    "p/9S64Hy4vyzPvM4aiC" : "DNA purification (\"PCR Purification\")",
+
-
    "p/9TiKPrpdykEiSHFcy" : "Make a liquid culture",
+
-
    "p/ATv6a4HMeQZMa9WYX" : "Dilute DNA",
+
-
    "p/Ae7BXywPx8nNApvPK" : "Golden Gate Assembly",
+
-
    "p/CdKqzhX6FqmmHYKdE" : "Maxens neues Protokoll",
+
-
    "p/D9hHrT2Ere5rrcuXK" : "Make competent cells",
+
-
    "p/E8wraGbztRq8EsET7" : "Make a glycerol stock",
+
-
    "p/ENCvtL4jWZQW72hE5" : "Restriction digest",
+
-
    "p/F2oNT7tGTyGFCjAB9" : "Make competent cells",
+
-
    "p/FY69K4x7xdaJT6Lzk" : "Pick a colony from an agar plate",
+
-
    "p/HA9CLF2Z4kgY3J5rE" : "Make a liquid culture",
+
-
    "p/JPmjNykwWASQiD9PX" : "Agarose Gel Electrophoresis",
+
-
    "p/NgpLzurL2RKFojWWA" : "PCR",
+
-
    "p/Nm75fDvHCr38nXJBo" : "Plasmid Preparation",
+
-
    "p/P6LsqW4xkJYaXHFJN" : "Heat shock transformation",
+
-
    "p/PxYonEdgff39dmkhq" : "DNA purification (\"PCR Purification\")",
+
-
    "p/TD9txcymCuToDta7x" : "Annealing of complementary oligonucleotides",
+
-
    "p/WSMMH3bg6CcrcAJ3x" : "PCR",
+
-
    "p/ZuE3NijkBg4WwpzKc" : "Recovery of plasmid DNA from filter paper",
+
-
    "p/bSEHCZgLpXJ6nb9ze" : "Streak bacteria onto an agar plate",
+
-
    "p/gM7FyZeyNrM4hwxZk" : "Dissolve plasmid DNA from the registry distribution",
+
-
    "p/hmhE7AHgjXE8Khw6M" : "Gel extraction",
+
-
    "p/jT9cdZ9T5JgFDEJXe" : "Heat shock transformation",
+
-
    "p/kKiCHxutJLzPKayCC" : "Streak bacteria onto an agar plate",
+
-
    "p/kxBySpW3SnbWuYMRw" : "Streak bacteria onto an agar plate",
+
-
    "p/mJNyMCoEko3JKRv5x" : "Heat shock transformation",
+
-
    "p/maDx7F6ry8Mw5JmKf" : "Pick a colony from an agar plate",
+
-
    "p/ms6uHrB9Fv23Tge2J" : "Make a glycerol stock",
+
-
    "p/mzGLz4CZBhmDHNivi" : "Make Medium",
+
-
    "p/n4Sg8s8AfhMEtQtFH" : "Ligation",
+
-
    "p/oFoQguhSKQKC2Hfms" : "Gather bacteria from an agar plate",
+
-
    "p/ojKqKzgeLkvNvLDgw" : "Heat shock transformation",
+
-
    "p/ovMK2ktEeSommgLa2" : "Heat shock transformation",
+
-
    "p/pk9LqRH9ot8JiKx23" : "Make a glycerol stock",
+
-
    "p/qGNf5sATkiC4P7RqF" : "Gather bacteria from an agar plate",
+
-
    "p/v97Nktv4idauP3hYh" : "Make competent cells",
+
-
    "p/vB88pigyWbKvmKir6" : "Pick a colony from an agar plate",
+
-
    "p/vj752RxeBbHsHi83w" : "Pick a colony from an agar plate",
+
-
    "p/xBmBAjXPQntkvc8d5" : "Make a glycerol stock",
+
-
    "p/z46dHCjoZpLkNgm4k" : "CPEC"
+
-
}
+
-
var colorMapping = {"Make a liquid culture":"#1f77b4","Streak bacteria onto an agar plate":"#aec7e8","Dilute DNA":"#ff7f0e","PCA":"#ffbb78","DNA purification (\"PCR Purification\")":"#2ca02c","Golden Gate Assembly":"#98df8a","Maxens neues Protokoll":"#d62728","Make competent cells":"#ff9896","Make a glycerol stock":"#9467bd","Restriction digest":"#c5b0d5","Pick a colony from an agar plate":"#8c564b","Agarose Gel Electrophoresis":"#c49c94","PCR":"#e377c2","Plasmid Preparation":"#f7b6d2","Heat shock transformation":"#7f7f7f","Annealing of complementary oligonucleotides":"#c7c7c7","Recovery of plasmid DNA from filter paper":"#bcbd22","Dissolve plasmid DNA from the registry distribution":"#dbdb8d","Gel extraction":"#17becf","Make Medium":"#9edae5","Ligation":"#1f77b4","Gather bacteria from an agar plate":"#aec7e8","CPEC":"#ff7f0e"};
+
var jsonFiles = {"Toolbox":[{"begin":1388527200,"end":1388530800},{"begin":1392040800,"end":1392072300},{"begin":1396947600,"end":1396951200},{"begin":1401804000,"end":1402056000},{"begin":1402070400,"end":1402234200},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403172000},{"begin":1403301600,"end":1403390400},{"begin":1403598600,"end":1403789400},{"begin":1403859600,"end":1403958600},{"begin":1404134400,"end":1404388800},{"begin":1404403680,"end":1404660346},{"begin":1404664800,"end":1404849600},{"begin":1404932400,"end":1405186800},{"begin":1405193400,"end":1405447200},{"begin":1405458000,"end":1405641000},{"begin":1405720800,"end":1405980000},{"begin":1406021160,"end":1406278800},{"begin":1406282400,"end":1406539200},{"begin":1406543880,"end":1406757600},{"begin":1406808000,"end":1407067200},{"begin":1407070800,"end":1407330000},{"begin":1407330600,"end":1407580200},{"begin":1407596700,"end":1407855600},{"begin":1407857400,"end":1408115700},{"begin":1408117620,"end":1408376700},{"begin":1408377600,"end":1408636800},{"begin":1408642200,"end":1408901220},{"begin":1408911600,"end":1409170200},{"begin":1409173200,"end":1409432400},{"begin":1409436000,"end":1409695200},{"begin":1409697000,"end":1409955000},{"begin":1409957940,"end":1410215400},{"begin":1410220800,"end":1410453000},{"begin":1410512400,"end":1410771600},{"begin":1410775200,"end":1411034400},{"begin":1411036200,"end":1411295400},{"begin":1411336800,"end":1411596000},{"begin":1411598280,"end":1411855200},{"begin":1411863840,"end":1412114700},{"begin":1412134500,"end":1412380800},{"begin":1412414880,"end":1412655300},{"begin":1412681400,"end":1412905020},{"begin":1412995020,"end":1413085020},],"LOV":[{"begin":1388530800,"end":1388530800},{"begin":1392040800,"end":1392044400},{"begin":1401804000,"end":1402000800},{"begin":1402070400,"end":1402234200},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403172000},{"begin":1403301600,"end":1403301600},{"begin":1403604000,"end":1403863200},{"begin":1403866800,"end":1404064800},{"begin":1404203520,"end":1404424800},{"begin":1404511200,"end":1404770400},{"begin":1404807600,"end":1404938700},{"begin":1405112400,"end":1405371600},{"begin":1405447200,"end":1405641000},{"begin":1405720800,"end":1405871100},{"begin":1406021160,"end":1406278800},{"begin":1406282400,"end":1406500200},{"begin":1406543880,"end":1406757600},{"begin":1406808000,"end":1407024000},{"begin":1407070800,"end":1407323460},{"begin":1407369600,"end":1407623400},{"begin":1407630600,"end":1407841200},{"begin":1407960000,"end":1408140000},{"begin":1408277700,"end":1408536000},{"begin":1408541400,"end":1408744800},{"begin":1408809600,"end":1409065200},{"begin":1409070600,"end":1409329800},{"begin":1409332800,"end":1409589000},{"begin":1409601600,"end":1409847600},{"begin":1409941800,"end":1410192000},{"begin":1410210000,"end":1410469200},{"begin":1410472800,"end":1410732000},{"begin":1410749400,"end":1410991200},{"begin":1411016280,"end":1411252200},{"begin":1411279200,"end":1411531500},{"begin":1411542000,"end":1411794960},{"begin":1411826400,"end":1412082000},{"begin":1412088480,"end":1412345340},{"begin":1412348940,"end":1412577300},{"begin":1412624700,"end":1412877600},{"begin":1412887800,"end":1412953200},],"DNMT1":[{"begin":1388527200,"end":1388530800},{"begin":1401804000,"end":1402000800},{"begin":1402131600,"end":1402174800},{"begin":1402567200,"end":1402581600},{"begin":1403096400,"end":1403096400},{"begin":1403604000,"end":1403820000},{"begin":1403891280,"end":1403953200},{"begin":1404230400,"end":1404424800},{"begin":1404640800,"end":1404722700},{"begin":1405461600,"end":1405615500},{"begin":1406154600,"end":1406293200},{"begin":1406656800,"end":1406656800},{"begin":1406930400,"end":1407024000},{"begin":1407226500,"end":1407321900},{"begin":1407623400,"end":1407841200},{"begin":1408314600,"end":1408399800},{"begin":1408635300,"end":1408821780},{"begin":1409349600,"end":1409349600},{"begin":1409683500,"end":1409841600},{"begin":1409956140,"end":1410199200},{"begin":1410253200,"end":1410420600},{"begin":1410523200,"end":1410781200},{"begin":1410793200,"end":1411036200},{"begin":1411054380,"end":1411232400},{"begin":1411395300,"end":1411601100},{"begin":1411657200,"end":1411916400},{"begin":1411922700,"end":1411922700},{"begin":1412575200,"end":1412699400},],"Lyso":[{"begin":1388530800,"end":1388530800},{"begin":1396947600,"end":1396951200},{"begin":1401804000,"end":1401984600},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403101800},{"begin":1403301600,"end":1403301600},{"begin":1405447200,"end":1405447200},{"begin":1405814400,"end":1405871100},{"begin":1406494800,"end":1406642400},{"begin":1406757600,"end":1407016800},{"begin":1407020400,"end":1407263400},{"begin":1407289200,"end":1407518100},{"begin":1407589200,"end":1407799800},{"begin":1407857400,"end":1408115700},{"begin":1408140000,"end":1408312800},{"begin":1408447800,"end":1408656240},{"begin":1408744800,"end":1408834560},{"begin":1409065200,"end":1409320800},{"begin":1409349600,"end":1409603400},{"begin":1409662800,"end":1409768100},{"begin":1410037200,"end":1410213600},{"begin":1410364800,"end":1410618600},{"begin":1410683400,"end":1410904800},{"begin":1410946200,"end":1411153200},{"begin":1411308000,"end":1411558200},{"begin":1411639200,"end":1411855200},{"begin":1411909200,"end":1412164800},{"begin":1412182800,"end":1412442000},{"begin":1412449200,"end":1412546400},],"Xyla":[{"begin":1388530800,"end":1388530800},{"begin":1401804000,"end":1401973800},{"begin":1402825080,"end":1402825080},{"begin":1405371600,"end":1405371600},{"begin":1405641000,"end":1405871100},{"begin":1406021160,"end":1406278800},{"begin":1406282400,"end":1406500200},{"begin":1407623400,"end":1407799800},{"begin":1407960000,"end":1408217040},{"begin":1408226400,"end":1408484700},{"begin":1408490760,"end":1408744800},{"begin":1408802400,"end":1408834560},{"begin":1409243400,"end":1409429700},{"begin":1409603400,"end":1409781600},{"begin":1410159600,"end":1410418800},{"begin":1410444000,"end":1410688800},{"begin":1410775200,"end":1410962400},{"begin":1411072200,"end":1411320600},{"begin":1411489800,"end":1411742700},{"begin":1411754400,"end":1411941600},{"begin":1412017200,"end":1412269200},{"begin":1412287200,"end":1412380800},],"General":[{"begin":1388530800,"end":1388530800},{"begin":1401804000,"end":1402056000},{"begin":1402070400,"end":1402261200},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403172000},{"begin":1403301600,"end":1403390400},{"begin":1403611200,"end":1403856000},{"begin":1403892000,"end":1404043200},{"begin":1404319200,"end":1404576000},{"begin":1404587400,"end":1404832260},{"begin":1404897720,"end":1405066500},{"begin":1405814400,"end":1406047200},{"begin":1406106000,"end":1406235600},{"begin":1406448000,"end":1406671200},{"begin":1406752200,"end":1406934000},{"begin":1407020400,"end":1407257040},{"begin":1407283200,"end":1407512700},{"begin":1407596700,"end":1407794400},{"begin":1407888900,"end":1408130100},{"begin":1408234500,"end":1408476000},{"begin":1408618800,"end":1408626000},{"begin":1408881600,"end":1409058000},{"begin":1409176740,"end":1409405580},{"begin":1409439600,"end":1409486400},{"begin":1409925600,"end":1410159600},{"begin":1410206400,"end":1410264000},{"begin":1410606000,"end":1410825240},{"begin":1410931800,"end":1411088400},{"begin":1411421400,"end":1411421400},{"begin":1411754400,"end":1411992000},{"begin":1412164800,"end":1412377200},{"begin":1412449200,"end":1412637600},],};
 +
var mapping = {
 +
    "p/3cuNZHSvzbmc5wGLz" : "Make a liquid culture",
 +
    "p/3wt4jvadcLzkvFn9X" : "Make a liquid culture",
 +
    "p/4jCgLAziJ2DSmmcvR" : "Streak bacteria onto an agar plate",
 +
    "p/53yEPDJz7oRihLz3M" : "Dilute DNA",
 +
    "p/5K8vL8t4egnG8SRtc" : "PCA",
 +
    "p/9S64Hy4vyzPvM4aiC" : "DNA purification (\"PCR Purification\")",
 +
    "p/9TiKPrpdykEiSHFcy" : "Make a liquid culture",
 +
    "p/ATv6a4HMeQZMa9WYX" : "Dilute DNA",
 +
    "p/Ae7BXywPx8nNApvPK" : "Golden Gate Assembly",
 +
    "p/CdKqzhX6FqmmHYKdE" : "Maxens neues Protokoll",
 +
    "p/D9hHrT2Ere5rrcuXK" : "Make competent cells",
 +
    "p/E8wraGbztRq8EsET7" : "Make a glycerol stock",
 +
    "p/ENCvtL4jWZQW72hE5" : "Restriction digest",
 +
    "p/F2oNT7tGTyGFCjAB9" : "Make competent cells",
 +
    "p/FY69K4x7xdaJT6Lzk" : "Pick a colony from an agar plate",
 +
    "p/HA9CLF2Z4kgY3J5rE" : "Make a liquid culture",
 +
    "p/JPmjNykwWASQiD9PX" : "Agarose Gel Electrophoresis",
 +
    "p/NgpLzurL2RKFojWWA" : "PCR",
 +
    "p/Nm75fDvHCr38nXJBo" : "Plasmid Preparation",
 +
    "p/P6LsqW4xkJYaXHFJN" : "Heat shock transformation",
 +
    "p/PxYonEdgff39dmkhq" : "DNA purification (\"PCR Purification\")",
 +
    "p/TD9txcymCuToDta7x" : "Annealing of complementary oligonucleotides",
 +
    "p/WSMMH3bg6CcrcAJ3x" : "PCR",
 +
    "p/ZuE3NijkBg4WwpzKc" : "Recovery of plasmid DNA from filter paper",
 +
    "p/bSEHCZgLpXJ6nb9ze" : "Streak bacteria onto an agar plate",
 +
    "p/gM7FyZeyNrM4hwxZk" : "Dissolve plasmid DNA from the registry distribution",
 +
    "p/hmhE7AHgjXE8Khw6M" : "Gel extraction",
 +
    "p/jT9cdZ9T5JgFDEJXe" : "Heat shock transformation",
 +
    "p/kKiCHxutJLzPKayCC" : "Streak bacteria onto an agar plate",
 +
    "p/kxBySpW3SnbWuYMRw" : "Streak bacteria onto an agar plate",
 +
    "p/mJNyMCoEko3JKRv5x" : "Heat shock transformation",
 +
    "p/maDx7F6ry8Mw5JmKf" : "Pick a colony from an agar plate",
 +
    "p/ms6uHrB9Fv23Tge2J" : "Make a glycerol stock",
 +
    "p/mzGLz4CZBhmDHNivi" : "Make Medium",
 +
    "p/n4Sg8s8AfhMEtQtFH" : "Ligation",
 +
    "p/oFoQguhSKQKC2Hfms" : "Gather bacteria from an agar plate",
 +
    "p/ojKqKzgeLkvNvLDgw" : "Heat shock transformation",
 +
    "p/ovMK2ktEeSommgLa2" : "Heat shock transformation",
 +
    "p/pk9LqRH9ot8JiKx23" : "Make a glycerol stock",
 +
    "p/qGNf5sATkiC4P7RqF" : "Gather bacteria from an agar plate",
 +
    "p/v97Nktv4idauP3hYh" : "Make competent cells",
 +
    "p/vB88pigyWbKvmKir6" : "Pick a colony from an agar plate",
 +
    "p/vj752RxeBbHsHi83w" : "Pick a colony from an agar plate",
 +
    "p/xBmBAjXPQntkvc8d5" : "Make a glycerol stock",
 +
    "p/z46dHCjoZpLkNgm4k" : "CPEC"
 +
}
-
//var circle;
+
var colorMapping = {"Make a liquid culture":"#1f77b4","Streak bacteria onto an agar plate":"#aec7e8","Dilute DNA":"#ff7f0e","PCA":"#ffbb78","DNA purification (\"PCR Purification\")":"#2ca02c","Golden Gate Assembly":"#98df8a","Maxens neues Protokoll":"#d62728","Make competent cells":"#ff9896","Make a glycerol stock":"#9467bd","Restriction digest":"#c5b0d5","Pick a colony from an agar plate":"#8c564b","Agarose Gel Electrophoresis":"#c49c94","PCR":"#e377c2","Plasmid Preparation":"#f7b6d2","Heat shock transformation":"#7f7f7f","Annealing of complementary oligonucleotides":"#c7c7c7","Recovery of plasmid DNA from filter paper":"#bcbd22","Dissolve plasmid DNA from the registry distribution":"#dbdb8d","Gel extraction":"#17becf","Make Medium":"#9edae5","Ligation":"#1f77b4","Gather bacteria from an agar plate":"#aec7e8","CPEC":"#ff7f0e"};
-
$(document).ready(function(){
+
-
svg = d3.selectAll("#graph");
 
-
$svg = $("#graph");
 
-
width = $svg.width();
 
-
height = $svg.height();
 
-
$svg.bind('DOMMouseScroll mousewheel', handleScrolling);
+
//var circle;
 +
$(document).ready(function(){
-
node = svg.selectAll(".node");
+
svg = d3.selectAll("#graph");
-
link = svg.selectAll(".link");
+
$svg = $("#graph");
-
force = d3.layout.force()
+
width = $svg.width();
-
      .charge(-500)
+
height = $svg.height();
-
      .linkDistance(function (d) {
+
-
      var dist = getHeight(d.target.date) - getHeight(d.source.date);
+
-
      var minDist = 50;
+
-
      if (dist < minDist) dist = minDist;
+
-
      return dist;
+
-
      })
+
-
      .linkStrength(.1)
+
-
      .gravity(0)
+
-
      .size([width, height])
+
-
      .links(flinks)
+
-
      .nodes(fnodes)
+
-
      .on("tick", tick);
+
-
     
+
-
    setSubproject("lyso", firstDate);
+
$svg.bind('DOMMouseScroll mousewheel', handleScrolling);
-
+
-
});
+
node = svg.selectAll(".node");
 +
link = svg.selectAll(".link");
 +
force = d3.layout.force()
 +
      .charge(-250)
 +
      .linkDistance(function (d) {
 +
      var dist = getHeight(d.target.date) - getHeight(d.source.date);
 +
      var minDist = 15;
 +
      if (dist < minDist) dist = minDist;
 +
      return dist;
 +
      })
 +
      .linkStrength(.1)
 +
      .gravity(0)
 +
      .size([width, height])
 +
      .links(flinks)
 +
      .nodes(fnodes)
 +
      .on("tick", tick);
 +
     
-
function update(){
+
    setSubproject("General", firstDate);
-
if(dataUpdated){
+
-
dataUpdated=false;
+
-
var links = flatten(bigLinks);
+
-
var nodes = flatten(bigNodes);
+
-
//console.log(bigNodes, nodes);
+
-
node = node.data(nodes, function(d) { return d.id;});
+
});
-
node.enter()
+
-
.append("circle")
+
-
.attr("class", "node")
+
-
.attr("r", 11)
+
-
.attr("fill", function (d) {
+
-
return colorMapping[mapping[d.type]];
+
-
})
+
-
.on("click", function(){if(d3.event.defaultPrevented) return ; alert("Silvan show Overlay");})
+
-
.call(force.drag)
+
-
.each(function(d) {
+
-
d.y = (d.date - firstDate) * heightOfSecond;
+
-
fnodes.push(d);
+
-
})
+
-
.append("svg:title")
+
-
.text(function(d){return mapping[d.type] + ", " + d.groups;});
+
-
node.exit()
+
function update(){
-
.each(function(d) { removeByID(fnodes, d.id); })
+
if(dataUpdated){
-
.remove();
+
dataUpdated=false;
 +
var links = flatten(bigLinks);
 +
var nodes = flatten(bigNodes);
-
links = links.filter(function(d) {
+
node = node.data(nodes, function(d) { return d.id;});
-
return findByID(d.target) !== undefined && findByID(d.source) !== undefined;
+
node.enter()
-
});
+
.append("circle")
-
links.forEach(function(d) {  
+
.attr("class", "node")
-
d.source = findByID(d.source);
+
.attr("r", 10)
-
d.target = findByID(d.target);
+
.attr("fill", function (d) {
-
});
+
return colorMapping[mapping[d.type]];
 +
})
 +
.on("click", function (d) {
 +
if (d3.event.defaultPrevented) return;
 +
showExperiment(d.date, d.id);
 +
})
 +
.call(force.drag)
 +
.each(function(d) {
 +
d.y = (d.date - firstDate) * heightOfSecond;
 +
fnodes.push(d);
 +
})
 +
.attr('data-toggle', 'tooltip')
 +
.attr('title', function(d){return '<strong>' + mapping[d.type] + '</strong><br />' + d.products.join('<br />');});
 +
$('#graph .node').tooltip({ html: true,
 +
    'container': 'body',
 +
    'placement': 'right' });
-
link = link.data(links);
+
node.exit()
-
var lines = link.enter()
+
.each(function(d) { removeByID(fnodes, d.id); })
-
.append("line")
+
.remove();
-
.each(function (d) {
+
-
flinks.push(d);
+
-
})
+
-
.on("click", function (d){if(d3.event.defaultPrevented) return ; scrollToDate(d.target.date-100000);})
+
-
.attr("class", "link");
+
-
//lines.filter(function () { return Math.random() > 0.5; }).attr("opacity", "0");
+
links = links.filter(function(d) {
 +
return findByID(d.target) !== undefined && findByID(d.source) !== undefined;
 +
});
 +
links.forEach(function(d) {
 +
d.source = findByID(d.source);
 +
d.target = findByID(d.target);
 +
});
-
link.exit()
+
link = link.data(links);
-
.each(function(d) {
+
var lines = link.enter()
-
var index = flinks.indexOf(findByID(d)); if(index >-1) flinks.splice(index, 1);
+
.append("line")
-
removeLinksByIDs(flinks, d.source.id, d.target.id);
+
.each(function (d) {
-
})
+
flinks.push(d);
-
.remove();
+
})
 +
.on("click", function (d){if(d3.event.defaultPrevented) return ; scrollToDate(d.target.date-100000);})
 +
.attr("class", "link");
-
force.start();
+
//lines.filter(function () { return Math.random() > 0.5; }).attr("opacity", "0");
 +
 
 +
link.exit()
 +
.each(function(d) {
 +
var index = flinks.indexOf(findByID(d)); if(index >-1) flinks.splice(index, 1);
 +
removeLinksByIDs(flinks, d.source.id, d.target.id);
 +
})
 +
.remove();
 +
 
 +
force.start();
 +
 
 +
unhighlightData(unhighlightedData);
 +
}
 +
 +
 
 +
updateVis();
-
unhighlightData(unhighlightedData);
 
}
}
-
 
-
updateVis();
+
function tick(e) {
 +
force.nodes().forEach(function(d){
 +
if(!d.fixed){
 +
              d.y += (getHeight(d.date) - d.y)  * e.alpha;
 +
              //d.y = getHeight(d.date);
 +
              if(d.x > width * 8/10){
 +
              d.x += (width*8/10 - d.x)  * e.alpha;
 +
              }else if(d.x < width * 2/10){
 +
              d.x += (width* 2/10 - d.x)  * e.alpha;
 +
              } else{
 +
              d.x += (width/2 - d.x) * e.alpha * 0.2 ;
 +
              }
 +
            }
 +
});
-
}
+
updateVis();
 +
}
-
function tick(e) {
 
-
force.nodes().forEach(function(d){
 
-
if(!d.fixed){
 
-
              d.y += (getHeight(d.date) - d.y)  * e.alpha;
 
-
              //d.y = getHeight(d.date);
 
-
              if(d.x > width * 8/10){
 
-
              d.x += (width*8/10 - d.x)  * e.alpha;
 
-
              }else if(d.x < width * 2/10){
 
-
              d.x += (width* 2/10 - d.x)  * e.alpha;
 
-
              } else{
 
-
              d.x += (width/2 - d.x) * e.alpha * 0.2 ;
 
-
              }
 
-
            }
 
-
});
 
-
updateVis();
+
function updateVis(){
-
}
+
node.attr("cx", function(d) { return d.x; })
 +
.attr("cy", function(d) { return d.y - (date - firstDate) * heightOfSecond; });
 +
link
 +
.attr("x1", function(d) {  if(d.source !== undefined) return d.source.x; else return d.target.x; })
 +
.attr("y1", function(d) {  if(d.source !== undefined) return d.source.y - (date - firstDate) * heightOfSecond; else return 0;})
 +
.attr("x2", function(d) {  if(d.target !== undefined) return d.target.x; else return d.source.x; })
 +
.attr("y2", function(d) {  if(d.target !== undefined) return d.target.y - (date - firstDate) * heightOfSecond; else return viewportHeight * heightOfSecond;});
 +
}
-
function updateVis(){
+
function setSubproject(project, d){
-
node.attr("cx", function(d) { return d.x; })
+
dateJSONMatchingList = undefined;
-
.attr("cy", function(d) { return d.y - (date - firstDate) * heightOfSecond; });
+
if(d === undefined) d = date;
 +
this.selectedProject = project;
 +
unhighlightedData = project == 'General' ? [] : ['General'];
 +
unloadGreaterDate(firstDate-1);
-
link
+
loadDate(d-bufferHeight);
-
.attr("x1", function(d) {  if(d.source !== undefined) return d.source.x; else return d.target.x; })
+
    loadDate(d);
-
.attr("y1", function(d) {  if(d.source !== undefined) return d.source.y - (date - firstDate) * heightOfSecond; else return 0;})
+
    loadDate(d+viewportHeight);
-
.attr("x2", function(d) {  if(d.target !== undefined) return d.target.x; else return d.source.x; })
+
    loadDate(d+viewportHeight+bufferHeight);
-
.attr("y2", function(d) {  if(d.target !== undefined) return d.target.y - (date - firstDate) * heightOfSecond; else return viewportHeight * heightOfSecond;});
+
    setDate(d);
-
}
+
}
-
function setSubproject(project, d){
+
function setDate(date){
-
if(d === undefined) d = date;
+
/*if(date < firstDate){
-
this.selectedProject = project;
+
date = firstDate;
-
unhighlightedData = [];
+
}*/
-
unloadGreaterDate(firstDate-1);
+
var lastDateDisplayed = date + viewportHeight;
 +
loadDate(date - bufferHeight);
 +
loadDate(lastDateDisplayed + bufferHeight);
 +
unloadSmallerDate(date - bufferHeight);
 +
unloadGreaterDate(lastDateDisplayed + bufferHeight);
 +
this.date = date;
 +
update();
 +
updateToTimestamp(date, false);
 +
}
-
loadDate(d-bufferHeight);
+
/*function animateFlow(){
-
    loadDate(d);
+
var links = flatten(bigLinks);
-
    loadDate(d+viewportHeight);
+
var x = Math.floor(links.length * Math.random());
-
    loadDate(d+viewportHeight+bufferHeight);
+
xs.push(x);
-
    setDate(d);
+
var l = links[x];
-
}
+
svg.append("ellipse")
 +
.attr("fill", "#33CC33")
 +
.attr("rx", ( l.target.x -  l.source.x)/100)
 +
.attr("ry", ( l.target.y -  l.source.y)/100)
 +
.attr("cx", l.source.x)
 +
.attr("cy", l.source.y)
 +
  .transition()
 +
.duration(1000000/(( l.target.x -  l.source.x) + ( l.target.y -  l.source.y)))
 +
.ease("linear")
 +
.attr("cx", l.target.x)
 +
.attr("cy", l.target.y)
 +
.remove();
-
function setDate(date){
 
-
/*if(date < firstDate){
 
-
date = firstDate;
 
}*/
}*/
-
var lastDateDisplayed = date + viewportHeight;
 
-
loadDate(date - bufferHeight);
 
-
loadDate(lastDateDisplayed + bufferHeight);
 
-
unloadSmallerDate(date - bufferHeight);
 
-
unloadGreaterDate(lastDateDisplayed + bufferHeight);
 
-
this.date = date;
 
-
update();
 
-
}
 
-
/*function animateFlow(){
+
function scrollToDate(d){
-
var links = flatten(bigLinks);
+
var currentDate = date;
-
var x = Math.floor(links.length * Math.random());
+
var dif = d - currentDate;
-
xs.push(x);
+
console.log(dif);
-
var l = links[x];
+
var smoothness = 60; //30 FPS
-
svg.append("ellipse")
+
var i = 0;
-
.attr("fill", "#33CC33")
+
var max = 1 * smoothness; //1 sec.
-
.attr("rx", ( l.target.x -  l.source.x)/100)
+
var interval = setInterval(function(){
-
.attr("ry", ( l.target.y -  l.source.y)/100)
+
i=i+1;
-
.attr("cx", l.source.x)
+
if(i > max){
-
.attr("cy", l.source.y)
+
clearInterval(interval);
-
  .transition()
+
}
-
.duration(1000000/(( l.target.x -  l.source.x) + ( l.target.y -  l.source.y)))
+
setDate(date+ dif/max)
-
.ease("linear")
+
}, max*1000/smoothness/smoothness);
-
.attr("cx", l.target.x)
+
}
-
.attr("cy", l.target.y)
+
-
.remove();
+
-
}*/
+
function highlightData(typeName){
 +
var array = [].concat(typeName);
 +
node.attr("opacity", function(d){
 +
var h = false;
 +
for(var g = 0; g < array.length; g=g+1) {
 +
h = h || d.groups.indexOf(array[g]) !== -1;
 +
}
 +
if(h) return 1.0;
 +
else return 0.1;
 +
});
 +
link.attr("opacity", function(d){
 +
var h = false;
 +
for(var g = 0; g < array.length; g=g+1) {
 +
h = h || (d.target && d.target.groups.indexOf(array[g]) !== -1 && d.source && d.source.groups.indexOf(array[g]) !== -1);
 +
}
-
function scrollToDate(d){
+
if(h) return 1;
-
var currentDate = date;
+
else return 0.1;
-
var dif = d - currentDate;
+
});
-
console.log(dif);
+
}
-
var smoothness = 60; //30 FPS
+
-
var i = 0;
+
-
var max = 1 * smoothness; //1 sec.
+
-
var interval = setInterval(function(){
+
-
i=i+1;
+
-
if(i > max){
+
-
clearInterval(interval);
+
-
}
+
-
setDate(date+ dif/max)
+
-
}, max*1000/smoothness/smoothness);
+
-
}
+
-
function highlightData(typeName){
+
function unhighlightData(typeName){
-
var array = [].concat(typeName);
+
var array = [].concat(typeName);
-
console.log(array);
+
node.attr("opacity", function(d){
-
node.attr("opacity", function(d){
+
var h = false;
-
var h = false;
+
for(var g = 0; g < array.length; g=g+1) {
-
for(var g = 0; g < array.length; g=g+1) {
+
h = h || d.groups.indexOf(array[g]) !== -1;
-
h = h || d.groups.indexOf(array[g]) !== -1;
+
}
-
}
+
if(h) return 0.1;
-
if(h) return 1.0;
+
else return 1.0;
-
else return 0.1;
+
});
-
});
+
link.attr("opacity", function(d){
-
link.attr("opacity", function(d){
+
var h = false;
-
var h = false;
+
for(var g = 0; g < array.length; g=g+1) {
-
for(var g = 0; g < array.length; g=g+1) {
+
h = h || ((d.target && d.target.groups.indexOf(array[g]) !== -1) || (d.source && d.source.groups.indexOf(array[g]) !== -1));
-
h = h || (d.target && d.target.groups.indexOf(array[g]) !== -1 && d.source && d.source.groups.indexOf(array[g]) !== -1);
+
}
-
}
+
-
if(h) return 1;
+
if(h) return 0.1;
-
else return 0.1;
+
else return 1.0;
-
});
+
});
-
}
+
for(i = 0; i < array.length; i=i+1){
-
 
+
if(unhighlightedData.indexOf(array[i]) === -1) unhighlightedData.push(array[i]);
-
function unhighlightData(typeName){
+
-
var array = [].concat(typeName);
+
-
console.log(array);
+
-
node.attr("opacity", function(d){
+
-
var h = false;
+
-
for(var g = 0; g < array.length; g=g+1) {
+
-
h = h || d.groups.indexOf(array[g]) !== -1;
+
}
}
-
if(h) return 0.1;
 
-
else return 1.0;
 
-
});
 
-
link.attr("opacity", function(d){
 
-
var h = false;
 
-
for(var g = 0; g < array.length; g=g+1) {
 
-
h = h || ((d.target && d.target.groups.indexOf(array[g]) !== -1) || (d.source && d.source.groups.indexOf(array[g]) !== -1));
 
-
}
 
-
 
-
if(h) return 0.1;
 
-
else return 1.0;
 
-
});
 
-
for(i = 0; i < array.length; i=i+1){
 
-
if(unhighlightedData.indexOf(array[i]) === -1) unhighlightedData.push(array[i]);
 
}
}
-
}
 
-
//////***************************************Helper Function*************************************/
+
//////***************************************Helper Function*************************************/
-
function findByID(id){
+
function findByID(id){
-
return $.grep(fnodes, function(e){return e === id || e.id === id;})[0];
+
return $.grep(fnodes, function(e){return e === id || e.id === id;})[0];
-
}
+
}
-
function removeByID(array, id){
+
function removeByID(array, id){
-
var index = -1;
+
var index = -1;
-
for(i = 0; i<array.length; i=i+1){
+
for(i = 0; i<array.length; i=i+1){
-
if(array[i].id === id){
+
if(array[i].id === id){
-
index = i;
+
index = i;
-
break;
+
break;
 +
}
}
}
 +
array.splice(index, 1);
}
}
-
array.splice(index, 1);
 
-
}
 
-
function removeLinksByIDs(array, sourceId, targetId){
+
function removeLinksByIDs(array, sourceId, targetId){
-
var index = -1;
+
var index = -1;
-
for(i = 0; i<array.length; i=i+1){
+
for(i = 0; i<array.length; i=i+1){
-
if(array[i].source.id === sourceId && array[i].target.id === targetId){
+
if(array[i].source.id === sourceId && array[i].target.id === targetId){
-
index = i;
+
index = i;
-
break;
+
break;
 +
}
}
}
 +
array.splice(index, 1);
}
}
-
array.splice(index, 1);
 
-
}
 
-
function getHeight(date){
+
function getHeight(date){
-
return (date - firstDate)*heightOfSecond;
+
return (date - firstDate)*heightOfSecond;
-
}
+
}
-
/***************************************************************************************************/
+
/***************************************************************************************************/
-
/************************************Scrolling and JSON loading stuff*******************************/
+
/************************************Scrolling and JSON loading stuff*******************************/
-
+
-
+
-
/*var loadedJSONFiles = [];
+
/*var loadedJSONFiles = [];
-
var lastLoadedJSON = -1;
+
var lastLoadedJSON = -1;
-
var firstLoadedJSON = 0;*/
+
var firstLoadedJSON = 0;*/
-
var dateJSONMatchingList;
+
var dateJSONMatchingList;
-
var dataUpdated = false;
+
var dataUpdated = false;
-
var loadingData = false;
+
var loadingData = false;
-
function flatten(a){
+
function flatten(a){
-
return a.reduce(extractAndMergeData, []);
+
return a.reduce(extractAndMergeData, []);
-
}
+
}
 +
 
 +
function extractAndMergeData(a, b){
 +
return a.concat(b.data);
 +
}
-
function extractAndMergeData(a, b){
+
function getFileURL(file) {
-
return a.concat(b.data);
+
var md5Name = md5(file);
 +
return '/wiki/images/' + md5Name.substr(0, 1) + '/' + md5Name.substr(0, 2) + '/' + file;  
}
}
-
function getJSONForDate(date){
+
function getJSONForDate(date){
-
if(dateJSONMatchingList === undefined){
+
if(dateJSONMatchingList === undefined){
-
dateJSONMatchingList = [];
+
dateJSONMatchingList = [];
-
for(i = 0; i < jsonFiles.length; i=i+1){
+
for(i = 0; i < jsonFiles[selectedProject].length; i=i+1){
-
var name =  jsonFiles[i];
+
var file =  jsonFiles[selectedProject][i];
-
var f = parseFileNameToContainsFnc(name);
+
var f = (function (file) {
-
dateJSONMatchingList.push(f);
+
return function(d){
 +
return d >= file.begin && d <= file.end;
 +
};
 +
})(file);
 +
dateJSONMatchingList.push({
 +
fun: f,
 +
file: getFileURL('Heidelberg_Notebook_Data_' + selectedProject + '_summary_' + file.begin + '_' + file.end + '.txt'),
 +
detailedFile: getFileURL('Heidelberg_Notebook_Data_' + selectedProject + '_detailed_' + file.begin + '_' + file.end + '.txt'),
 +
begin: file.begin,
 +
end: file.end,
 +
});
 +
}
}
}
 +
for(j = 0; j < dateJSONMatchingList.length; j=j+1){
 +
if(dateJSONMatchingList[j].fun(date)) return dateJSONMatchingList[j];
 +
}
 +
return -1;
}
}
-
for(j = 0; j < dateJSONMatchingList.length; j=j+1){
 
-
if(dateJSONMatchingList[j](date)) return jsonFiles[j];
 
-
}
 
-
return -1;
 
-
}
 
-
function loadDate(date){
+
function loadDate(date){
-
//Check if date is already loaded
+
//Check if date is already loaded
-
if(!isDateLoaded(date)){
+
if(!isDateLoaded(date)){
-
//Load new date
+
//Load new date
-
var json = getJSONForDate(date);
+
var json = getJSONForDate(date);
-
if(json !== -1){
+
if(json !== -1){
-
var file = "Team_Heidelberg_Notebook_Data_test_"+ json;
+
d3.json(json.file, function(error, data){
-
console.log(md5);
+
if(error) console.warn(error);
-
d3.json("/wiki/images/"+ (md5(file)+"")[0]+"/"+(md5(file)+"").substr(0,2)+"/"+file, function(error, data){
+
var containsFnc = json.fun;
-
if(error) console.warn(error);
+
var smallerFnc = (function(l1, l2){
-
var containsFnc = parseFileNameToContainsFnc(json);
+
return function(d){
-
var smallerFnc = parseFileNameToSmallerFnc(json);
+
return d < l1 && d < l2;
-
var greaterFnc = parseFileNameToGreaterFnc(json);
+
};
-
if(!isDateLoaded(date)){ //Attention this could lead due to the asynchronous nature of d3.json to a race condition and double adding of the nodes and links...
+
})(json.begin, json.end);
-
bigNodes.push({
+
var greaterFnc = (function(l1, l2){
-
contains: containsFnc,
+
return function(d){
-
greater: greaterFnc,
+
return d > l1 && d > l2;
-
smaller: smallerFnc,
+
};
-
data: data.nodes
+
})(json.begin, json.end);
-
});
+
if(!isDateLoaded(date)){ //Attention this could lead due to the asynchronous nature of d3.json to a race condition and double adding of the nodes and links...
-
bigLinks.push({
+
bigNodes.push({
-
contains: containsFnc,
+
contains: containsFnc,
-
greater: greaterFnc,
+
greater: greaterFnc,
-
smaller: smallerFnc,
+
smaller: smallerFnc,
-
data: data.links
+
data: data.nodes
-
});
+
});
-
dataUpdated = true;
+
bigLinks.push({
-
}
+
contains: containsFnc,
-
update();
+
greater: greaterFnc,
-
});
+
smaller: smallerFnc,
 +
data: data.links
 +
});
 +
dataUpdated = true;
 +
}
 +
update();
 +
});
 +
}
}
}
 +
}
}
-
}
+
function unloadSmallerDate(date){
 +
if(bigNodes.reduce(function(a, b){return a || b.greater(date);}, false)){
 +
bigNodes = bigNodes.filter(function(d){return !d.greater(date);});
 +
bigLinks = bigLinks.filter(function(d){return !d.greater(date);});
 +
dataUpdated = true;
-
function unloadSmallerDate(date){
+
}
-
if(bigNodes.reduce(function(a, b){return a || b.greater(date);}, false)){
+
}
-
bigNodes = bigNodes.filter(function(d){return !d.greater(date);});
+
-
bigLinks = bigLinks.filter(function(d){return !d.greater(date);});
+
-
dataUpdated = true;
+
 +
function unloadGreaterDate(date){
 +
if(bigNodes.reduce(function(a, b){return a || b.smaller(date);}, false)){
 +
bigNodes = bigNodes.filter(function(d){return !d.smaller(date);});
 +
bigLinks = bigLinks.filter(function(d){return !d.smaller(date);});
 +
dataUpdated = true;
 +
}
}
}
-
}
 
-
function unloadGreaterDate(date){
+
function parseFileName(name){
-
if(bigNodes.reduce(function(a, b){return a || b.smaller(date);}, false)){
+
var l = name.substring(0, name.length-4).split("_");
-
bigNodes = bigNodes.filter(function(d){return !d.smaller(date);});
+
if(l === undefined || l.length !== 2) console.warn("erroneous file name", name, l);
-
bigLinks = bigLinks.filter(function(d){return !d.smaller(date);});
+
return l;
-
dataUpdated = true;
+
}
}
-
}
 
-
function parseFileName(name){
+
function parseFileNameToContainsFnc(name){
-
var l = name.substring(0, name.length-4).split("_");
+
var l = parseFileName(name);
-
if(l === undefined || l.length !== 2) console.warn("erroneous file name", name, l);
+
var f = function(l1, l2){
-
return l;
+
return function(d){
-
}
+
return d >= l1 && d <= l2;
 +
};
 +
}(l[0], l[1]);
 +
return f;
 +
}
-
function parseFileNameToContainsFnc(name){
+
function parseFileNameToSmallerFnc(name){
-
var l = parseFileName(name);
+
var l  = parseFileName(name);
-
var f = function(l1, l2){
+
var f = function(l1, l2){
-
return function(d){
+
return function(d){
-
return d >= l1 && d <= l2;
+
return d < l1 && d < l2;
-
};
+
};
-
}(l[0], l[1]);
+
}(l[0], l[1]);
-
return f;
+
return f;
-
}
+
}
-
 
+
function parseFileNameToGreaterFnc(name){
-
function parseFileNameToSmallerFnc(name){
+
var l = parseFileName(name);
-
var l  = parseFileName(name);
+
var f = function(l1, l2){
-
var f = function(l1, l2){
+
return function(d){
-
return function(d){
+
return d > l1 && d > l2;
-
return d < l1 && d < l2;
+
};
-
};
+
}(l[0], l[1]);
-
}(l[0], l[1]);
+
return f;
-
return f;
+
}
-
}
+
-
function parseFileNameToGreaterFnc(name){
+
-
var l = parseFileName(name);
+
-
var f = function(l1, l2){
+
-
return function(d){
+
-
return d > l1 && d > l2;
+
-
};
+
-
}(l[0], l[1]);
+
-
return f;
+
-
}
+
-
function isDateLoaded(date){
+
function isDateLoaded(date){
-
for(i = 0; i < bigNodes.length; i=i+1){
+
for(i = 0; i < bigNodes.length; i=i+1){
-
if(bigNodes[i].contains(date)){
+
if(bigNodes[i].contains(date)){
-
return true;
+
return true;
 +
}
}
}
 +
return false;
}
}
-
return false;
 
-
}
 
-
function handleScrolling(e) {
+
function handleScrolling(e) {
-
var scrollTo = 0;
+
var scrollTo = 0;
-
    e.preventDefault();
+
    e.preventDefault();
-
    if (e.type == 'mousewheel') {
+
    if (e.type == 'mousewheel') {
-
        scrollTo = (e.originalEvent.wheelDelta * -scrollSpeed/100);
+
        scrollTo = (e.originalEvent.wheelDelta * -scrollSpeed/100);
-
    }else if (e.type == 'DOMMouseScroll') {
+
    }else if (e.type == 'DOMMouseScroll') {
-
        scrollTo = e.originalEvent.detail * scrollSpeed;
+
        scrollTo = e.originalEvent.detail * scrollSpeed;
-
    }
+
    }
-
    setDate(date+scrollTo);
+
    setDate(date+scrollTo);
-
}
+
}

Latest revision as of 23:51, 17 October 2014

function md5cycle(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=ff(n,r,i,s,t[0],7,-680876936);s=ff(s,n,r,i,t[1],12,-389564586);i=ff(i,s,n,r,t[2],17,606105819);r=ff(r,i,s,n,t[3],22,-1044525330);n=ff(n,r,i,s,t[4],7,-176418897);s=ff(s,n,r,i,t[5],12,1200080426);i=ff(i,s,n,r,t[6],17,-1473231341);r=ff(r,i,s,n,t[7],22,-45705983);n=ff(n,r,i,s,t[8],7,1770035416);s=ff(s,n,r,i,t[9],12,-1958414417);i=ff(i,s,n,r,t[10],17,-42063);r=ff(r,i,s,n,t[11],22,-1990404162);n=ff(n,r,i,s,t[12],7,1804603682);s=ff(s,n,r,i,t[13],12,-40341101);i=ff(i,s,n,r,t[14],17,-1502002290);r=ff(r,i,s,n,t[15],22,1236535329);n=gg(n,r,i,s,t[1],5,-165796510);s=gg(s,n,r,i,t[6],9,-1069501632);i=gg(i,s,n,r,t[11],14,643717713);r=gg(r,i,s,n,t[0],20,-373897302);n=gg(n,r,i,s,t[5],5,-701558691);s=gg(s,n,r,i,t[10],9,38016083);i=gg(i,s,n,r,t[15],14,-660478335);r=gg(r,i,s,n,t[4],20,-405537848);n=gg(n,r,i,s,t[9],5,568446438);s=gg(s,n,r,i,t[14],9,-1019803690);i=gg(i,s,n,r,t[3],14,-187363961);r=gg(r,i,s,n,t[8],20,1163531501);n=gg(n,r,i,s,t[13],5,-1444681467);s=gg(s,n,r,i,t[2],9,-51403784);i=gg(i,s,n,r,t[7],14,1735328473);r=gg(r,i,s,n,t[12],20,-1926607734);n=hh(n,r,i,s,t[5],4,-378558);s=hh(s,n,r,i,t[8],11,-2022574463);i=hh(i,s,n,r,t[11],16,1839030562);r=hh(r,i,s,n,t[14],23,-35309556);n=hh(n,r,i,s,t[1],4,-1530992060);s=hh(s,n,r,i,t[4],11,1272893353);i=hh(i,s,n,r,t[7],16,-155497632);r=hh(r,i,s,n,t[10],23,-1094730640);n=hh(n,r,i,s,t[13],4,681279174);s=hh(s,n,r,i,t[0],11,-358537222);i=hh(i,s,n,r,t[3],16,-722521979);r=hh(r,i,s,n,t[6],23,76029189);n=hh(n,r,i,s,t[9],4,-640364487);s=hh(s,n,r,i,t[12],11,-421815835);i=hh(i,s,n,r,t[15],16,530742520);r=hh(r,i,s,n,t[2],23,-995338651);n=ii(n,r,i,s,t[0],6,-198630844);s=ii(s,n,r,i,t[7],10,1126891415);i=ii(i,s,n,r,t[14],15,-1416354905);r=ii(r,i,s,n,t[5],21,-57434055);n=ii(n,r,i,s,t[12],6,1700485571);s=ii(s,n,r,i,t[3],10,-1894986606);i=ii(i,s,n,r,t[10],15,-1051523);r=ii(r,i,s,n,t[1],21,-2054922799);n=ii(n,r,i,s,t[8],6,1873313359);s=ii(s,n,r,i,t[15],10,-30611744);i=ii(i,s,n,r,t[6],15,-1560198380);r=ii(r,i,s,n,t[13],21,1309151649);n=ii(n,r,i,s,t[4],6,-145523070);s=ii(s,n,r,i,t[11],10,-1120210379);i=ii(i,s,n,r,t[2],15,718787259);r=ii(r,i,s,n,t[9],21,-343485551);e[0]=add32(n,e[0]);e[1]=add32(r,e[1]);e[2]=add32(i,e[2]);e[3]=add32(s,e[3])}function cmn(e,t,n,r,i,s){t=add32(add32(t,e),add32(r,s));return add32(t<>>32-i,n)}function ff(e,t,n,r,i,s,o){return cmn(t&n|~t&r,e,t,i,s,o)}function gg(e,t,n,r,i,s,o){return cmn(t&r|n&~r,e,t,i,s,o)}function hh(e,t,n,r,i,s,o){return cmn(t^n^r,e,t,i,s,o)}function ii(e,t,n,r,i,s,o){return cmn(n^(t|~r),e,t,i,s,o)}function md51(e){txt="";var t=e.length,n=[1732584193,-271733879,-1732584194,271733878],r;for(r=64;r<=e.length;r+=64){md5cycle(n,md5blk(e.substring(r-64,r)))}e=e.substring(r-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<e.length;r++)i[r>>2]|=e.charCodeAt(r)<<(r%4<<3);i[r>>2]|=128<<(r%4<<3);if(r>55){md5cycle(n,i);for(r=0;r<16;r++)i[r]=0}i[14]=t*8;md5cycle(n,i);return n}function md5blk(e){var t=[],n;for(n=0;n<64;n+=4){t[n>>2]=e.charCodeAt(n)+(e.charCodeAt(n+1)<<8)+(e.charCodeAt(n+2)<<16)+(e.charCodeAt(n+3)<<24)}return t}function rhex(e){var t="",n=0;for(;n<4;n++)t+=hex_chr[e>>n*8+4&15]+hex_chr[e>>n*8&15];return t}function hex(e){for(var t=0;t<e.length;t++)e[t]=rhex(e[t]);return e.join("")}function md5(e){return hex(md51(e))}function add32(e,t){return e+t&4294967295}var hex_chr="0123456789abcdef".split("");if(md5("hello")!="5d41402abc4b2a76b9719d911017c592"){function add32(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}}

var svg; var color = d3.scale.category20();

var firstDate = 1401573600;//1407861000; var date = firstDate;

var heightOfSecond = 100 / 86400; // = 300 Pixel per day?! var viewportHeight = 300/heightOfSecond; var bufferHeight = 1000/heightOfSecond; var scrollSpeed = 6000; // = 20 minutes

var width = 1; var height = 1;

var bigNodes = []; //Contains [{containsDate(), [data]},...] var bigLinks = [];

var fnodes = []; var flinks = []; var force;

var node; var link;

var selectedProject;

var unhighlightedData = []

var jsonFiles = {"Toolbox":[{"begin":1388527200,"end":1388530800},{"begin":1392040800,"end":1392072300},{"begin":1396947600,"end":1396951200},{"begin":1401804000,"end":1402056000},{"begin":1402070400,"end":1402234200},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403172000},{"begin":1403301600,"end":1403390400},{"begin":1403598600,"end":1403789400},{"begin":1403859600,"end":1403958600},{"begin":1404134400,"end":1404388800},{"begin":1404403680,"end":1404660346},{"begin":1404664800,"end":1404849600},{"begin":1404932400,"end":1405186800},{"begin":1405193400,"end":1405447200},{"begin":1405458000,"end":1405641000},{"begin":1405720800,"end":1405980000},{"begin":1406021160,"end":1406278800},{"begin":1406282400,"end":1406539200},{"begin":1406543880,"end":1406757600},{"begin":1406808000,"end":1407067200},{"begin":1407070800,"end":1407330000},{"begin":1407330600,"end":1407580200},{"begin":1407596700,"end":1407855600},{"begin":1407857400,"end":1408115700},{"begin":1408117620,"end":1408376700},{"begin":1408377600,"end":1408636800},{"begin":1408642200,"end":1408901220},{"begin":1408911600,"end":1409170200},{"begin":1409173200,"end":1409432400},{"begin":1409436000,"end":1409695200},{"begin":1409697000,"end":1409955000},{"begin":1409957940,"end":1410215400},{"begin":1410220800,"end":1410453000},{"begin":1410512400,"end":1410771600},{"begin":1410775200,"end":1411034400},{"begin":1411036200,"end":1411295400},{"begin":1411336800,"end":1411596000},{"begin":1411598280,"end":1411855200},{"begin":1411863840,"end":1412114700},{"begin":1412134500,"end":1412380800},{"begin":1412414880,"end":1412655300},{"begin":1412681400,"end":1412905020},{"begin":1412995020,"end":1413085020},],"LOV":[{"begin":1388530800,"end":1388530800},{"begin":1392040800,"end":1392044400},{"begin":1401804000,"end":1402000800},{"begin":1402070400,"end":1402234200},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403172000},{"begin":1403301600,"end":1403301600},{"begin":1403604000,"end":1403863200},{"begin":1403866800,"end":1404064800},{"begin":1404203520,"end":1404424800},{"begin":1404511200,"end":1404770400},{"begin":1404807600,"end":1404938700},{"begin":1405112400,"end":1405371600},{"begin":1405447200,"end":1405641000},{"begin":1405720800,"end":1405871100},{"begin":1406021160,"end":1406278800},{"begin":1406282400,"end":1406500200},{"begin":1406543880,"end":1406757600},{"begin":1406808000,"end":1407024000},{"begin":1407070800,"end":1407323460},{"begin":1407369600,"end":1407623400},{"begin":1407630600,"end":1407841200},{"begin":1407960000,"end":1408140000},{"begin":1408277700,"end":1408536000},{"begin":1408541400,"end":1408744800},{"begin":1408809600,"end":1409065200},{"begin":1409070600,"end":1409329800},{"begin":1409332800,"end":1409589000},{"begin":1409601600,"end":1409847600},{"begin":1409941800,"end":1410192000},{"begin":1410210000,"end":1410469200},{"begin":1410472800,"end":1410732000},{"begin":1410749400,"end":1410991200},{"begin":1411016280,"end":1411252200},{"begin":1411279200,"end":1411531500},{"begin":1411542000,"end":1411794960},{"begin":1411826400,"end":1412082000},{"begin":1412088480,"end":1412345340},{"begin":1412348940,"end":1412577300},{"begin":1412624700,"end":1412877600},{"begin":1412887800,"end":1412953200},],"DNMT1":[{"begin":1388527200,"end":1388530800},{"begin":1401804000,"end":1402000800},{"begin":1402131600,"end":1402174800},{"begin":1402567200,"end":1402581600},{"begin":1403096400,"end":1403096400},{"begin":1403604000,"end":1403820000},{"begin":1403891280,"end":1403953200},{"begin":1404230400,"end":1404424800},{"begin":1404640800,"end":1404722700},{"begin":1405461600,"end":1405615500},{"begin":1406154600,"end":1406293200},{"begin":1406656800,"end":1406656800},{"begin":1406930400,"end":1407024000},{"begin":1407226500,"end":1407321900},{"begin":1407623400,"end":1407841200},{"begin":1408314600,"end":1408399800},{"begin":1408635300,"end":1408821780},{"begin":1409349600,"end":1409349600},{"begin":1409683500,"end":1409841600},{"begin":1409956140,"end":1410199200},{"begin":1410253200,"end":1410420600},{"begin":1410523200,"end":1410781200},{"begin":1410793200,"end":1411036200},{"begin":1411054380,"end":1411232400},{"begin":1411395300,"end":1411601100},{"begin":1411657200,"end":1411916400},{"begin":1411922700,"end":1411922700},{"begin":1412575200,"end":1412699400},],"Lyso":[{"begin":1388530800,"end":1388530800},{"begin":1396947600,"end":1396951200},{"begin":1401804000,"end":1401984600},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403101800},{"begin":1403301600,"end":1403301600},{"begin":1405447200,"end":1405447200},{"begin":1405814400,"end":1405871100},{"begin":1406494800,"end":1406642400},{"begin":1406757600,"end":1407016800},{"begin":1407020400,"end":1407263400},{"begin":1407289200,"end":1407518100},{"begin":1407589200,"end":1407799800},{"begin":1407857400,"end":1408115700},{"begin":1408140000,"end":1408312800},{"begin":1408447800,"end":1408656240},{"begin":1408744800,"end":1408834560},{"begin":1409065200,"end":1409320800},{"begin":1409349600,"end":1409603400},{"begin":1409662800,"end":1409768100},{"begin":1410037200,"end":1410213600},{"begin":1410364800,"end":1410618600},{"begin":1410683400,"end":1410904800},{"begin":1410946200,"end":1411153200},{"begin":1411308000,"end":1411558200},{"begin":1411639200,"end":1411855200},{"begin":1411909200,"end":1412164800},{"begin":1412182800,"end":1412442000},{"begin":1412449200,"end":1412546400},],"Xyla":[{"begin":1388530800,"end":1388530800},{"begin":1401804000,"end":1401973800},{"begin":1402825080,"end":1402825080},{"begin":1405371600,"end":1405371600},{"begin":1405641000,"end":1405871100},{"begin":1406021160,"end":1406278800},{"begin":1406282400,"end":1406500200},{"begin":1407623400,"end":1407799800},{"begin":1407960000,"end":1408217040},{"begin":1408226400,"end":1408484700},{"begin":1408490760,"end":1408744800},{"begin":1408802400,"end":1408834560},{"begin":1409243400,"end":1409429700},{"begin":1409603400,"end":1409781600},{"begin":1410159600,"end":1410418800},{"begin":1410444000,"end":1410688800},{"begin":1410775200,"end":1410962400},{"begin":1411072200,"end":1411320600},{"begin":1411489800,"end":1411742700},{"begin":1411754400,"end":1411941600},{"begin":1412017200,"end":1412269200},{"begin":1412287200,"end":1412380800},],"General":[{"begin":1388530800,"end":1388530800},{"begin":1401804000,"end":1402056000},{"begin":1402070400,"end":1402261200},{"begin":1402567200,"end":1402825080},{"begin":1403030400,"end":1403172000},{"begin":1403301600,"end":1403390400},{"begin":1403611200,"end":1403856000},{"begin":1403892000,"end":1404043200},{"begin":1404319200,"end":1404576000},{"begin":1404587400,"end":1404832260},{"begin":1404897720,"end":1405066500},{"begin":1405814400,"end":1406047200},{"begin":1406106000,"end":1406235600},{"begin":1406448000,"end":1406671200},{"begin":1406752200,"end":1406934000},{"begin":1407020400,"end":1407257040},{"begin":1407283200,"end":1407512700},{"begin":1407596700,"end":1407794400},{"begin":1407888900,"end":1408130100},{"begin":1408234500,"end":1408476000},{"begin":1408618800,"end":1408626000},{"begin":1408881600,"end":1409058000},{"begin":1409176740,"end":1409405580},{"begin":1409439600,"end":1409486400},{"begin":1409925600,"end":1410159600},{"begin":1410206400,"end":1410264000},{"begin":1410606000,"end":1410825240},{"begin":1410931800,"end":1411088400},{"begin":1411421400,"end":1411421400},{"begin":1411754400,"end":1411992000},{"begin":1412164800,"end":1412377200},{"begin":1412449200,"end":1412637600},],};

var mapping = { "p/3cuNZHSvzbmc5wGLz" : "Make a liquid culture", "p/3wt4jvadcLzkvFn9X" : "Make a liquid culture", "p/4jCgLAziJ2DSmmcvR" : "Streak bacteria onto an agar plate", "p/53yEPDJz7oRihLz3M" : "Dilute DNA", "p/5K8vL8t4egnG8SRtc" : "PCA", "p/9S64Hy4vyzPvM4aiC" : "DNA purification (\"PCR Purification\")", "p/9TiKPrpdykEiSHFcy" : "Make a liquid culture", "p/ATv6a4HMeQZMa9WYX" : "Dilute DNA", "p/Ae7BXywPx8nNApvPK" : "Golden Gate Assembly", "p/CdKqzhX6FqmmHYKdE" : "Maxens neues Protokoll", "p/D9hHrT2Ere5rrcuXK" : "Make competent cells", "p/E8wraGbztRq8EsET7" : "Make a glycerol stock", "p/ENCvtL4jWZQW72hE5" : "Restriction digest", "p/F2oNT7tGTyGFCjAB9" : "Make competent cells", "p/FY69K4x7xdaJT6Lzk" : "Pick a colony from an agar plate", "p/HA9CLF2Z4kgY3J5rE" : "Make a liquid culture", "p/JPmjNykwWASQiD9PX" : "Agarose Gel Electrophoresis", "p/NgpLzurL2RKFojWWA" : "PCR", "p/Nm75fDvHCr38nXJBo" : "Plasmid Preparation", "p/P6LsqW4xkJYaXHFJN" : "Heat shock transformation", "p/PxYonEdgff39dmkhq" : "DNA purification (\"PCR Purification\")", "p/TD9txcymCuToDta7x" : "Annealing of complementary oligonucleotides", "p/WSMMH3bg6CcrcAJ3x" : "PCR", "p/ZuE3NijkBg4WwpzKc" : "Recovery of plasmid DNA from filter paper", "p/bSEHCZgLpXJ6nb9ze" : "Streak bacteria onto an agar plate", "p/gM7FyZeyNrM4hwxZk" : "Dissolve plasmid DNA from the registry distribution", "p/hmhE7AHgjXE8Khw6M" : "Gel extraction", "p/jT9cdZ9T5JgFDEJXe" : "Heat shock transformation", "p/kKiCHxutJLzPKayCC" : "Streak bacteria onto an agar plate", "p/kxBySpW3SnbWuYMRw" : "Streak bacteria onto an agar plate", "p/mJNyMCoEko3JKRv5x" : "Heat shock transformation", "p/maDx7F6ry8Mw5JmKf" : "Pick a colony from an agar plate", "p/ms6uHrB9Fv23Tge2J" : "Make a glycerol stock", "p/mzGLz4CZBhmDHNivi" : "Make Medium", "p/n4Sg8s8AfhMEtQtFH" : "Ligation", "p/oFoQguhSKQKC2Hfms" : "Gather bacteria from an agar plate", "p/ojKqKzgeLkvNvLDgw" : "Heat shock transformation", "p/ovMK2ktEeSommgLa2" : "Heat shock transformation", "p/pk9LqRH9ot8JiKx23" : "Make a glycerol stock", "p/qGNf5sATkiC4P7RqF" : "Gather bacteria from an agar plate", "p/v97Nktv4idauP3hYh" : "Make competent cells", "p/vB88pigyWbKvmKir6" : "Pick a colony from an agar plate", "p/vj752RxeBbHsHi83w" : "Pick a colony from an agar plate", "p/xBmBAjXPQntkvc8d5" : "Make a glycerol stock", "p/z46dHCjoZpLkNgm4k" : "CPEC" }

var colorMapping = {"Make a liquid culture":"#1f77b4","Streak bacteria onto an agar plate":"#aec7e8","Dilute DNA":"#ff7f0e","PCA":"#ffbb78","DNA purification (\"PCR Purification\")":"#2ca02c","Golden Gate Assembly":"#98df8a","Maxens neues Protokoll":"#d62728","Make competent cells":"#ff9896","Make a glycerol stock":"#9467bd","Restriction digest":"#c5b0d5","Pick a colony from an agar plate":"#8c564b","Agarose Gel Electrophoresis":"#c49c94","PCR":"#e377c2","Plasmid Preparation":"#f7b6d2","Heat shock transformation":"#7f7f7f","Annealing of complementary oligonucleotides":"#c7c7c7","Recovery of plasmid DNA from filter paper":"#bcbd22","Dissolve plasmid DNA from the registry distribution":"#dbdb8d","Gel extraction":"#17becf","Make Medium":"#9edae5","Ligation":"#1f77b4","Gather bacteria from an agar plate":"#aec7e8","CPEC":"#ff7f0e"};


//var circle; $(document).ready(function(){

svg = d3.selectAll("#graph"); $svg = $("#graph"); width = $svg.width(); height = $svg.height();

$svg.bind('DOMMouseScroll mousewheel', handleScrolling);

node = svg.selectAll(".node"); link = svg.selectAll(".link"); force = d3.layout.force() .charge(-250) .linkDistance(function (d) { var dist = getHeight(d.target.date) - getHeight(d.source.date); var minDist = 15; if (dist < minDist) dist = minDist; return dist; }) .linkStrength(.1) .gravity(0) .size([width, height]) .links(flinks) .nodes(fnodes) .on("tick", tick);


setSubproject("General", firstDate);


});

function update(){ if(dataUpdated){ dataUpdated=false; var links = flatten(bigLinks); var nodes = flatten(bigNodes);

node = node.data(nodes, function(d) { return d.id;}); node.enter() .append("circle") .attr("class", "node") .attr("r", 10) .attr("fill", function (d) { return colorMapping[mapping[d.type]]; }) .on("click", function (d) { if (d3.event.defaultPrevented) return; showExperiment(d.date, d.id); }) .call(force.drag) .each(function(d) { d.y = (d.date - firstDate) * heightOfSecond; fnodes.push(d); }) .attr('data-toggle', 'tooltip') .attr('title', function(d){return '' + mapping[d.type] + '
' + d.products.join('
');}); $('#graph .node').tooltip({ html: true,

   'container': 'body',
   'placement': 'right' });

node.exit() .each(function(d) { removeByID(fnodes, d.id); }) .remove();

links = links.filter(function(d) { return findByID(d.target) !== undefined && findByID(d.source) !== undefined; }); links.forEach(function(d) { d.source = findByID(d.source); d.target = findByID(d.target); });

link = link.data(links); var lines = link.enter() .append("line") .each(function (d) { flinks.push(d); }) .on("click", function (d){if(d3.event.defaultPrevented) return ; scrollToDate(d.target.date-100000);}) .attr("class", "link");

//lines.filter(function () { return Math.random() > 0.5; }).attr("opacity", "0");

link.exit() .each(function(d) { var index = flinks.indexOf(findByID(d)); if(index >-1) flinks.splice(index, 1); removeLinksByIDs(flinks, d.source.id, d.target.id); }) .remove();

force.start();

unhighlightData(unhighlightedData); }


updateVis();

}

function tick(e) { force.nodes().forEach(function(d){ if(!d.fixed){ d.y += (getHeight(d.date) - d.y) * e.alpha; //d.y = getHeight(d.date); if(d.x > width * 8/10){ d.x += (width*8/10 - d.x) * e.alpha; }else if(d.x < width * 2/10){ d.x += (width* 2/10 - d.x) * e.alpha; } else{ d.x += (width/2 - d.x) * e.alpha * 0.2 ; } } });

updateVis(); }


function updateVis(){ node.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y - (date - firstDate) * heightOfSecond; });

link .attr("x1", function(d) { if(d.source !== undefined) return d.source.x; else return d.target.x; }) .attr("y1", function(d) { if(d.source !== undefined) return d.source.y - (date - firstDate) * heightOfSecond; else return 0;}) .attr("x2", function(d) { if(d.target !== undefined) return d.target.x; else return d.source.x; }) .attr("y2", function(d) { if(d.target !== undefined) return d.target.y - (date - firstDate) * heightOfSecond; else return viewportHeight * heightOfSecond;}); }

function setSubproject(project, d){ dateJSONMatchingList = undefined; if(d === undefined) d = date; this.selectedProject = project; unhighlightedData = project == 'General' ? [] : ['General']; unloadGreaterDate(firstDate-1);

loadDate(d-bufferHeight); loadDate(d); loadDate(d+viewportHeight); loadDate(d+viewportHeight+bufferHeight); setDate(d); }

function setDate(date){ /*if(date < firstDate){ date = firstDate; }*/ var lastDateDisplayed = date + viewportHeight; loadDate(date - bufferHeight); loadDate(lastDateDisplayed + bufferHeight); unloadSmallerDate(date - bufferHeight); unloadGreaterDate(lastDateDisplayed + bufferHeight); this.date = date; update(); updateToTimestamp(date, false); }

/*function animateFlow(){ var links = flatten(bigLinks); var x = Math.floor(links.length * Math.random()); xs.push(x); var l = links[x]; svg.append("ellipse") .attr("fill", "#33CC33") .attr("rx", ( l.target.x - l.source.x)/100) .attr("ry", ( l.target.y - l.source.y)/100) .attr("cx", l.source.x) .attr("cy", l.source.y) .transition() .duration(1000000/(( l.target.x - l.source.x) + ( l.target.y - l.source.y))) .ease("linear") .attr("cx", l.target.x) .attr("cy", l.target.y) .remove();

}*/

function scrollToDate(d){ var currentDate = date; var dif = d - currentDate; console.log(dif); var smoothness = 60; //30 FPS var i = 0; var max = 1 * smoothness; //1 sec. var interval = setInterval(function(){ i=i+1; if(i > max){ clearInterval(interval); } setDate(date+ dif/max) }, max*1000/smoothness/smoothness); }

function highlightData(typeName){ var array = [].concat(typeName); node.attr("opacity", function(d){ var h = false; for(var g = 0; g < array.length; g=g+1) { h = h || d.groups.indexOf(array[g]) !== -1; } if(h) return 1.0; else return 0.1; }); link.attr("opacity", function(d){ var h = false; for(var g = 0; g < array.length; g=g+1) { h = h || (d.target && d.target.groups.indexOf(array[g]) !== -1 && d.source && d.source.groups.indexOf(array[g]) !== -1); }

if(h) return 1; else return 0.1; }); }

function unhighlightData(typeName){ var array = [].concat(typeName); node.attr("opacity", function(d){ var h = false; for(var g = 0; g < array.length; g=g+1) { h = h || d.groups.indexOf(array[g]) !== -1; } if(h) return 0.1; else return 1.0; }); link.attr("opacity", function(d){ var h = false; for(var g = 0; g < array.length; g=g+1) { h = h || ((d.target && d.target.groups.indexOf(array[g]) !== -1) || (d.source && d.source.groups.indexOf(array[g]) !== -1)); }

if(h) return 0.1; else return 1.0; }); for(i = 0; i < array.length; i=i+1){ if(unhighlightedData.indexOf(array[i]) === -1) unhighlightedData.push(array[i]); } }


//////***************************************Helper Function*************************************/

function findByID(id){ return $.grep(fnodes, function(e){return e === id || e.id === id;})[0]; }

function removeByID(array, id){ var index = -1; for(i = 0; i<array.length; i=i+1){ if(array[i].id === id){ index = i; break; } } array.splice(index, 1); }

function removeLinksByIDs(array, sourceId, targetId){ var index = -1; for(i = 0; i<array.length; i=i+1){ if(array[i].source.id === sourceId && array[i].target.id === targetId){ index = i; break; } } array.splice(index, 1); }

function getHeight(date){ return (date - firstDate)*heightOfSecond;

}

/***************************************************************************************************/

/************************************Scrolling and JSON loading stuff*******************************/


/*var loadedJSONFiles = []; var lastLoadedJSON = -1; var firstLoadedJSON = 0;*/

var dateJSONMatchingList; var dataUpdated = false;


var loadingData = false;

function flatten(a){ return a.reduce(extractAndMergeData, []); }

function extractAndMergeData(a, b){ return a.concat(b.data); }

function getFileURL(file) { var md5Name = md5(file); return '/wiki/images/' + md5Name.substr(0, 1) + '/' + md5Name.substr(0, 2) + '/' + file; }

function getJSONForDate(date){ if(dateJSONMatchingList === undefined){ dateJSONMatchingList = []; for(i = 0; i < jsonFiles[selectedProject].length; i=i+1){ var file = jsonFiles[selectedProject][i]; var f = (function (file) { return function(d){ return d >= file.begin && d <= file.end; }; })(file); dateJSONMatchingList.push({ fun: f, file: getFileURL('Heidelberg_Notebook_Data_' + selectedProject + '_summary_' + file.begin + '_' + file.end + '.txt'), detailedFile: getFileURL('Heidelberg_Notebook_Data_' + selectedProject + '_detailed_' + file.begin + '_' + file.end + '.txt'), begin: file.begin, end: file.end, }); } } for(j = 0; j < dateJSONMatchingList.length; j=j+1){ if(dateJSONMatchingList[j].fun(date)) return dateJSONMatchingList[j]; } return -1; }

function loadDate(date){

//Check if date is already loaded if(!isDateLoaded(date)){ //Load new date var json = getJSONForDate(date); if(json !== -1){ d3.json(json.file, function(error, data){ if(error) console.warn(error); var containsFnc = json.fun; var smallerFnc = (function(l1, l2){ return function(d){ return d < l1 && d < l2; }; })(json.begin, json.end); var greaterFnc = (function(l1, l2){ return function(d){ return d > l1 && d > l2; }; })(json.begin, json.end); if(!isDateLoaded(date)){ //Attention this could lead due to the asynchronous nature of d3.json to a race condition and double adding of the nodes and links... bigNodes.push({ contains: containsFnc, greater: greaterFnc, smaller: smallerFnc, data: data.nodes }); bigLinks.push({ contains: containsFnc, greater: greaterFnc, smaller: smallerFnc, data: data.links }); dataUpdated = true; } update(); }); } }

}

function unloadSmallerDate(date){ if(bigNodes.reduce(function(a, b){return a || b.greater(date);}, false)){ bigNodes = bigNodes.filter(function(d){return !d.greater(date);}); bigLinks = bigLinks.filter(function(d){return !d.greater(date);}); dataUpdated = true;

} }

function unloadGreaterDate(date){ if(bigNodes.reduce(function(a, b){return a || b.smaller(date);}, false)){ bigNodes = bigNodes.filter(function(d){return !d.smaller(date);}); bigLinks = bigLinks.filter(function(d){return !d.smaller(date);}); dataUpdated = true; } }

function parseFileName(name){ var l = name.substring(0, name.length-4).split("_"); if(l === undefined || l.length !== 2) console.warn("erroneous file name", name, l); return l; }

function parseFileNameToContainsFnc(name){ var l = parseFileName(name); var f = function(l1, l2){ return function(d){ return d >= l1 && d <= l2; }; }(l[0], l[1]); return f; }

function parseFileNameToSmallerFnc(name){ var l = parseFileName(name); var f = function(l1, l2){ return function(d){ return d < l1 && d < l2; }; }(l[0], l[1]); return f; } function parseFileNameToGreaterFnc(name){ var l = parseFileName(name); var f = function(l1, l2){ return function(d){ return d > l1 && d > l2; }; }(l[0], l[1]); return f; }

function isDateLoaded(date){ for(i = 0; i < bigNodes.length; i=i+1){ if(bigNodes[i].contains(date)){ return true; } } return false; }

function handleScrolling(e) { var scrollTo = 0; e.preventDefault(); if (e.type == 'mousewheel') { scrollTo = (e.originalEvent.wheelDelta * -scrollSpeed/100); }else if (e.type == 'DOMMouseScroll') { scrollTo = e.originalEvent.detail * scrollSpeed; } setDate(date+scrollTo); }