Using the edge weight for force directed layout (CoSE) in cytoscape.js -
i not sure how best utilize edge weight (e.g. strength of interaction between 2 interacting proteins) while generating force directed layout using cose plugin in cytoscape.js. provide pointers. should "idealedgelength" or "edgeelasticity"?
(edit) following figure showing (a) , trying achieve (b). below parameters used generating layout.
thanks, datta.
ps: click view figure showing current (labelled "a") , expected (labelled "b") layouts. following layout options "a".
var options = { name: 'cose', // called on `layoutready` ready: function () { }, // called on `layoutstop` stop: function () { }, // whether animate while running layout animate: true, // number of iterations between consecutive screen positions update (0 -> updated on end) refresh: 20, // whether fit network view after when done fit: true, // padding on fit padding: 30, // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } boundingbox: undefined, componentspacing: 100, // whether randomize node positions on beginning randomize: true, // whether use js console print debug messages debug: false, // node repulsion (non overlapping) multiplier noderepulsion: 400000, // node repulsion (overlapping) multiplier nodeoverlap: 10, // ideal edge (non nested) length idealedgelength: 10, // divisor compute edge forces edgeelasticity: 100, // nesting factor (multiplier) compute ideal edge length nested edges nestingfactor: 5, // gravity force (constant) gravity: 80, // maximum number of iterations perform numiter: 10000, // initial temperature (maximum node displacement) initialtemp: 100, // cooling factor (how temperature reduced between consecutive iterations coolingfactor: 0.95, // lower temperature threshold (below point layout end) mintemp: 1.0 };
you can specify functions instead of static numbers key cose layout settings. functions take edges (or nodes, in cases), can tailor layout based on edge properties.
so this:
idealedgelength: function (edge) { // default is: 10 // instead, base on "weight" return edge.data().weight * .5 }, edgeelasticity: function (edge) { // default is: 100 // instead, base on "weight" return edge.data().weight * 4 },
you'll have experiment ranges work layout engine , range of weight expecting input, approach should work aok.
Comments
Post a Comment