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
1436108d
Commit
1436108d
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
atom_site mmCIF export helpers
parent
8acecbd2
Branches
Branches containing commit
Tags
Tags containing commit
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
+26
-10
26 additions, 10 deletions
src/mol-model/structure/export/categories/atom_site.ts
src/mol-model/structure/export/categories/secondary-structure.ts
+6
-18
6 additions, 18 deletions
...-model/structure/export/categories/secondary-structure.ts
with
32 additions
and
28 deletions
src/mol-model/structure/export/categories/atom_site.ts
+
26
−
10
View file @
1436108d
...
@@ -61,10 +61,18 @@ export const _atom_site: CifCategory<CifExportContext> = {
...
@@ -61,10 +61,18 @@ export const _atom_site: CifCategory<CifExportContext> = {
}
}
}
}
export
function
residueIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
):
CifField
<
K
,
D
>
[]
{
function
prefixed
(
prefix
:
string
,
name
:
string
)
{
return
prefix
?
`
${
prefix
}
_
${
name
}
`
:
name
;
}
function
mappedProp
<
K
,
D
>
(
loc
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prop
:
(
e
:
StructureElement
)
=>
any
)
{
return
(
k
:
K
,
d
:
D
)
=>
prop
(
loc
(
k
,
d
));
}
export
function
residueIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prefix
=
''
):
CifField
<
K
,
D
>
[]
{
return
[
return
[
CifField
.
str
(
'
label_comp_id
'
,
(
k
,
d
)
=>
P
.
residue
.
label_comp_id
(
getLocation
(
k
,
d
)
)),
CifField
.
str
(
prefixed
(
prefix
,
`label_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
label_comp_id
)),
CifField
.
int
(
'
label_seq_id
'
,
(
k
,
d
)
=>
P
.
residue
.
label_seq_id
(
getLocation
(
k
,
d
)
),
{
CifField
.
int
(
prefixed
(
prefix
,
`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
);
...
@@ -72,13 +80,21 @@ export function residueIdFields<K, D>(getLocation: (key: K, data: D) => Structur
...
@@ -72,13 +80,21 @@ 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
]);
}
}
}),
}),
CifField
.
str
(
'
pdbx_PDB_ins_code
'
,
(
k
,
d
)
=>
P
.
residue
.
pdbx_PDB_ins_code
(
getLocation
(
k
,
d
)
)),
CifField
.
str
(
prefixed
(
prefix
,
`pdbx_PDB_ins_code`
),
mappedProp
(
getLocation
,
P
.
residue
.
pdbx_PDB_ins_code
)),
CifField
.
str
(
'
label_asym_id
'
,
(
k
,
d
)
=>
P
.
chain
.
label_asym_id
(
getLocation
(
k
,
d
)
)),
CifField
.
str
(
prefixed
(
prefix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
)),
CifField
.
str
(
'
label_entity_id
'
,
(
k
,
d
)
=>
P
.
chain
.
label_entity_id
(
getLocation
(
k
,
d
)
)),
CifField
.
str
(
prefixed
(
prefix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
)),
CifField
.
str
(
'
auth_comp_id
'
,
(
k
,
d
)
=>
P
.
residue
.
auth_comp_id
(
getLocation
(
k
,
d
))),
CifField
.
str
(
prefixed
(
prefix
,
`auth_comp_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_comp_id
)),
CifField
.
int
(
'
auth_seq_id
'
,
(
k
,
d
)
=>
P
.
residue
.
auth_seq_id
(
getLocation
(
k
,
d
)),
{
encoder
:
E
.
deltaRLE
}),
CifField
.
int
(
prefixed
(
prefix
,
`auth_seq_id`
),
mappedProp
(
getLocation
,
P
.
residue
.
auth_seq_id
),
{
encoder
:
E
.
deltaRLE
}),
CifField
.
str
(
'
auth_asym_id
'
,
(
k
,
d
)
=>
P
.
chain
.
auth_asym_id
(
getLocation
(
k
,
d
))),
CifField
.
str
(
prefixed
(
prefix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
]
];
}
export
function
chainIdFields
<
K
,
D
>
(
getLocation
:
(
key
:
K
,
data
:
D
)
=>
StructureElement
,
prefix
=
''
):
CifField
<
K
,
D
>
[]
{
return
[
CifField
.
str
(
prefixed
(
prefix
,
`label_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_asym_id
)),
CifField
.
str
(
prefixed
(
prefix
,
`label_entity_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
label_entity_id
)),
CifField
.
str
(
prefixed
(
prefix
,
`auth_asym_id`
),
mappedProp
(
getLocation
,
P
.
chain
.
auth_asym_id
))
];
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-model/structure/export/categories/secondary-structure.ts
+
6
−
18
View file @
1436108d
...
@@ -7,11 +7,12 @@
...
@@ -7,11 +7,12 @@
import
{
Segmentation
}
from
'
mol-data/int
'
;
import
{
Segmentation
}
from
'
mol-data/int
'
;
import
{
CifWriter
}
from
'
mol-io/writer/cif
'
;
import
{
CifWriter
}
from
'
mol-io/writer/cif
'
;
import
{
SecondaryStructure
}
from
'
../../model/properties/seconday-structure
'
;
import
{
SecondaryStructure
}
from
'
../../model/properties/seconday-structure
'
;
import
{
StructureElement
,
Unit
,
StructureProperties
as
P
}
from
'
../../structure
'
;
import
{
StructureElement
,
Unit
}
from
'
../../structure
'
;
import
{
CifExportContext
}
from
'
../mmcif
'
;
import
{
CifExportContext
}
from
'
../mmcif
'
;
import
CifField
=
CifWriter
.
Field
import
CifField
=
CifWriter
.
Field
import
CifCategory
=
CifWriter
.
Category
import
CifCategory
=
CifWriter
.
Category
import
{
Column
}
from
'
mol-data/db
'
;
import
{
Column
}
from
'
mol-data/db
'
;
import
{
residueIdFields
}
from
'
./atom_site
'
;
export
const
_struct_conf
:
CifCategory
<
CifExportContext
>
=
{
export
const
_struct_conf
:
CifCategory
<
CifExportContext
>
=
{
name
:
'
struct_conf
'
,
name
:
'
struct_conf
'
,
...
@@ -37,8 +38,8 @@ function compare_ssr(x: SSElement<SecondaryStructure.Sheet>, y: SSElement<Second
...
@@ -37,8 +38,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
(
'
beg_
'
,
e
=>
e
.
start
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
((
i
,
e
)
=>
e
[
i
]
.
start
,
'
beg
'
),
...
residueIdFields
(
'
end_
'
,
e
=>
e
.
end
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
((
i
,
e
)
=>
e
[
i
]
.
end
,
'
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
...
@@ -49,24 +50,11 @@ const struct_conf_fields: CifField[] = [
...
@@ -49,24 +50,11 @@ 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
(
'
beg_
'
,
e
=>
e
.
start
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
((
i
,
e
)
=>
e
[
i
]
.
start
,
'
beg
'
),
...
residueIdFields
(
'
end_
'
,
e
=>
e
.
end
),
...
residueIdFields
<
number
,
SSElement
<
SecondaryStructure
.
Sheet
>
[]
>
((
i
,
e
)
=>
e
[
i
]
.
end
,
'
end
'
),
CifField
.
str
(
'
symmetry
'
,
(
i
,
data
)
=>
''
,
{
valueKind
:
(
i
,
d
)
=>
Column
.
ValueKind
.
Unknown
})
CifField
.
str
(
'
symmetry
'
,
(
i
,
data
)
=>
''
,
{
valueKind
:
(
i
,
d
)
=>
Column
.
ValueKind
.
Unknown
})
];
];
function
residueIdFields
(
prefix
:
string
,
loc
:
(
e
:
SSElement
<
any
>
)
=>
StructureElement
):
CifField
<
number
,
SSElement
<
SecondaryStructure
.
Helix
>
[]
>
[]
{
return
[
CifField
.
str
(
`
${
prefix
}
label_comp_id`
,
(
i
,
d
)
=>
P
.
residue
.
label_comp_id
(
loc
(
d
[
i
]))),
CifField
.
int
(
`
${
prefix
}
label_seq_id`
,
(
i
,
d
)
=>
P
.
residue
.
label_seq_id
(
loc
(
d
[
i
]))),
CifField
.
str
(
`pdbx_
${
prefix
}
PDB_ins_code`
,
(
i
,
d
)
=>
P
.
residue
.
pdbx_PDB_ins_code
(
loc
(
d
[
i
]))),
CifField
.
str
(
`
${
prefix
}
label_asym_id`
,
(
i
,
d
)
=>
P
.
chain
.
label_asym_id
(
loc
(
d
[
i
]))),
CifField
.
str
(
`
${
prefix
}
label_entity_id`
,
(
i
,
d
)
=>
P
.
chain
.
label_entity_id
(
loc
(
d
[
i
]))),
CifField
.
str
(
`
${
prefix
}
auth_comp_id`
,
(
i
,
d
)
=>
P
.
residue
.
auth_comp_id
(
loc
(
d
[
i
]))),
CifField
.
int
(
`
${
prefix
}
auth_seq_id`
,
(
i
,
d
)
=>
P
.
residue
.
auth_seq_id
(
loc
(
d
[
i
]))),
CifField
.
str
(
`
${
prefix
}
auth_asym_id`
,
(
i
,
d
)
=>
P
.
chain
.
auth_asym_id
(
loc
(
d
[
i
])))
];
}
interface
SSElement
<
T
extends
SecondaryStructure
.
Element
>
{
interface
SSElement
<
T
extends
SecondaryStructure
.
Element
>
{
start
:
StructureElement
,
start
:
StructureElement
,
end
:
StructureElement
,
end
:
StructureElement
,
...
...
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