Skip to content
Snippets Groups Projects
Commit f6be30ba authored by David Sehnal's avatar David Sehnal
Browse files

ModelPropertyDescriptor.cifExport is now optional

parent d293eadc
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ import Type from 'mol-script/language/type'; ...@@ -20,7 +20,7 @@ import Type from 'mol-script/language/type';
type IssueMap = ResidueCustomProperty<string[]> type IssueMap = ResidueCustomProperty<string[]>
const _Descriptor: ModelPropertyDescriptor = { const _Descriptor = ModelPropertyDescriptor({
isStatic: true, isStatic: true,
name: 'structure_quality_report', name: 'structure_quality_report',
cifExport: { cifExport: {
...@@ -41,9 +41,10 @@ const _Descriptor: ModelPropertyDescriptor = { ...@@ -41,9 +41,10 @@ const _Descriptor: ModelPropertyDescriptor = {
}, },
symbols: { symbols: {
issueCount: QuerySymbolRuntime.Dynamic(CustomPropSymbol('pdbe', 'structure-quality.issue-count', Type.Num), issueCount: QuerySymbolRuntime.Dynamic(CustomPropSymbol('pdbe', 'structure-quality.issue-count', Type.Num),
ctx => StructureQualityReport.getIssues(ctx.element).length) ctx => StructureQualityReport.getIssues(ctx.element).length),
// TODO: add (hasIssue :: IssueType(extends string) -> boolean) symbol
} }
} })
type ExportCtx = ResidueCustomProperty.ExportCtx<string[]> type ExportCtx = ResidueCustomProperty.ExportCtx<string[]>
const _structure_quality_report_issues_fields: CifField<number, ExportCtx>[] = [ const _structure_quality_report_issues_fields: CifField<number, ExportCtx>[] = [
......
...@@ -98,6 +98,8 @@ export function encode_mmCIF_categories(encoder: CifWriter.Encoder, structure: S ...@@ -98,6 +98,8 @@ export function encode_mmCIF_categories(encoder: CifWriter.Encoder, structure: S
encoder.writeCategory(cat, ctx); encoder.writeCategory(cat, ctx);
} }
for (const customProp of model.customProperties.all) { for (const customProp of model.customProperties.all) {
if (!customProp.cifExport || customProp.cifExport.categories.length === 0) continue;
const prefix = customProp.cifExport.prefix; const prefix = customProp.cifExport.prefix;
const cats = customProp.cifExport.categories; const cats = customProp.cifExport.categories;
for (const cat of cats) { for (const cat of cats) {
......
...@@ -12,7 +12,7 @@ interface ModelPropertyDescriptor<Symbols extends { [name: string]: QuerySymbolR ...@@ -12,7 +12,7 @@ interface ModelPropertyDescriptor<Symbols extends { [name: string]: QuerySymbolR
readonly isStatic: boolean, readonly isStatic: boolean,
readonly name: string, readonly name: string,
cifExport: { cifExport?: {
// Prefix enforced during export. // Prefix enforced during export.
prefix: string, prefix: string,
categories: CifWriter.Category<CifExportContext>[] categories: CifWriter.Category<CifExportContext>[]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment