|
@@ -7,11 +7,12 @@
|
|
|
import { Segmentation } from 'mol-data/int';
|
|
|
import { CifWriter } from 'mol-io/writer/cif';
|
|
|
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 CifField = CifWriter.Field
|
|
|
import CifCategory = CifWriter.Category
|
|
|
import { Column } from 'mol-data/db';
|
|
|
+import { residueIdFields } from './atom_site';
|
|
|
|
|
|
export const _struct_conf: CifCategory<CifExportContext> = {
|
|
|
name: 'struct_conf',
|
|
@@ -37,8 +38,8 @@ function compare_ssr(x: SSElement<SecondaryStructure.Sheet>, y: SSElement<Second
|
|
|
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>[]>('id', (i, data, idx) => `${data[i].element.type_id}${idx + 1}`),
|
|
|
- ...residueIdFields('beg_', e => e.start),
|
|
|
- ...residueIdFields('end_', e => e.end),
|
|
|
+ ...residueIdFields<number, SSElement<SecondaryStructure.Helix>[]>((i, e) => e[i].start, 'beg'),
|
|
|
+ ...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>[]>('details', (i, data) => data[i].element.details || '', {
|
|
|
valueKind: (i, d) => !!d[i].element.details ? Column.ValueKind.Present : Column.ValueKind.Unknown
|
|
@@ -49,24 +50,11 @@ const struct_conf_fields: CifField[] = [
|
|
|
const struct_sheet_range_fields: CifField[] = [
|
|
|
CifField.str<number, SSElement<SecondaryStructure.Sheet>[]>('sheet_id', (i, data) => data[i].element.sheet_id),
|
|
|
CifField.index('id'),
|
|
|
- ...residueIdFields('beg_', e => e.start),
|
|
|
- ...residueIdFields('end_', e => e.end),
|
|
|
+ ...residueIdFields<number, SSElement<SecondaryStructure.Sheet>[]>((i, e) => e[i].start, 'beg'),
|
|
|
+ ...residueIdFields<number, SSElement<SecondaryStructure.Sheet>[]>((i, e) => e[i].end, 'end'),
|
|
|
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> {
|
|
|
start: StructureElement,
|
|
|
end: StructureElement,
|