Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pdb-ligand-env
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
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
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pdbe
web-components
pdb-ligand-env
Commits
5cea7d9e
Commit
5cea7d9e
authored
4 years ago
by
Lukas Pravda
Browse files
Options
Downloads
Patches
Plain Diff
improve default ligand layout
parent
cc50865c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugin/depiction.ts
+19
-15
19 additions, 15 deletions
src/plugin/depiction.ts
src/plugin/manager.ts
+11
-10
11 additions, 10 deletions
src/plugin/manager.ts
src/plugin/model.ts
+4
-1
4 additions, 1 deletion
src/plugin/model.ts
with
34 additions
and
26 deletions
src/plugin/depiction.ts
+
19
−
15
View file @
5cea7d9e
...
...
@@ -38,10 +38,19 @@ class Depiction {
this
.
atoms
=
data
.
atoms
.
map
(
x
=>
new
Atom
(
x
));
this
.
bonds
=
new
Array
<
Bond
>
();
let
bds
=
new
Set
<
string
>
();
data
.
bonds
.
forEach
(
x
=>
{
var
atomA
=
this
.
atoms
.
find
(
e
=>
e
.
name
==
x
.
bgn
);
var
atomB
=
this
.
atoms
.
find
(
e
=>
e
.
name
==
x
.
end
);
var
bond
=
new
Bond
(
atomA
,
atomB
,
x
.
coords
,
x
.
style
);
let
atomA
=
this
.
atoms
.
find
(
e
=>
e
.
name
==
x
.
bgn
);
let
atomB
=
this
.
atoms
.
find
(
e
=>
e
.
name
==
x
.
end
);
let
bond
=
new
Bond
(
atomA
,
atomB
,
x
.
coords
,
x
.
style
);
let
bondFlag
=
[
atomA
.
name
,
atomB
.
name
].
sort
().
join
(
"
_
"
);
if
(
!
bds
.
has
(
bondFlag
))
{
bds
.
add
(
bondFlag
);
atomA
.
connectivity
++
;
atomB
.
connectivity
++
;
}
this
.
bonds
.
push
(
bond
);
});
...
...
@@ -67,16 +76,9 @@ class Depiction {
}
// ideally we want to find an atom which is part just a single bond to get nice initial position.
// If there is no such atom any will do
let
searchStruct
=
new
Map
<
string
,
number
>
();
this
.
bonds
.
forEach
(
x
=>
{
searchStruct
.
set
(
x
.
bgn
.
name
,
searchStruct
.
get
(
x
.
bgn
.
name
)
===
undefined
?
1
:
searchStruct
.
get
(
x
.
bgn
.
name
)
+
1
);
searchStruct
.
set
(
x
.
end
.
name
,
searchStruct
.
get
(
x
.
end
.
name
)
===
undefined
?
1
:
searchStruct
.
get
(
x
.
end
.
name
)
+
1
);
});
searchStruct
=
this
.
sortMap
(
searchStruct
);
// ascending order so we hit those with less partners sooner.
let
thisAtomName
=
[...
searchStruct
.
keys
()].
find
(
x
=>
atomNames
.
f
in
dIndex
(
y
=>
y
===
x
)
!==
-
1
)
let
thisAtom
=
this
.
atoms
.
find
(
x
=>
x
.
name
===
thisAtomName
)
;
let
atoms
=
this
.
atoms
.
filter
(
x
=>
atomNames
.
in
cludes
(
x
.
name
)).
sort
((
x
,
y
)
=>
x
.
connectivity
-
y
.
connectivity
);
let
thisAtom
=
atoms
[
0
]
;
let
bond
=
this
.
bonds
.
find
(
x
=>
x
.
containsAtom
(
thisAtom
));
let
otherAtom
=
bond
.
getOtherAtom
(
thisAtom
);
...
...
@@ -231,10 +233,13 @@ class Atom {
name
:
string
;
labels
:
any
;
position
:
Vector2D
;
connectivity
:
number
constructor
(
item
:
any
)
{
this
.
name
=
item
.
name
;
this
.
labels
=
item
.
labels
;
this
.
position
=
new
Vector2D
(
item
.
x
,
item
.
y
)
this
.
position
=
new
Vector2D
(
item
.
x
,
item
.
y
);
this
.
connectivity
=
0
;
}
/**
...
...
@@ -337,7 +342,6 @@ class Bond {
coords
:
string
;
style
:
string
;
/**
*Creates an instance of the bond.
* @param {Atom} a
...
...
@@ -348,7 +352,7 @@ class Bond {
this
.
bgn
=
a
;
this
.
end
=
b
;
this
.
coords
=
coords
;
this
.
style
=
style
.
replace
(
"
stroke-width:2px
"
,
"
stroke-width:4px
"
);
;
this
.
style
=
style
.
replace
(
"
stroke-width:2px
"
,
"
stroke-width:4px
"
);
}
...
...
This diff is collapsed.
Click to expand it.
src/plugin/manager.ts
+
11
−
10
View file @
5cea7d9e
...
...
@@ -688,15 +688,17 @@ class Visualization {
this
.
presentBindingSite
.
interactionNodes
.
filter
((
x
:
Model
.
InteractionNode
)
=>
!
x
.
residue
.
isLigand
)
.
forEach
((
x
:
Model
.
InteractionNode
)
=>
{
let
lnks
=
this
.
presentBindingSite
.
links
.
filter
((
y
:
Model
.
LigandResidueLink
)
=>
y
.
containsNode
(
x
))
let
links
=
this
.
presentBindingSite
.
links
.
filter
((
y
:
Model
.
LigandResidueLink
)
=>
y
.
containsNode
(
x
)
&&
y
.
getLinkClass
()
!==
'
hydrophobic
'
);
links
=
links
.
length
==
0
?
this
.
presentBindingSite
.
links
.
filter
((
y
:
Model
.
LigandResidueLink
)
=>
y
.
containsNode
(
x
))
:
links
;
let
atom_names
=
links
.
map
((
y
:
Model
.
LigandResidueLink
)
=>
[].
concat
.
apply
([],
y
.
interaction
.
map
(
z
=>
z
.
sourceAtoms
)));
let
concated
=
[].
concat
.
apply
([],
lnk
s
);
let
concated
=
[].
concat
.
apply
([],
atom_name
s
);
let
position
:
Vector2D
=
this
.
depiction
.
getInitalNodePosition
(
concated
);
x
.
x
=
position
.
x
+
Math
.
random
()
*
110
;
x
.
y
=
position
.
y
+
Math
.
random
()
*
110
;
x
.
x
=
position
.
x
+
Math
.
random
()
*
55
;
x
.
y
=
position
.
y
+
Math
.
random
()
*
55
;
});
...
...
@@ -730,11 +732,10 @@ class Visualization {
let
forceLink
=
d3
.
forceLink
()
.
links
(
this
.
links
.
filter
((
x
:
Model
.
LigandResidueLink
)
=>
x
.
getLinkClass
()
!==
'
hydrophobic
'
))
.
distance
(
70
)
.
strength
(
0.5
);
.
distance
(
5
);
let
charge
=
d3
.
forceManyBody
().
strength
(
-
10
0
).
distanceMin
(
4
0
).
distanceMax
(
8
0
);
let
collision
=
d3
.
forceCollide
(
).
radius
(
4
5
);
let
charge
=
d3
.
forceManyBody
().
strength
(
-
8
0
).
distanceMin
(
1
0
).
distanceMax
(
2
0
);
let
collision
=
d3
.
forceCollide
(
50
).
iterations
(
10
).
strength
(
0.
5
);
this
.
simulation
=
d3
.
forceSimulation
(
this
.
presentBindingSite
.
interactionNodes
)
.
force
(
'
link
'
,
forceLink
)
...
...
This diff is collapsed.
Click to expand it.
src/plugin/model.ts
+
4
−
1
View file @
5cea7d9e
...
...
@@ -182,8 +182,11 @@ namespace Model {
public
containsResidue
(
n
:
Residue
):
boolean
{
return
(
this
.
target
.
residue
.
equals
(
n
)
||
this
.
source
.
residue
.
equals
(
n
));
}
}
public
getOtherNode
(
node
:
InteractionNode
)
{
return
this
.
source
.
equals
(
node
)
?
this
.
target
:
this
.
source
;
}
abstract
getLinkClass
():
string
;
abstract
hasClash
():
boolean
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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