Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
3cf40c20
Commit
3cf40c20
authored
7 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
refactor LE-LLE biplot into a js function
Former-commit-id: 696b9a6cfa986c9919cca972761c7284cfd23440
parent
ca80e1ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ippisite/ippidb/templates/base.html
+51
-0
51 additions, 0 deletions
ippisite/ippidb/templates/base.html
ippisite/ippidb/templates/compound_card.html
+1
-51
1 addition, 51 deletions
ippisite/ippidb/templates/compound_card.html
with
52 additions
and
51 deletions
ippisite/ippidb/templates/base.html
+
51
−
0
View file @
3cf40c20
...
...
@@ -92,6 +92,57 @@
{
type
:
'
radar
'
,
data
:
radarChartData
,
options
:
{
scaleLineWidth
:
1
,
pointLabelFontFamily
:
"
'Helvetica Neue'
"
,
pointLabelFontSize
:
12
,
scaleOverride
:
true
,
scaleSteps
:
5
,
scaleStepWidth
:
0.2
}});
};
var
drawLeLleBiplotChart
=
function
(
canvasId
,
compoundId
,
compoundFamily
,
plotData
){
var
currentCompoundData
=
[];
var
currentFamilyData
=
[];
var
otherFamiliesData
=
[];
plotData
.
forEach
((
item
)
=>
{
if
(
item
.
id
==
compoundId
){
currentCompoundData
.
push
(
item
);
}
else
if
(
item
.
family_name
==
compoundFamily
){
currentFamilyData
.
push
(
item
);
}
else
{
otherFamiliesData
.
push
(
item
)
}
});
var
scatterData
=
{
'
datasets
'
:
[
{
label
:
'
Other PPI families
'
,
borderColor
:
"
rgba(211,211,211, 0.5)
"
,
backgroundColor
:
"
rgba(211,211,211, 0.5)
"
,
data
:
otherFamiliesData
},
{
label
:
'
{{ compound.best_activity_ppi_name}} family
'
,
borderColor
:
"
rgba(54, 162, 235, 1)
"
,
backgroundColor
:
"
rgba(54, 162, 235, 0.5)
"
,
data
:
currentFamilyData
},
{
label
:
'
Compound
'
,
borderColor
:
"
rgba(194, 0, 0, 1)
"
,
backgroundColor
:
"
rgba(194, 0, 0, 1)
"
,
data
:
currentCompoundData
}
]};
var
ctx
=
document
.
getElementById
(
canvasId
).
getContext
(
'
2d
'
);
var
scatterChart
=
new
Chart
(
ctx
,
{
type
:
'
scatter
'
,
data
:
scatterData
,
options
:
{
scales
:
{
xAxes
:
[{
type
:
'
linear
'
,
position
:
'
bottom
'
}]
}
}
});
document
.
getElementById
(
canvasId
).
onclick
=
function
(
evt
){
var
activePoints
=
scatterChart
.
getElementAtEvent
(
evt
);
var
selectedIndex
=
activePoints
[
0
].
_index
;
var
id
=
scatterChart
.
data
.
datasets
[
0
].
data
[
selectedIndex
].
id
;
window
.
location
=
'
/compound/
'
+
id
;
};
};
</script>
...
...
This diff is collapsed.
Click to expand it.
ippisite/ippidb/templates/compound_card.html
+
1
−
51
View file @
3cf40c20
...
...
@@ -157,59 +157,9 @@
<div
class=
"card col-sm-12 col-md-12"
>
<h5
class=
"card-header"
>
Efficiencies: iPPI-DB biplot LE versus LLE
</h5>
<div
class=
"card-body"
>
<canvas
id=
"le_lle_biplot"
></canvas>
<script>
var
allData
=
{{
biplot_data
|
safe
}};
var
currentCompoundData
=
[];
var
currentFamilyData
=
[];
var
otherFamiliesData
=
[];
allData
.
forEach
((
item
)
=>
{
if
(
item
.
id
==
{{
compound
.
id
}}){
currentCompoundData
.
push
(
item
);
}
else
if
(
item
.
family_name
==
'
{{ compound.best_activity_ppi_name}}
'
){
currentFamilyData
.
push
(
item
);
}
else
{
otherFamiliesData
.
push
(
item
)
}
});
var
scatterData
=
{
'
datasets
'
:
[
{
label
:
'
Other PPI families
'
,
borderColor
:
"
rgba(211,211,211, 0.5)
"
,
backgroundColor
:
"
rgba(211,211,211, 0.5)
"
,
data
:
otherFamiliesData
},
{
label
:
'
{{ compound.best_activity_ppi_name}} family
'
,
borderColor
:
"
rgba(54, 162, 235, 1)
"
,
backgroundColor
:
"
rgba(54, 162, 235, 0.5)
"
,
data
:
currentFamilyData
},
{
label
:
'
Compound
'
,
borderColor
:
"
rgba(0, 17, 250, 1)
"
,
backgroundColor
:
"
rgba(0, 17, 250, 0.5)
"
,
data
:
currentCompoundData
}
]};
var
ctx
=
document
.
getElementById
(
'
le_lle_biplot
'
).
getContext
(
'
2d
'
);
var
scatterChart
=
new
Chart
(
ctx
,
{
type
:
'
scatter
'
,
data
:
scatterData
,
options
:
{
scales
:
{
xAxes
:
[{
type
:
'
linear
'
,
position
:
'
bottom
'
}]
}
}
});
document
.
getElementById
(
'
le_lle_biplot
'
).
onclick
=
function
(
evt
){
var
activePoints
=
scatterChart
.
getElementAtEvent
(
evt
);
var
selectedIndex
=
activePoints
[
0
].
_index
;
var
id
=
scatterChart
.
data
.
datasets
[
0
].
data
[
selectedIndex
].
id
;
window
.
location
=
'
/compound/
'
+
id
;
};
drawLeLleBiplotChart
(
'
le_lle_biplot
'
,
{{
compound
.
id
}},
'
{{ compound.best_activity_ppi_name }}
'
,
{{
biplot_data
|
safe
}})
</script>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment