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
828c4dfd
Commit
828c4dfd
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-model: added entityId and atomId fields + ability to add postfix to all the id fields
parent
d3692ef0
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/export/categories/atom_site.ts
+53
-15
53 additions, 15 deletions
src/mol-model/structure/export/categories/atom_site.ts
src/mol-model/structure/export/categories/secondary-structure.ts
+4
-4
4 additions, 4 deletions
...-model/structure/export/categories/secondary-structure.ts
with
57 additions
and
19 deletions
src/mol-model/structure/export/categories/atom_site.ts
+
53
−
15
View file @
828c4dfd
...
@@ -63,18 +63,22 @@ export const _atom_site: CifCategory<CifExportContext> = {
...
@@ -63,18 +63,22 @@ export const _atom_site: CifCategory<CifExportContext> = {
}
}
}
}
function
prefixed
(
prefix
:
string
,
name
:
string
)
{
function
prepostfixed
(
prefix
:
string
|
undefined
,
postfix
:
string
|
undefined
,
name
:
string
)
{
return
prefix
?
`
${
prefix
}
_
${
name
}
`
:
name
;
if
(
prefix
&&
postfix
)
return
`
${
prefix
}
_
${
name
}
_
${
postfix
}
`
;
if
(
prefix
)
return
`
${
prefix
}
_
${
name
}
`
;
if
(
postfix
)
return
`
${
name
}
_
${
postfix
}
`
;
return
name
;
}
}
function
mappedProp
<
K
,
D
>
(
loc
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prop
:
(
e
:
StructureElement
)
=>
any
)
{
function
mappedProp
<
K
,
D
>
(
loc
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prop
:
(
e
:
StructureElement
)
=>
any
)
{
return
(
k
:
K
,
d
:
D
)
=>
prop
(
loc
(
k
,
d
));
return
(
k
:
K
,
d
:
D
)
=>
prop
(
loc
(
k
,
d
));
}
}
export
function
residueIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prefix
=
''
):
CifField
<
K
,
D
>
[]
{
export
function
residueIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
options
?:
{
prefix
?:
string
,
postfix
?:
string
}):
CifField
<
K
,
D
>
[]
{
const
prefix
=
options
&&
options
.
prefix
,
postfix
=
options
&&
options
.
postfix
;
return
CifWriter
.
fields
<
K
,
D
>
()
return
CifWriter
.
fields
<
K
,
D
>
()
.
str
(
prefixed
(
prefix
,
`label_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_comp_id
))
.
str
(
pre
post
fixed
(
prefix
,
postfix
,
`label_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_comp_id
))
.
int
(
prefixed
(
prefix
,
`label_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_seq_id
),
{
.
int
(
pre
post
fixed
(
prefix
,
postfix
,
`label_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_seq_id
),
{
encoder
:
E
.
deltaRLE
,
encoder
:
E
.
deltaRLE
,
valueKind
:
(
k
,
d
)
=>
{
valueKind
:
(
k
,
d
)
=>
{
const
e
=
getLocation
(
k
,
d
);
const
e
=
getLocation
(
k
,
d
);
...
@@ -82,21 +86,55 @@ export function residueIdFields<K, D>(getLocation: (key: K, data: D) => Structur
...
@@ -82,21 +86,55 @@ export function residueIdFields<K, D>(getLocation: (key: K, data: D) => Structur
return
m
.
atomicHierarchy
.
residues
.
label_seq_id
.
valueKind
(
m
.
atomicHierarchy
.
residueAtomSegments
.
index
[
e
.
element
]);
return
m
.
atomicHierarchy
.
residues
.
label_seq_id
.
valueKind
(
m
.
atomicHierarchy
.
residueAtomSegments
.
index
[
e
.
element
]);
}
}
})
})
.
str
(
prefixed
(
prefix
,
`pdbx_PDB_ins_code`
),
mappedProp
(
getLocation
,
P
.
residue
.
pdbx_PDB_ins_code
))
.
str
(
pre
post
fixed
(
prefix
,
postfix
,
`pdbx_PDB_ins_code`
),
mappedProp
(
getLocation
,
P
.
residue
.
pdbx_PDB_ins_code
))
.
str
(
prefixed
(
prefix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
))
.
str
(
pre
post
fixed
(
prefix
,
postfix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
))
.
str
(
prefixed
(
prefix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
))
.
str
(
pre
post
fixed
(
prefix
,
postfix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
))
.
str
(
prefixed
(
prefix
,
`auth_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_comp_id
))
.
str
(
pre
post
fixed
(
prefix
,
postfix
,
`auth_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_comp_id
))
.
int
(
prefixed
(
prefix
,
`auth_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_seq_id
),
{
encoder
:
E
.
deltaRLE
})
.
int
(
pre
post
fixed
(
prefix
,
postfix
,
`auth_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_seq_id
),
{
encoder
:
E
.
deltaRLE
})
.
str
(
prefixed
(
prefix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
.
str
(
pre
post
fixed
(
prefix
,
postfix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
.
getFields
();
.
getFields
();
}
}
export
function
chainIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prefix
=
''
):
CifField
<
K
,
D
>
[]
{
export
function
chainIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
options
?:
{
prefix
?:
string
,
postfix
?:
string
}):
CifField
<
K
,
D
>
[]
{
const
prefix
=
options
&&
options
.
prefix
,
postfix
=
options
&&
options
.
postfix
;
return
CifField
.
build
<
K
,
D
>
()
return
CifField
.
build
<
K
,
D
>
()
.
str
(
prefixed
(
prefix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
))
.
str
(
prefixed
(
prefix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
))
.
str
(
prefixed
(
prefix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
.
getFields
();
}
export
function
entityIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
options
?:
{
prefix
?:
string
,
postfix
?:
string
}):
CifField
<
K
,
D
>
[]
{
const
prefix
=
options
&&
options
.
prefix
,
postfix
=
options
&&
options
.
postfix
;
return
CifField
.
build
<
K
,
D
>
()
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
))
.
getFields
();
}
export
function
atomIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
options
?:
{
prefix
?:
string
,
postfix
?:
string
}):
CifField
<
K
,
D
>
[]
{
const
prefix
=
options
&&
options
.
prefix
,
postfix
=
options
&&
options
.
postfix
;
return
CifWriter
.
fields
<
K
,
D
>
()
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_atom_id`
),
mappedProp
(
getLocation
,
P
.
atom
.
label_atom_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_comp_id
))
.
int
(
prepostfixed
(
prefix
,
postfix
,
`label_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_seq_id
),
{
encoder
:
E
.
deltaRLE
,
valueKind
:
(
k
,
d
)
=>
{
const
e
=
getLocation
(
k
,
d
);
const
m
=
e
.
unit
.
model
;
return
m
.
atomicHierarchy
.
residues
.
label_seq_id
.
valueKind
(
m
.
atomicHierarchy
.
residueAtomSegments
.
index
[
e
.
element
]);
}
})
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_alt_id`
),
mappedProp
(
getLocation
,
P
.
atom
.
label_alt_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`pdbx_PDB_ins_code`
),
mappedProp
(
getLocation
,
P
.
residue
.
pdbx_PDB_ins_code
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`auth_atom_id`
),
mappedProp
(
getLocation
,
P
.
atom
.
auth_atom_id
))
.
str
(
prepostfixed
(
prefix
,
postfix
,
`auth_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_comp_id
))
.
int
(
prepostfixed
(
prefix
,
postfix
,
`auth_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_seq_id
),
{
encoder
:
E
.
deltaRLE
})
.
str
(
prepostfixed
(
prefix
,
postfix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
.
getFields
();
.
getFields
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-model/structure/export/categories/secondary-structure.ts
+
4
−
4
View file @
828c4dfd
...
@@ -44,8 +44,8 @@ function compare_ssr(x: SSElement<SecondaryStructure.Sheet>, y: SSElement<Second
...
@@ -44,8 +44,8 @@ function compare_ssr(x: SSElement<SecondaryStructure.Sheet>, y: SSElement<Second
const
struct_conf_fields
:
CifField
[]
=
[
const
struct_conf_fields
:
CifField
[]
=
[
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
conf_type_id
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
type_id
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
conf_type_id
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
type_id
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
id
'
,
(
i
,
data
,
idx
)
=>
`
${
data
[
i
].
element
.
type_id
}${
idx
+
1
}
`
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
id
'
,
(
i
,
data
,
idx
)
=>
`
${
data
[
i
].
element
.
type_id
}${
idx
+
1
}
`
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
((
i
,
e
)
=>
e
[
i
].
start
,
'
beg
'
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
((
i
,
e
)
=>
e
[
i
].
start
,
{
prefix
:
'
beg
'
}
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
((
i
,
e
)
=>
e
[
i
].
end
,
'
end
'
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
((
i
,
e
)
=>
e
[
i
].
end
,
{
prefix
:
'
end
'
}
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
pdbx_PDB_helix_class
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
helix_class
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
pdbx_PDB_helix_class
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
helix_class
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
details
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
details
||
''
,
{
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
(
'
details
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
details
||
''
,
{
valueKind
:
(
i
,
d
)
=>
!!
d
[
i
].
element
.
details
?
Column
.
ValueKind
.
Present
:
Column
.
ValueKind
.
Unknown
valueKind
:
(
i
,
d
)
=>
!!
d
[
i
].
element
.
details
?
Column
.
ValueKind
.
Present
:
Column
.
ValueKind
.
Unknown
...
@@ -56,8 +56,8 @@ const struct_conf_fields: CifField[] = [
...
@@ -56,8 +56,8 @@ const struct_conf_fields: CifField[] = [
const
struct_sheet_range_fields
:
CifField
[]
=
[
const
struct_sheet_range_fields
:
CifField
[]
=
[
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
(
'
sheet_id
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
sheet_id
),
CifField
.
str
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
(
'
sheet_id
'
,
(
i
,
data
)
=>
data
[
i
].
element
.
sheet_id
),
CifField
.
index
(
'
id
'
),
CifField
.
index
(
'
id
'
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
((
i
,
e
)
=>
e
[
i
].
start
,
'
beg
'
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
((
i
,
e
)
=>
e
[
i
].
start
,
{
prefix
:
'
beg
'
}
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
((
i
,
e
)
=>
e
[
i
].
end
,
'
end
'
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
((
i
,
e
)
=>
e
[
i
].
end
,
{
prefix
:
'
end
'
}
),
CifField
.
str
(
'
symmetry
'
,
(
i
,
data
)
=>
''
,
{
valueKind
:
(
i
,
d
)
=>
Column
.
ValueKind
.
Unknown
})
CifField
.
str
(
'
symmetry
'
,
(
i
,
data
)
=>
''
,
{
valueKind
:
(
i
,
d
)
=>
Column
.
ValueKind
.
Unknown
})
];
];
...
...
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