diff --git a/404.html b/404.html index 7b2cd53..83d321f 100644 --- a/404.html +++ b/404.html @@ -32,7 +32,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/LICENSE-text.html b/LICENSE-text.html index 3e8def5..144ed2f 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/LICENSE.html b/LICENSE.html index 295a1ec..41bccf2 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/articles/index.html b/articles/index.html index a445aaf..8375a9b 100644 --- a/articles/index.html +++ b/articles/index.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/articles/v1_introduction.html b/articles/v1_introduction.html index 74767cf..70548d2 100644 --- a/articles/v1_introduction.html +++ b/articles/v1_introduction.html @@ -33,7 +33,7 @@ LACE - 2.6.3 + 2.8.0 @@ -95,7 +95,7 @@

Luca De

Gianluca Ascolani

-

March 21, 2024

+

March 26, 2024

Source: vignettes/v1_introduction.Rmd diff --git a/articles/v2_running_LACE.html b/articles/v2_running_LACE.html index 37e739b..c8546b0 100644 --- a/articles/v2_running_LACE.html +++ b/articles/v2_running_LACE.html @@ -33,7 +33,7 @@ LACE - 2.6.3 + 2.8.0 @@ -95,7 +95,7 @@

Luca De

Gianluca Ascolani

-

March 21, 2024

+

March 26, 2024

Source: vignettes/v2_running_LACE.Rmd diff --git a/articles/v3_LACE_interface.html b/articles/v3_LACE_interface.html index 71f63ed..fac3e7e 100644 --- a/articles/v3_LACE_interface.html +++ b/articles/v3_LACE_interface.html @@ -33,7 +33,7 @@ LACE - 2.6.3 + 2.8.0 @@ -95,7 +95,7 @@

Luca De

Gianluca Ascolani

-

March 21, 2024

+

March 26, 2024

