Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
Show more breadcrumbs
Michal Malý
Molstar
Commits
a9127093
Commit
a9127093
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
Update mol-model ComponentBond to support external data
parent
cc5c38d4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-model/structure/model/formats/mmcif/bonds/comp.ts
+29
-16
29 additions, 16 deletions
src/mol-model/structure/model/formats/mmcif/bonds/comp.ts
src/mol-model/structure/model/properties/custom/collection.ts
+2
-0
2 additions, 0 deletions
...mol-model/structure/model/properties/custom/collection.ts
with
31 additions
and
16 deletions
src/mol-model/structure/model/formats/mmcif/bonds/comp.ts
+
29
−
16
View file @
a9127093
...
@@ -47,11 +47,20 @@ export namespace ComponentBond {
...
@@ -47,11 +47,20 @@ export namespace ComponentBond {
if
(
model
.
sourceData
.
kind
!==
'
mmCIF
'
)
return
false
;
if
(
model
.
sourceData
.
kind
!==
'
mmCIF
'
)
return
false
;
const
{
chem_comp_bond
}
=
model
.
sourceData
.
data
;
const
{
chem_comp_bond
}
=
model
.
sourceData
.
data
;
if
(
chem_comp_bond
.
_rowCount
===
0
)
return
false
;
if
(
chem_comp_bond
.
_rowCount
===
0
)
return
false
;
model
.
customProperties
.
add
(
Descriptor
);
model
.
customProperties
.
add
(
Descriptor
);
model
.
_staticPropertyData
.
__ComponentBondData__
=
chem_comp_bond
;
model
.
_staticPropertyData
.
__ComponentBondData__
=
chem_comp_bond
;
return
true
;
return
true
;
}
}
export
function
attachFromExternalData
(
model
:
Model
,
bonds
:
ComponentBond
,
force
=
false
)
{
if
(
!
force
&&
model
.
customProperties
.
has
(
Descriptor
))
return
true
;
if
(
model
.
_staticPropertyData
.
__ComponentBondData__
)
delete
model
.
_staticPropertyData
.
__ComponentBondData__
;
model
.
customProperties
.
add
(
Descriptor
);
model
.
_staticPropertyData
[
PropName
]
=
bonds
;
return
true
;
}
export
class
ComponentBondImpl
implements
ComponentBond
{
export
class
ComponentBondImpl
implements
ComponentBond
{
entries
:
Map
<
string
,
ComponentBond
.
Entry
>
=
new
Map
();
entries
:
Map
<
string
,
ComponentBond
.
Entry
>
=
new
Map
();
...
@@ -62,7 +71,7 @@ export namespace ComponentBond {
...
@@ -62,7 +71,7 @@ export namespace ComponentBond {
}
}
}
}
export
class
Entry
implements
Entry
{
export
class
Entry
{
map
:
Map
<
string
,
Map
<
string
,
{
order
:
number
,
flags
:
number
}
>>
=
new
Map
();
map
:
Map
<
string
,
Map
<
string
,
{
order
:
number
,
flags
:
number
}
>>
=
new
Map
();
add
(
a
:
string
,
b
:
string
,
order
:
number
,
flags
:
number
,
swap
=
true
)
{
add
(
a
:
string
,
b
:
string
,
order
:
number
,
flags
:
number
,
swap
=
true
)
{
...
@@ -85,24 +94,12 @@ export namespace ComponentBond {
...
@@ -85,24 +94,12 @@ export namespace ComponentBond {
}
}
}
}
function
getChemCompBond
(
model
:
Model
)
{
export
function
parseChemCompBond
(
data
:
mmCIF_Database
[
'
chem_comp_bond
'
]):
ComponentBond
{
return
model
.
_staticPropertyData
.
__ComponentBondData__
as
mmCIF_Database
[
'
chem_comp_bond
'
];
const
{
comp_id
,
atom_id_1
,
atom_id_2
,
value_order
,
pdbx_aromatic_flag
,
_rowCount
:
rowCount
}
=
data
;
}
export
const
PropName
=
'
__ComponentBond__
'
;
export
function
get
(
model
:
Model
):
ComponentBond
|
undefined
{
if
(
model
.
_staticPropertyData
[
PropName
])
return
model
.
_staticPropertyData
[
PropName
];
if
(
!
model
.
customProperties
.
has
(
Descriptor
))
return
void
0
;
const
chem_comp_bond
=
getChemCompBond
(
model
);
const
compBond
=
new
ComponentBondImpl
();
const
compBond
=
new
ComponentBondImpl
();
const
{
comp_id
,
atom_id_1
,
atom_id_2
,
value_order
,
pdbx_aromatic_flag
,
_rowCount
:
rowCount
}
=
chem_comp_bond
;
let
entry
=
compBond
.
addEntry
(
comp_id
.
value
(
0
)
!
);
let
entry
=
compBond
.
addEntry
(
comp_id
.
value
(
0
)
!
);
for
(
let
i
=
0
;
i
<
rowCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
rowCount
;
i
++
)
{
const
id
=
comp_id
.
value
(
i
)
!
;
const
id
=
comp_id
.
value
(
i
)
!
;
const
nameA
=
atom_id_1
.
value
(
i
)
!
;
const
nameA
=
atom_id_1
.
value
(
i
)
!
;
const
nameB
=
atom_id_2
.
value
(
i
)
!
;
const
nameB
=
atom_id_2
.
value
(
i
)
!
;
...
@@ -128,10 +125,26 @@ export namespace ComponentBond {
...
@@ -128,10 +125,26 @@ export namespace ComponentBond {
entry
.
add
(
nameA
,
nameB
,
ord
,
flags
);
entry
.
add
(
nameA
,
nameB
,
ord
,
flags
);
}
}
model
.
_staticPropertyData
[
PropName
]
=
compBond
;
return
compBond
;
return
compBond
;
}
}
function
getChemCompBond
(
model
:
Model
)
{
return
model
.
_staticPropertyData
.
__ComponentBondData__
as
mmCIF_Database
[
'
chem_comp_bond
'
];
}
export
const
PropName
=
'
__ComponentBond__
'
;
export
function
get
(
model
:
Model
):
ComponentBond
|
undefined
{
if
(
model
.
_staticPropertyData
[
PropName
])
return
model
.
_staticPropertyData
[
PropName
];
if
(
!
model
.
customProperties
.
has
(
Descriptor
))
return
void
0
;
const
chem_comp_bond
=
getChemCompBond
(
model
);
if
(
!
chem_comp_bond
)
return
void
0
;
const
chemComp
=
parseChemCompBond
(
chem_comp_bond
);
model
.
_staticPropertyData
[
PropName
]
=
chemComp
;
return
chemComp
;
}
function
getUniqueResidueNames
(
s
:
Structure
)
{
function
getUniqueResidueNames
(
s
:
Structure
)
{
const
prop
=
StructureProperties
.
residue
.
label_comp_id
;
const
prop
=
StructureProperties
.
residue
.
label_comp_id
;
const
names
=
new
Set
<
string
>
();
const
names
=
new
Set
<
string
>
();
...
...
This diff is collapsed.
Click to expand it.
src/mol-model/structure/model/properties/custom/collection.ts
+
2
−
0
View file @
a9127093
...
@@ -15,6 +15,8 @@ export class CustomProperties {
...
@@ -15,6 +15,8 @@ export class CustomProperties {
}
}
add
(
desc
:
ModelPropertyDescriptor
)
{
add
(
desc
:
ModelPropertyDescriptor
)
{
if
(
this
.
_set
.
has
(
desc
))
return
;
this
.
_list
.
push
(
desc
);
this
.
_list
.
push
(
desc
);
this
.
_set
.
add
(
desc
);
this
.
_set
.
add
(
desc
);
}
}
...
...
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