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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
58b1d7e0
Commit
58b1d7e0
authored
5 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-model & formats: added fallback when chem_comp category is missing
parent
da1deee7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-model-formats/structure/mmcif/parser.ts
+12
-4
12 additions, 4 deletions
src/mol-model-formats/structure/mmcif/parser.ts
src/mol-model/structure/model/types.ts
+15
-1
15 additions, 1 deletion
src/mol-model/structure/model/types.ts
with
27 additions
and
5 deletions
src/mol-model-formats/structure/mmcif/parser.ts
+
12
−
4
View file @
58b1d7e0
...
...
@@ -23,7 +23,7 @@ import { getSecondaryStructure } from './secondary-structure';
import
{
getSequence
}
from
'
./sequence
'
;
import
{
sortAtomSite
}
from
'
./sort
'
;
import
{
StructConn
}
from
'
./bonds/struct_conn
'
;
import
{
getMoleculeType
,
MoleculeType
,
getEntityType
,
getEntitySubtype
}
from
'
../../../mol-model/structure/model/types
'
;
import
{
getMoleculeType
,
MoleculeType
,
getEntityType
,
getEntitySubtype
,
getDefaultChemicalComponent
}
from
'
../../../mol-model/structure/model/types
'
;
import
{
ModelFormat
}
from
'
../format
'
;
import
{
SaccharideComponentMap
,
SaccharideComponent
,
SaccharidesSnfgMap
,
SaccharideCompIdMap
,
UnknownSaccharideComponent
}
from
'
../../../mol-model/structure/structure/carbohydrates/constants
'
;
import
mmCIF_Format
=
ModelFormat
.
mmCIF
...
...
@@ -127,10 +127,18 @@ function getMissingResidues(format: mmCIF_Format): Model['properties']['missingR
function
getChemicalComponentMap
(
format
:
mmCIF_Format
):
Model
[
'
properties
'
][
'
chemicalComponentMap
'
]
{
const
map
=
new
Map
<
string
,
ChemicalComponent
>
();
const
{
chem_comp
}
=
format
.
data
if
(
chem_comp
.
_rowCount
>
0
)
{
const
{
id
}
=
chem_comp
for
(
let
i
=
0
,
il
=
id
.
rowCount
;
i
<
il
;
++
i
)
{
map
.
set
(
id
.
value
(
i
),
Table
.
getRow
(
chem_comp
,
i
))
}
}
else
{
const
uniqueNames
=
getUniqueComponentNames
(
format
);
uniqueNames
.
forEach
(
n
=>
{
map
.
set
(
n
,
getDefaultChemicalComponent
(
n
));
});
}
return
map
}
...
...
This diff is collapsed.
Click to expand it.
src/mol-model/structure/model/types.ts
+
15
−
1
View file @
58b1d7e0
...
...
@@ -9,7 +9,7 @@ import BitFlags from '../../../mol-util/bit-flags'
import
{
SaccharideCompIdMap
}
from
'
../structure/carbohydrates/constants
'
;
import
{
mmCIF_Schema
}
from
'
../../../mol-io/reader/cif/schema/mmcif
'
;
import
{
SetUtils
}
from
'
../../../mol-util/set
'
;
import
{
EntitySubtype
}
from
'
./properties/common
'
;
import
{
EntitySubtype
,
ChemicalComponent
}
from
'
./properties/common
'
;
const
_esCache
=
(
function
()
{
const
cache
=
Object
.
create
(
null
);
...
...
@@ -245,6 +245,20 @@ export function getComponentType(compId: string): mmCIF_Schema['chem_comp']['typ
}
}
export
function
getDefaultChemicalComponent
(
compId
:
string
):
ChemicalComponent
{
// TODO: this is to make the chem_comp_type property work if chem_comp category is not present.
// should we try to set the formula etc better?
return
{
formula
:
''
,
formula_weight
:
0
,
id
:
compId
,
name
:
compId
,
mon_nstd_flag
:
'
n
'
,
pdbx_synonyms
:
[],
type
:
getComponentType
(
compId
)
};
}
export
function
getEntityType
(
compId
:
string
):
mmCIF_Schema
[
'
entity
'
][
'
type
'
][
'
T
'
]
{
compId
=
compId
.
toUpperCase
()
if
(
WaterNames
.
has
(
compId
))
{
...
...
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