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
a5da94eb
Commit
a5da94eb
authored
Mar 29, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse: debug stats for gexf parser
parent
c93c008f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
sigma.parseCustom.js
tinawebJS/sigma.parseCustom.js
+29
-3
No files found.
tinawebJS/sigma.parseCustom.js
View file @
a5da94eb
// TODO REFA longterm refactoring: scanXX and dictifyXX is doing double work
// (for instance loop on full gexf in scanGexf then again in dictfyGexf)
// Level-01
ParseCustom
=
function
(
format
,
data
)
{
...
...
@@ -35,7 +37,6 @@ ParseCustom = function ( format , data ) {
// Level-02
ParseCustom
.
prototype
.
scanFile
=
function
()
{
switch
(
this
.
format
)
{
case
"api.json"
:
console
.
log
(
"scanFile: "
+
this
.
format
)
...
...
@@ -61,7 +62,6 @@ ParseCustom.prototype.scanFile = function() {
// Level-02
ParseCustom
.
prototype
.
makeDicts
=
function
(
categories
)
{
switch
(
this
.
format
)
{
case
"api.json"
:
console
.
log
(
"makeDicts: "
+
this
.
format
)
...
...
@@ -88,6 +88,7 @@ ParseCustom.prototype.makeDicts = function(categories) {
// Level-00
function
scanGexf
(
gexf
)
{
console
.
log
(
"ParseCustom : scanGexf"
)
var
categoriesDict
=
{},
categories
=
[];
nodesNodes
=
gexf
.
getElementsByTagName
(
'nodes'
);
for
(
i
=
0
;
i
<
nodesNodes
.
length
;
i
++
){
...
...
@@ -137,6 +138,8 @@ function scanGexf(gexf) {
// for {1,2}partite graphs
function
dictfyGexf
(
gexf
,
categories
){
console
.
warn
(
"ParseCustom gexf 2nd loop, main data extraction"
)
var
catDict
=
{}
var
catCount
=
{}
...
...
@@ -197,6 +200,12 @@ function dictfyGexf( gexf , categories ){
maxNodeSize
=
0.001
;
numberOfDocs
=
0
;
numberOfNGrams
=
0
;
// debug: for local stats
let
allSizes
=
[]
let
sumSizes
=
0
let
sizeStats
=
{
'mean'
:
null
,
'median'
:
null
,
'max'
:
0
,
'min'
:
1000000000
}
for
(
i
=
0
;
i
<
nodesNodes
.
length
;
i
++
)
{
var
nodesNode
=
nodesNodes
[
i
];
// Each xml node 'nodes' (plural)
var
nodeNodes
=
nodesNode
.
getElementsByTagName
(
'node'
);
// The list of xml nodes 'node' (no 's')
...
...
@@ -219,6 +228,14 @@ function dictfyGexf( gexf , categories ){
if
(
sizeNodes
.
length
>
0
){
sizeNode
=
sizeNodes
[
0
];
size
=
parseFloat
(
sizeNode
.
getAttribute
(
'value'
));
// debug: for stats ---------------------------
allSizes
.
push
(
size
)
sumSizes
+=
size
if
(
size
<
sizeStats
.
min
)
sizeStats
.
min
=
size
if
(
size
>
sizeStats
.
max
)
sizeStats
.
max
=
size
// --------------------------------------------
}
// [ / get Size ]
// [ get Coordinates ]
...
...
@@ -232,7 +249,7 @@ function dictfyGexf( gexf , categories ){
y
=
parseFloat
(
positionNode
.
getAttribute
(
'y'
));
}
// [ / get Coordinates ]
// x = x*-1
y
=
y
*-
1
y
=
y
*-
1
// aka -y
// [ get Colour ]
var
colorNodes
=
nodeNode
.
getElementsByTagName
(
'color'
);
...
...
@@ -293,6 +310,15 @@ function dictfyGexf( gexf , categories ){
}
}
// -------------- debug: for local stats ----------------
allSizes
.
sort
();
let
N
=
allSizes
.
length
sizeStats
.
median
=
allSizes
[
Math
.
round
(
N
/
2
)]
sizeStats
.
mean
=
Math
.
round
(
sumSizes
/
N
*
100
)
/
100
console
.
log
(
"parseCustom(gexf) sizeStats:"
,
sizeStats
)
// ------------- /debug: for local stats ----------------
var
attention
=
false
if
(
TW
.
Clusters
.
length
==
0
)
{
for
(
var
i
in
nodes
)
{
...
...
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