Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
86562d73
Commit
86562d73
authored
Jun 29, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '59948f9' into with_tina_1.2 (bipartite edge filters)
parents
31a6a2c6
38b878f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
20 deletions
+48
-20
enviroment.js
twmain/enviroment.js
+45
-18
methods.js
twmain/methods.js
+3
-2
No files found.
twmain/enviroment.js
View file @
86562d73
...
...
@@ -631,6 +631,8 @@ function edgeSizesSteps(eTypeStr) {
}
}
// console.warn ("edgeSizesSteps:", eTypeStr, stepToIdsArray)
return
stepToIdsArray
}
...
...
@@ -639,22 +641,24 @@ function edgeSizesSteps(eTypeStr) {
// EdgeWeightFilter("#sliderAEdgeWeight", "1", "weight");
// EdgeWeightFilter("#sliderAEdgeWeight", "1|0", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "0|1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "1|1", "weight");
// NB new sigma js: dropEdge is quite slow so we add a waiting cursor
function
EdgeWeightFilter
(
sliderDivID
,
typestr
,
criteria
)
{
if
(
TW
.
partialGraph
.
graph
.
nEdges
()
<
2
)
{
console
.
warn
(
'not enough edges for subsets: skipping GUI slider init'
)
console
.
log
(
'not enough edges for subsets: skipping GUI slider init'
)
showDisabledSlider
(
sliderDivID
)
return
;
}
// building the index
var
stepToIdsArr
=
edgeSizesSteps
(
typestr
)
var
steps
=
stepToIdsArr
.
length
if
(
steps
<
2
)
{
console
.
warn
(
'no size steps for edges: skipping GUI slider init'
)
console
.
log
(
'no size steps for edges: skipping GUI slider init'
)
showDisabledSlider
(
sliderDivID
)
return
;
}
...
...
@@ -662,7 +666,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
// cache initial value
var
initialValue
=
(
"0-"
+
(
steps
-
1
));
TW
.
gui
.
lastFilters
[
sliderDivID
]
=
initialValue
TW
.
gui
.
lastFilters
[
`
${
sliderDivID
}
/
${
typestr
}
`
]
=
initialValue
var
present
=
TW
.
states
.
slice
(
-
1
)[
0
];
...
...
@@ -674,13 +678,31 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
return
}
//finished
// Relations are of 3 kinds: within nodes0, within nodes1, true bipartite
// 1|0 0|1 1|1
// three-way slider colors to represent that
// orange for terms, green for docs/people/contexts, violet for bipartite
switch
(
typestr
)
{
case
'1'
:
case
'1|0'
:
edgeTypeColor
=
"#FFA500"
break
;
case
'0|1'
:
edgeTypeColor
=
"#27c470"
break
;
case
'1|1'
:
edgeTypeColor
=
"#A40DFF"
// or "#E8200C"
break
;
}
// legacy technique (should use .hidden more and possibly edg indx by sizes)
$
(
sliderDivID
).
freshslider
({
range
:
true
,
step
:
1
,
min
:
0
,
// green for docs/people, orange for terms
bgcolor
:
(
typestr
==
"1|0"
||
typestr
==
"1"
)?
"#FFA500"
:
"#27c470"
,
bgcolor
:
edgeTypeColor
,
max
:
steps
-
1
,
value
:[
0
,
steps
-
1
],
onchange
:
function
(
low
,
high
)
{
...
...
@@ -701,10 +723,11 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
edgeSlideTimeout
=
setTimeout
(
function
()
{
var
filtervalue
=
low
+
"-"
+
high
var
lastvalue
=
TW
.
gui
.
lastFilters
[
sliderDivID
]
var
lastvalue
=
TW
.
gui
.
lastFilters
[
`
${
sliderDivID
}
/
${
typestr
}
`
]
// sliderDivID+"_"+filtervalue
//
console.debug("\nprevious value "+lastvalue+" | current value "+filtervalue)
console
.
debug
(
"
\n
previous value "
+
lastvalue
+
" | current value "
+
filtervalue
)
if
(
filtervalue
!=
lastvalue
)
{
...
...
@@ -765,7 +788,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
// global level case
if
(
present
.
level
)
{
//
console.log("\tADD "+eid)
console
.
log
(
"
\
tADD "
+
eid
)
// n = eid.split(";")
// if(n.length>1)
// console.log("\t\tsource:("+TW.Nodes[n[0]].x+","+TW.Nodes[n[0]].y+") ||| target:("+TW.Nodes[n[1]].x+","+TW.Nodes[n[1]].y+")")
...
...
@@ -779,7 +802,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
// NB we assume the sigma convention eid = "nid1;nid2"
let
nidkeys
=
eid
.
split
(
';'
)
//
console.log(nidkeys)
console
.
log
(
nidkeys
)
if
(
nidkeys
.
length
!=
2
)
{
console
.
error
(
"invalid edge id:"
+
eid
)
...
...
@@ -803,7 +826,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
}
else
{
if
(
delflag
)
{
// console.log("deleting "+
ids.join())
console
.
log
(
"deleting "
+
e
ids
.
join
())
for
(
var
i
in
eids
)
{
ID
=
eids
[
i
]
if
(
!
isUndef
(
TW
.
partialGraph
.
graph
.
edges
(
ID
)))
{
...
...
@@ -815,10 +838,9 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
// usually very long b/c sigma has to update indexes
// <=> shift same arrays many times
totalDeletingTime
+=
(
t1
-
t0
)
// POSS ideally: implement a batch dropEdges
// or use graph.clear and rebuild the rest
// POSS ideally: use .hidden
//
console.log("\tDEL "+ID)
console
.
log
(
"
\
tDEL "
+
ID
)
// n = ID.split(";")
// if(n.length>1)
...
...
@@ -840,9 +862,8 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
},
10
)
// [ / Starting FA2 ]
console
.
log
(
"lastvalue==="
,
lastvalue
)
TW
.
gui
.
lastFilters
[
sliderDivID
]
=
lastvalue
// pushFilterValue( sliderDivID , lastvalue )
// memoize as last value
TW
.
gui
.
lastFilters
[
`
${
sliderDivID
}
/
${
typestr
}
`
]
=
filtervalue
}
else
{
...
...
@@ -851,6 +872,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
// in any case
setTimeout
(
function
()
{
TW
.
partialGraph
.
refresh
()
TW
.
gui
.
elHtml
.
classList
.
remove
(
'waiting'
)
},
20
)
...
...
@@ -946,6 +968,11 @@ function NodeWeightFilter( sliderDivID , tgtNodeType , criteria) {
if
(
i
>=
low
&&
i
<=
high
){
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
if
(
!
TW
.
Nodes
[
ID
])
{
console
.
warn
(
'nodeslider asks for nonexistatn ID'
,
ID
)
continue
;
}
TW
.
Nodes
[
ID
].
lock
=
false
;
if
(
TW
.
partialGraph
.
graph
.
nodes
(
ID
))
TW
.
partialGraph
.
graph
.
nodes
(
ID
).
hidden
=
false
;
...
...
twmain/methods.js
View file @
86562d73
...
...
@@ -71,8 +71,9 @@ TW.pushState = function( args ) {
$
(
".for-nodecategory-1"
).
show
();
NodeWeightFilter
(
"#slidercat0nodesweight"
,
TW
.
categories
[
0
],
"size"
);
NodeWeightFilter
(
"#slidercat1nodesweight"
,
TW
.
categories
[
1
],
"size"
);
EdgeWeightFilter
(
"#slidercat0edgesweight"
,
"1|0"
,
"weight"
);
EdgeWeightFilter
(
"#slidercat1edgesweight"
,
"0|1"
,
"weight"
);
// only truly bipartite edges => only one GUI slider
EdgeWeightFilter
(
"#slidercat1edgesweight"
,
"1|1"
,
"weight"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment