Skip to content

Commit 86b6cc6

Browse files
committed
update
1 parent e9505f6 commit 86b6cc6

File tree

2 files changed

+79
-66
lines changed

2 files changed

+79
-66
lines changed

BioRadar/src/script/kegg.js

Lines changed: 74 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ function classes(root) {
218218
return {children: classes};
219219
}
220220

221-
function ProteinForceDirectedGraph() {
221+
function ProteinForceDirectedGraph({onChoose,onRelease}) {
222222
debugger
223-
d3.select("#svgprotein").remove()
223+
d3.select("#svgprotein").remove();
224224
var width = 650,
225225
height = 650;
226226
var radius=2;
@@ -281,30 +281,30 @@ function ProteinForceDirectedGraph() {
281281
if(e.data.protein.indexOf(d.label)>=0) return 1;
282282
else return 0.05;
283283
});
284-
var bars1 = d3.select("#svg1").selectAll("rect");
285-
bars1.style("fill-opacity",function (bar) {
286-
if(bar.symbol.toUpperCase()==d.label) return 1;
287-
else return 0.05;
288-
289-
});
290-
var bars2 = d3.select("#svg2").selectAll("rect");
291-
bars2.style("fill-opacity",function (bar) {
292-
if(bar.symbol.toUpperCase()==d.label) return 1;
293-
else return 0.05;
294-
295-
});
296-
var bars3 = d3.select("#svg3").selectAll("rect");
297-
bars3.style("fill-opacity",function (bar) {
298-
if(bar.symbol.toUpperCase()==d.label) return 1;
299-
else return 0.05;
300-
301-
});
302-
var bars4 = d3.select("#svg4").selectAll("rect");
303-
bars4.style("fill-opacity",function (bar) {
304-
if(bar.symbol.toUpperCase()==d.label) return 1;
305-
else return 0.05;
306-
307-
});
284+
// var bars1 = d3.select("#svg1").selectAll("rect");
285+
// bars1.style("fill-opacity",function (bar) {
286+
// if(bar.symbol.toUpperCase()==d.label) return 1;
287+
// else return 0.05;
288+
//
289+
// });
290+
// var bars2 = d3.select("#svg2").selectAll("rect");
291+
// bars2.style("fill-opacity",function (bar) {
292+
// if(bar.symbol.toUpperCase()==d.label) return 1;
293+
// else return 0.05;
294+
//
295+
// });
296+
// var bars3 = d3.select("#svg3").selectAll("rect");
297+
// bars3.style("fill-opacity",function (bar) {
298+
// if(bar.symbol.toUpperCase()==d.label) return 1;
299+
// else return 0.05;
300+
//
301+
// });
302+
// var bars4 = d3.select("#svg4").selectAll("rect");
303+
// bars4.style("fill-opacity",function (bar) {
304+
// if(bar.symbol.toUpperCase()==d.label) return 1;
305+
// else return 0.05;
306+
//
307+
// });
308308
})
309309
node.append("text")
310310
.attr("class","texts")
@@ -356,45 +356,55 @@ function ProteinForceDirectedGraph() {
356356
d3.select("#svgbubble").selectAll("g").classed("selected", false);
357357
}
358358
d3.select(this).classed("selected", !isSelected);
359-
359+
// to do release
360360
d3.select("#svgbubble").selectAll("g").style("opacity",0.1)
361-
d3.select("#svgbubble").selectAll(".selected").style("opacity",1)
362-
363-
364-
node.style("opacity",function (d) {
365-
if(b.data.protein.indexOf(d.label)>=0) return 1;
366-
else return 0.05;
367-
});
368-
link.style("opacity",function (d) {
369-
if(b.data.protein.indexOf(d.source.label)>=0&&b.data.protein.indexOf(d.target.label)>=0) return 1;
370-
else return 0.05;
371-
})
372-
373-
var bars1 = d3.select("#svg1").selectAll("rect");
374-
bars1.style("fill-opacity",function (bar) {
375-
if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
376-
else return 0.05;
377-
378-
});
379-
380-
var bars2 = d3.select("#svg2").selectAll("rect");
381-
bars2.style("fill-opacity",function (bar) {
382-
if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
383-
else return 0.05;
384-
385-
});
386-
var bars3 = d3.select("#svg3").selectAll("rect");
387-
bars3.style("fill-opacity",function (bar) {
388-
if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
389-
else return 0.05;
390-
391-
});
392-
var bars4 = d3.select("#svg4").selectAll("rect");
393-
bars4.style("fill-opacity",function (bar) {
394-
if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
395-
else return 0.05;
396-
397-
});
361+
let selectedItems = d3.select("#svgbubble").selectAll(".selected").style("opacity",1);
362+
let nodesList = [];
363+
if (!selectedItems.empty())
364+
{
365+
node.style("opacity",function (d) {
366+
if(b.data.protein.indexOf(d.label)>=0){
367+
nodesList.push(d.referenceName)
368+
return 1;
369+
}
370+
else return 0.05;
371+
});
372+
link.style("opacity",function (d) {
373+
if(b.data.protein.indexOf(d.source.label)>=0&&b.data.protein.indexOf(d.target.label)>=0) return 1;
374+
else return 0.05;
375+
});
376+
}else{
377+
d3.select("#svgbubble").selectAll("g").style("opacity",1);
378+
node.style("opacity",1);
379+
link.style("opacity",1);
380+
}
381+
if (onChoose)
382+
onChoose(nodesList)
383+
// var bars1 = d3.select("#svg1").selectAll("rect");
384+
// bars1.style("fill-opacity",function (bar) {
385+
// if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
386+
// else return 0.05;
387+
//
388+
// });
389+
//
390+
// var bars2 = d3.select("#svg2").selectAll("rect");
391+
// bars2.style("fill-opacity",function (bar) {
392+
// if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
393+
// else return 0.05;
394+
//
395+
// });
396+
// var bars3 = d3.select("#svg3").selectAll("rect");
397+
// bars3.style("fill-opacity",function (bar) {
398+
// if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
399+
// else return 0.05;
400+
//
401+
// });
402+
// var bars4 = d3.select("#svg4").selectAll("rect");
403+
// bars4.style("fill-opacity",function (bar) {
404+
// if(b.data.protein.indexOf(bar.symbol.toUpperCase())>=0) return 1;
405+
// else return 0.05;
406+
//
407+
// });
398408

399409
});
400410

BioRadar/src/script/timeSpaceModel.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ d3.TimeSpace = function () {
370370
updateTableInput();
371371
path = {};
372372
BubbleChart();
373-
ProteinForceDirectedGraph();
373+
ProteinForceDirectedGraph({onChoose:master.filter});
374374

375375
// make path object and compute euclideandistance
376376
let euclideandistance_range = [+Infinity,0];
@@ -2793,8 +2793,11 @@ let timeSpacedata;
27932793
function handle_data_model(tsnedata,isKeepUndefined) {
27942794
proteinarr.forEach((p,pi)=>{
27952795
let key = Object.keys(tsnedata).find(k=>k.toLowerCase()===p);
2796-
if (key)
2796+
if (key){
2797+
debugger
2798+
globalProtein.nodes.find(d=>d.label.toLowerCase()===p.toLowerCase()).referenceName = key;
27972799
tsnedata[key].netadata = {node:globalProtein.nodes[pi],id:pi};
2800+
}
27982801
});
27992802
preloader(true,1,'preprocess data','#modelLoading');
28002803
windowsSize = windowsSize||1;

0 commit comments

Comments
 (0)