diff --git a/src/mol-model/structure/export/categories/utils.ts b/src/mol-model/structure/export/categories/utils.ts index d33f72fac0c523a630fa4bda0b9266691ea116c6..d0a63367f8a4a3c7e472b6feaed0ff32316a4beb 100644 --- a/src/mol-model/structure/export/categories/utils.ts +++ b/src/mol-model/structure/export/categories/utils.ts @@ -43,13 +43,14 @@ export function getUniqueEntityIndicesFromStructures(structures: Structure[]): R return ret.array; } -export function copy_mmCif_category(name: keyof mmCIF_Schema, condition?: (model: Model) => boolean): CifWriter.Category<CifExportContext> { +export function copy_mmCif_category(name: keyof mmCIF_Schema, condition?: (structure: Structure) => boolean): CifWriter.Category<CifExportContext> { return { name, instance({ structures }) { + if (condition && !condition(structures[0])) return CifWriter.Category.Empty; + const model = structures[0].model; if (model.sourceData.kind !== 'mmCIF') return CifWriter.Category.Empty; - if (condition && !condition(model)) return CifWriter.Category.Empty; const table = model.sourceData.data[name]; if (!table || !table._rowCount) return CifWriter.Category.Empty; diff --git a/src/mol-model/structure/export/mmcif.ts b/src/mol-model/structure/export/mmcif.ts index 5ed7dd4a455898c40aa327adff0270326dda1868..e0c189ab4afa7088656e3f0312e2539f7335e4de 100644 --- a/src/mol-model/structure/export/mmcif.ts +++ b/src/mol-model/structure/export/mmcif.ts @@ -43,6 +43,10 @@ const _entity: CifCategory<CifExportContext> = { } } +function isWithoutSymmetry(structure: Structure) { + return structure.units.every(u => u.conformation.operator.isIdentity) +} + const Categories = [ // Basics copy_mmCif_category('entry'), @@ -50,13 +54,13 @@ const Categories = [ _entity, // Symmetry - copy_mmCif_category('cell'), - copy_mmCif_category('symmetry'), + copy_mmCif_category('cell', isWithoutSymmetry), + copy_mmCif_category('symmetry', isWithoutSymmetry), // Assemblies - copy_mmCif_category('pdbx_struct_assembly'), - copy_mmCif_category('pdbx_struct_assembly_gen'), - copy_mmCif_category('pdbx_struct_oper_list'), + copy_mmCif_category('pdbx_struct_assembly', isWithoutSymmetry), + copy_mmCif_category('pdbx_struct_assembly_gen', isWithoutSymmetry), + copy_mmCif_category('pdbx_struct_oper_list', isWithoutSymmetry), // Secondary structure _struct_conf,