Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Cosy-Bio
Drugst.One
plugin
Commits
0c44366d
Commit
0c44366d
authored
2 years ago
by
Hartung, Michael
Browse files
Options
Downloads
Patches
Plain Diff
center network view button in sidebar
parent
e3c9849a
No related branches found
No related tags found
No related merge requests found
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/network-settings.ts
+39
-40
39 additions, 40 deletions
src/app/network-settings.ts
with
39 additions
and
40 deletions
src/app/network-settings.ts
+
39
−
40
View file @
0c44366d
import
{
getGradientColor
}
from
'
./utils
'
;
import
{
getGradientColor
}
from
'
./utils
'
;
import
{
Node
,
}
from
'
./interfaces
'
;
import
{
IConfig
,
defaultConfig
}
from
'
./config
'
;
import
{
IConfig
,
defaultConfig
}
from
'
./config
'
;
import
*
as
merge
from
'
lodash/fp/merge
'
;
export
class
NetworkSettings
{
...
...
@@ -53,10 +53,10 @@ export class NetworkSettings {
};
private
static
mainEdges
=
{
smooth
:
false
,
length
:
250
,
length
:
250
};
private
static
mainPhysics
=
{
enabled
:
false
,
enabled
:
false
};
// Node size
...
...
@@ -73,13 +73,13 @@ export class NetworkSettings {
return
{
layout
:
this
.
mainLayout
,
edges
:
this
.
mainEdges
,
physics
:
physicsOn
||
this
.
mainPhysics
,
physics
:
physicsOn
||
this
.
mainPhysics
,
};
}
else
if
(
network
===
'
analysis
'
)
{
return
{
layout
:
this
.
analysisLayout
,
edges
:
this
.
analysisEdges
,
physics
:
physicsOn
||
this
.
analysisPhysics
,
physics
:
physicsOn
||
this
.
analysisPhysics
,
};
}
else
if
(
network
===
'
analysis-big
'
)
{
return
{
...
...
@@ -95,8 +95,7 @@ export class NetworkSettings {
'
edgeHostDrug
'
|
'
edgeHostDrugHighlight
'
|
'
edgeGeneGene
'
|
'
edgeGeneGeneHighlight
'
)
/**
* Collection of all colors per use-case
*/
{
*/
{
if
(
color
===
'
protein
'
)
{
return
this
.
hostColor
;
}
else
if
(
color
===
'
approvedDrug
'
)
{
...
...
@@ -126,40 +125,40 @@ export class NetworkSettings {
isSeed
:
boolean
,
isSelected
:
boolean
,
gradient
:
number
=
1
):
Node
{
// delete possible old styles
Object
.
keys
(
config
.
nodeGroups
.
default
).
forEach
(
e
=>
delete
node
[
e
]);
// set group styles
if
(
node
.
group
===
'
default
'
)
{
node
=
merge
(
node
,
config
.
nodeGroups
.
default
);
}
else
{
node
=
merge
(
node
,
config
.
nodeGroups
[
node
.
group
]);
}
// note that seed and selected node style are applied after the node style is fetched.
// this allows to overwrite only attributes of interest, therefor in e.g. seedNode group
// certain attributes like shape can remain undefined
// use lodash merge to not lose deep attributes, e.g. "font.size"
if
(
isSeed
)
{
// apply seed node style to node
node
=
merge
(
node
,
config
.
nodeGroups
.
seedNode
);
}
// selection on purpose after seed style, so seed style will be combined with selection style
if
(
isSelected
)
{
// apply selected node style to node
node
=
merge
(
node
,
config
.
nodeGroups
.
selectedNode
);
}
// delete possible old styles
Object
.
keys
(
config
.
nodeGroups
.
default
).
forEach
(
e
=>
delete
node
[
e
]);
// set group styles
if
(
node
.
group
===
'
default
'
)
{
node
=
merge
(
node
,
config
.
nodeGroups
.
default
);
}
else
{
node
=
merge
(
node
,
config
.
nodeGroups
[
node
.
group
]);
}
// note that seed and selected node style are applied after the node style is fetched.
// this allows to overwrite only attributes of interest, therefor in e.g. seedNode group
// certain attributes like shape can remain undefined
// use lodash merge to not lose deep attributes, e.g. "font.size"
if
(
isSeed
)
{
// apply seed node style to node
node
=
merge
(
node
,
config
.
nodeGroups
.
seedNode
);
}
// selection on purpose after seed style, so seed style will be combined with selection style
if
(
isSelected
)
{
// apply selected node style to node
node
=
merge
(
node
,
config
.
nodeGroups
.
selectedNode
);
}
// show image if image url is given. If seed nodes are highlighted, ignore image property
if
(
node
.
image
&&
!
isSeed
)
{
node
.
shape
=
'
image
'
;
}
// show image if image url is given. If seed nodes are highlighted, ignore image property
if
(
node
.
image
&&
!
isSeed
)
{
node
.
shape
=
'
image
'
;
}
// use opactiy as gradient
if
(
gradient
===
null
)
{
node
.
opacity
=
0
}
else
{
node
.
opacity
=
gradient
}
return
node
;
// use opactiy as gradient
if
(
gradient
===
null
)
{
node
.
opacity
=
0
}
else
{
node
.
opacity
=
gradient
}
return
node
;
}
}
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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