Source: vignettes/v3_LACE_interface.Rmd diff --git a/authors.html b/authors.html index 2066fbc..24e52cd 100644 --- a/authors.html +++ b/authors.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/index.html b/index.html index 432c507..58e2ea9 100644 --- a/index.html +++ b/index.html @@ -33,7 +33,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/pkgdown.yml b/pkgdown.yml index c17d9ca..2300f97 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -5,5 +5,5 @@ articles: v1_introduction: v1_introduction.html v2_running_LACE: v2_running_LACE.html v3_LACE_interface: v3_LACE_interface.html -last_built: 2024-03-21T06:49Z +last_built: 2024-03-26T07:18Z diff --git a/reference/LACE.html b/reference/LACE.html index f7dd218..3a73837 100644 --- a/reference/LACE.html +++ b/reference/LACE.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/LACEview.html b/reference/LACEview.html index fb94a19..36f1009 100644 --- a/reference/LACEview.html +++ b/reference/LACEview.html @@ -22,7 +22,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/compute.mutation.distance.html b/reference/compute.mutation.distance.html index ec6d135..6b3dc00 100644 --- a/reference/compute.mutation.distance.html +++ b/reference/compute.mutation.distance.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/compute.variants.error.rates.html b/reference/compute.variants.error.rates.html index 5a20e01..83f6c01 100644 --- a/reference/compute.variants.error.rates.html +++ b/reference/compute.variants.error.rates.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/index.html b/reference/index.html index 93c76d7..5c831b7 100644 --- a/reference/index.html +++ b/reference/index.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/inference.html b/reference/inference.html index 47b70e3..5765515 100644 --- a/reference/inference.html +++ b/reference/inference.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/lace_interface.html b/reference/lace_interface.html index 70b8119..aeca7f4 100644 --- a/reference/lace_interface.html +++ b/reference/lace_interface.html @@ -20,7 +20,7 @@ LACE - 2.6.3 + 2.8.0 diff --git a/reference/lacedata.html b/reference/lacedata.html index e528f2c..6adcc21 100644 --- a/reference/lacedata.html +++ b/reference/lacedata.html @@ -2,7 +2,7 @@ lacedata — lacedata • LACE +
@@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0
diff --git a/reference/libs/LACE-binding-2.8.0/LACE.js b/reference/libs/LACE-binding-2.8.0/LACE.js new file mode 100644 index 0000000..ec0f3d7 --- /dev/null +++ b/reference/libs/LACE-binding-2.8.0/LACE.js @@ -0,0 +1,637 @@ +HTMLWidgets.widget({ + + name: "LACE", + + type: "output", + + factory: function (el, width, height) { + + + return { + + renderValue: function (jsdata) { + var D = jsdata["data"] + var info = jsdata["info"] + var E = jsdata["columns"] + var F = jsdata["colors"] + + // set the dimensions and margins of the graph + var margin = { + top: 20, + right: 30, + bottom: 20, + left: 10 + }, + width = 460 - margin.left - margin.right, + height = 800 - margin.top - margin.bottom; + + // ################ + // global variable vizObj + vizObj = {}; + + var xxx = {}; + + // note current width & height in vizObj + vizObj.cur_height = height / 3; + vizObj.cur_width = width; + //userConfig={}; + var userConfig = jsdata["x"] + + // ################ + + + //List of groups = header of the csv files + var keys = E.slice(1).reverse() + + + + // Three function that change the tooltip when user: + // hover / move / leave a cell + var mouseover = function (d) {} + var tip = {}; + var makeTippy = function (node, text) { + + var ref = node.popperRef(); + + // unfortunately, a dummy element must be passed + // as tippy only accepts a dom element as the target + // https://github.com/atomiks/tippyjs/issues/661 + var dummyDomEle = document.createElement('div'); + + var tip = tippy(dummyDomEle, { + onCreate: function (instance) { // mandatory + // patch the tippy's popper reference so positioning works + // https://atomiks.github.io/tippyjs/misc/#custom-position + instance.popperInstance.reference = ref; + }, + lazy: false, // mandatory + trigger: 'manual', // mandatory + + // dom element inside the tippy: + content: function () { // function can be better for performance + var div = document.createElement('div'); + + div.innerHTML = text; + + return div; + }, + + // your own preferences: + arrow: true, + placement: 'bottom', + hideOnClick: false, + multiple: true, + sticky: true, + + // if interactive: + interactive: true, + appendTo: document.body // or append dummyDomEle to document.body + }); + + return tip; + }; + + var mousemove = function (d, i) { + grp = keys[i] + cy.edges().style('opacity', '0.2'); + cy.nodes().forEach(function (ele) { + if (ele.id().indexOf(keys[i]) !== -1) { + ele.style('opacity', '1'); + if (tip[ele.id()] !== undefined) { + tip[ele.id()].destroy(); + } + + + tip[ele.id()] = makeTippy(ele, ele.data()["prev"]); + tip[ele.id()].show(); + setTimeout(function () { + tip[ele.id()].destroy(); + }, 4000); + } else { + ele.style('opacity', '0.2'); + } + }); + cy.$(':parent').style('opacity', '1'); + } + var mouseleave = function (d) { + cy.nodes().style('opacity', '1'); + cy.edges().style('opacity', '1'); + } + + var tickmouseover = function (d) { + cy.nodes().style('opacity', '0.2'); + cy.edges().style('opacity', '0.2'); + cy.$('#T' + d).style('opacity', '1'); + cy.$('#T' + d).children().style('opacity', '1'); + cy.$('#T' + d).children().connectedEdges().style('opacity', '1'); + + cy.$('#T' + d).children().forEach(function (ele) { + if (tip[ele.id()] !== undefined) { + tip[ele.id()].destroy(); + } + + + tip[ele.id()] = makeTippy(ele, ele.data()["prev"]); + tip[ele.id()].show(); + setTimeout(function () { + tip[ele.id()].destroy(); + }, 4000); + }); + + + + + } + + var tickmouseout = function (d) { + + cy.nodes().style('opacity', '1'); + cy.edges().style('opacity', '1'); + } + + + + var mutdict = {} + var elid = el.id + + + var cy = window.cy = cytoscape({ + container: document.getElementById('cy'), + boxSelectionEnabled: false, + autounselectify: false, + layout: { + name: 'dagre', + nodeSep: '100' + }, + style: [ + { + selector: 'node', + css: { + 'content': 'data(name)', + 'text-valign': 'center', + 'width': 'data(size)', + 'background-color': 'data(color)', + 'height': 'data(size)', + 'text-halign': 'center', + 'font-size': '20', + } + }, + { + selector: ':parent', + css: { + 'content': 'data(name)', + 'text-valign': 'top', + 'background-opacity': '0.333', + 'text-halign': 'center', + 'border-width': '2', + 'border-color': 'black' + } + }, + { + selector: '.fade', + style: { + 'opacity': '0.5', + } + }, + { + selector: 'edge', + css: { + 'content': 'data(name)', + 'text-valign': 'center', + 'curve-style': 'bezier', + 'line-color': 'data(color)', + 'target-arrow-shape': 'triangle', + 'target-arrow-color': 'data(color)', + 'line-style': 'data(linestyle)', + 'font-size': '20', + } + } + ], + + elements: jsdata["elements"], + + + ready: function () { + cy = this; + + function runLayout(fit, callBack) { + var parentNodes = cy.nodes(':parent'); + var dagre_layout = parentNodes.layout({ + name: 'dagre', + rankDir: 'LR', + fit: fit + }); + dagre_layout.promiseOn('layoutstop').then(function (event) { + if (callBack) { + callBack.call(cy, event); + } + }); + dagre_layout.run(); + + } + + function addlegend() { + var tablecontainer = document.getElementById("lacetable") + tablecontainer.style.visibility = 'visible' + //tablecontainer.style["overflow-y"]="scroll" + tablecontainer.style["overflow-y"] = null + tablecontainer.style.left = "12px"; + tablecontainer.style.right = "12px"; + tablecontainer.style.margin = "12px"; + + tablecontainer = document.getElementById("table") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("legend") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("mutations") + tablecontainer.style.display = 'flex' + + + var ddy = 25 + var width = 340 + var legend = d3.select("#legend") + .append("svg") + .attr("width", width ) //+ margin.left + margin.right) + .attr("height", 100+ margin.top) // + margin.bottom) + .append("g") + .attr("class", "legend") + + legend.append("text") + .attr("x", width - 44).attr("y", 9).attr("dy", ".35em") + .style("text-anchor", "end") + .text('parental relations\n(somatic mutations)'); + + legend.append("line") //making a line for legend + .attr("x1", width - 28).attr("x2", width) + .attr("y1", 10) + .attr("y2", 10) + .style("stroke", "5") + .style("stroke", '#000000'); + + + legend.append("text") + .attr("x", width - 44).attr("y", 9 + ddy).attr("dy", ".35em") + .style("text-anchor", "end") + .text('persistance relation'); + + legend.append("line") //making a line for legend + .attr("x1", width - 28) + .attr("x2", width) + .attr("y1", 10 + ddy) + .attr("y2", 10 + ddy) + .style("stroke-dasharray", "5,5") + .style("stroke", '#000000'); + + + legend.append("text") + .attr("x", width - 44) + .attr("y", 9 + ddy * 2) + .attr("dy", ".35em") + .style("text-anchor", "end") + .text('node size proportional to clone prevalence'); + + legend.append("circle") //making a line for legend + .attr("cx", width - 28 + 28 / 2) + .attr("cy", 10 + ddy * 2) + .attr("r", 8) + .style("stroke", "5") + .style("stroke", '#000000') + .style("fill", 'none'); + + } + addlegend(); + + function addtable() { + var tablecontainer = document.getElementById("lacetable") + tablecontainer.style.visibility = 'visible' + //tablecontainer.style["overflow-y"]="scroll" + tablecontainer.style["overflow-y"] = null + tablecontainer.style.left = "12px"; + tablecontainer.style.right = "12px"; + tablecontainer.style.margin = "12px"; + + tablecontainer = document.getElementById("table") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("legend") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("mutations") + tablecontainer.style.display = 'flex' + + tablecontainer = document.getElementById("table") + tablecontainer.innerHTML = '
' + } + addtable(); + var datatable = new DataTable('table', { + perPageSelect: [10, 20, 30], + searchable: false, + footer: false, + layout: { + top: "", + bottom: "" + }, + data: jsdata["tab"], + }); + + var mutdict = {} + var request = {} + var request2 = {} + + function getGene() { + if (jsdata["clone_labels"].length > 0) { + for (const name of jsdata["clone_labels"]) { + request[name] = new XMLHttpRequest(); + request[name].onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { + console.log('1 richiesta fatta') + + if (this.status === 200) { + var data = JSON.parse(this.responseText); + console.log('1 risposta'); + console.log(data); + if (data[0] !== undefined) { + request2[name] = new XMLHttpRequest(); + request2[name].onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { + console.log('2 richiesta fatta') + if (this.status === 200) { + var data2 = JSON.parse(this.responseText); + console.log('data2'); + console.log(data2); + mutdict[name] = data2; + console.log('mutdict2') + console.log(mutdict) + cy["mutdict"] = mutdict + } + } + } + request2[name].onerror = function (e) { + //alert("Error fetching " + url); + }; + console.log('before data2'); + console.log(data[0]); + request2[name].open('GET', + 'http://rest.ensembl.org/lookup/id/' + + data[0]["id"] + + '?content-type=application/json', + true); + if (navigator.onLine) { + //console.log('online'); + request2[name].send(null); + } else { + console.log('offline'); + } + + } + } + } + }; + request[name].onerror = function (e) { + //alert("Error fetching " + url); + }; + request[name].open('GET', + 'https://rest.ensembl.org/xrefs/symbol/homo_sapiens/' + + name + + '?content-type=application/json', + true); + if (navigator.onLine) { + //console.log('online'); + request[name].send(null); + } else { + console.log('offline'); + } + + } + + } + } + + cy['getGene'] = getGene + + if (Object.keys(mutdict).length === 0) { + cy.getGene(); + } + + cy["keys"] = keys + cy["colors"] = F + + info.help = "

Help

" + info.info = "

Dataset info

" + info.info + + + function addnavbar() { + var navbar = document.getElementById("navbar"); + navbar.innerHTML = '' + } + addnavbar(); + + + + //edge mouse interaction + cy.edges().on('mouseover', function (e) { + var str = ""; + edge = cy.$('#' + e.target.id()); + edge_target_name = edge.target().data()["name"]; + + clonal_nodes = cy.nodes('[name ="' + edge_target_name + '"]'); + clonal_path = clonal_nodes.predecessors().edgesTo(clonal_nodes); + + clone = clonal_nodes.union(clonal_path).union(cy.$(':parent')) + most = cy.nodes().union(cy.edges()).difference(clone) + most.style('opacity', '0.2'); + clone.style('opacity', '1'); + + //if(edge.data()["name"] in mutdict) { + edge.target().predecessors().forEach(function (ele) { + //ele.style('opacity','1'); + if (ele.isEdge()) { + if (ele.data()["name"] !== "") { + str = ' " + str; + } + } + }); + //} + console.log(str); + //var tablecontainer = document.getElementById("lacetable") + var tablecontainer = document.getElementById("lacetable") + tablecontainer.style.visibility = 'visible' + tablecontainer.style["overflow-y"] = null + + + tablecontainer = document.getElementById("table") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("legend") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("mutations") + tablecontainer.style.display = 'flex' + + + tablecontainer = document.getElementById("mutations") + tablecontainer.innerHTML = str; + + + _tsMouseoverGenotype(edge_target_name, xxx.obj.view_id); + _showLabels(edge_target_name, xxx.obj.view_id); + + }); + cy.edges().on('mouseout', function (e) { + cy.nodes().style('opacity', '1'); + cy.edges().style('opacity', '1'); + _tsMouseoutGenotype(xxx.obj.view_id); + _hideLabels(xxx.obj.view_id); + + }); + + runLayout(true); + + elem = document.getElementById("lacetable") + elem.addEventListener('mouseleave', function (d) { + tablecontainer = document.getElementById("table") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("legend") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("mutations") + tablecontainer.style.display = 'flex' + }); + + + + //edge mouse interaction + cy.edges().on('click', function (e) { + console.log(mutdict) + + if (Object.keys(mutdict).length == 0) { + console.log('relaunch getGene()') + cy.getGene(); + } else { + console.log('relaunch not needed') + } + + if (cy.$('#' + e.target.id()).data()["name"] !== "") { + if (cy.$('#' + e.target.id()).data()["name"] in mutdict) { + var tablecontainer = document.getElementById("lacetable") + tablecontainer.style.visibility = 'visible' + tablecontainer.style["overflow-y"] = null + + tablecontainer = document.getElementById("table") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("legend") + tablecontainer.style.display = 'flex' + tablecontainer = document.getElementById("mutations") + tablecontainer.style.display = 'flex' + + tablecontainer = document.getElementById("mutations") + tablecontainer.innerHTML = '
' + mutdict[cy.$('#' + e.target.id()).data()["name"]]["display_name"] + '
' + mutdict[cy.$('#' + e.target.id()).data()["name"]]["id"] + '

' + mutdict[cy.$('#' + e.target.id()).data()["name"]]["description"] + '

' + mutdict[cy.$('#' + e.target.id()).data()["name"]]["assembly_name"] + '' + mutdict[cy.$('#' + e.target.id()).data()["name"]]["source"] + '
' + + } + } + }); + + //node mouse interaction + var tip; + cy.nodes().on('mouseover', function (e) { + if (!cy.$("#" + e.target.id()).isParent()) { + if (tip !== undefined) { + tip.destroy(); + } + tip = makeTippy(cy.$("#" + e.target.id()), + cy.$("#" + e.target.id()).data()["prev"]); + tip.show(); + } + }); + + cy.nodes().on('mouseout', function (e) { + if (tip !== undefined) { + tip.destroy(); + } + }); + + + } + }); + document.getElementById(el.id).cy = cy; + + xxx.obj = _run_timescape(el.id, + vizObj.cur_width, + vizObj.cur_height, + userConfig); + }, + + resize: function (width, height) { + + // TODO: code to re-render the widget with a new size + + } + + }; + } +}); diff --git a/reference/longitudinal.tree.plot.html b/reference/longitudinal.tree.plot.html index 4eb2843..4fb17c8 100644 --- a/reference/longitudinal.tree.plot.html +++ b/reference/longitudinal.tree.plot.html @@ -17,7 +17,7 @@ LACE - 2.6.3 + 2.8.0 @@ -182,13 +182,13 @@

Examples

clone_labels = clone_labels, legend_position = "topleft") -#> IGRAPH 91798f9 DN-- 25 24 -- +#> IGRAPH 393a942 DN-- 25 24 -- #> + attr: name (v/c), branch_level (v/n), branch (v/n), label (v/c), #> | last_mutation (v/c), TP (v/n), clone (v/n), prevalance (v/n), size #> | (v/n), size2 (v/n), shape (v/c), label.dist (v/n), label.degree #> | (v/n), extincion (v/n), color (v/c), coord.x (v/l), coord.y (v/l), #> | type (e/n), extincion (e/l), label (e/c), name (e/c), lty (e/n) -#> + edges from 91798f9 (vertex names): +#> + edges from 393a942 (vertex names): #> [1] T1-ARPC2_2_218249894_C_T->T2-ARPC2_2_218249894_C_T #> [2] T2-ARPC2_2_218249894_C_T->T3-ARPC2_2_218249894_C_T #> [3] T3-ARPC2_2_218249894_C_T->T4-ARPC2_2_218249894_C_T diff --git a/reference/longitudinal_sc_variants.html b/reference/longitudinal_sc_variants.html index 56ee746..6658c67 100644 --- a/reference/longitudinal_sc_variants.html +++ b/reference/longitudinal_sc_variants.html @@ -23,7 +23,7 @@ LACE - 2.6.3 + 2.8.0