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

Added mol-model-props module

parent 6066e3ae
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ The core of Mol* currently consists of these modules: ...@@ -17,6 +17,7 @@ The core of Mol* currently consists of these modules:
- `mol-math` Math related (loosely) algorithms and data structures. - `mol-math` Math related (loosely) algorithms and data structures.
- `mol-io` Parsing library. Each format is parsed into an interface that corresponds to the data stored by it. Support for common coordinate, experimental/map, and annotation data formats. - `mol-io` Parsing library. Each format is parsed into an interface that corresponds to the data stored by it. Support for common coordinate, experimental/map, and annotation data formats.
- `mol-model` Data structures and algorithms (such as querying) for representing molecular data (including coordinate, experimental/map, and annotation data). - `mol-model` Data structures and algorithms (such as querying) for representing molecular data (including coordinate, experimental/map, and annotation data).
- `mol-model-props` Common "custom properties"
- `mol-script` A scriting language for creating representations/scenes and querying (includes the [MolQL query language](https://molql.github.io)). - `mol-script` A scriting language for creating representations/scenes and querying (includes the [MolQL query language](https://molql.github.io)).
- `mol-geo` Creating molecular geometries. - `mol-geo` Creating molecular geometries.
- `mol-gl` A wrapper around WebGL. Uses `mol-geo` to generate geometries. - `mol-gl` A wrapper around WebGL. Uses `mol-geo` to generate geometries.
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
"mol-io($|/.*)": "<rootDir>/src/mol-io$1", "mol-io($|/.*)": "<rootDir>/src/mol-io$1",
"mol-math($|/.*)": "<rootDir>/src/mol-math$1", "mol-math($|/.*)": "<rootDir>/src/mol-math$1",
"mol-model($|/.*)": "<rootDir>/src/mol-model$1", "mol-model($|/.*)": "<rootDir>/src/mol-model$1",
"mol-model-props($|/.*)": "<rootDir>/src/mol-model-props$1",
"mol-ql($|/.*)": "<rootDir>/src/mol-ql$1", "mol-ql($|/.*)": "<rootDir>/src/mol-ql$1",
"mol-script($|/.*)": "<rootDir>/src/mol-script$1", "mol-script($|/.*)": "<rootDir>/src/mol-script$1",
"mol-task($|/.*)": "<rootDir>/src/mol-task$1", "mol-task($|/.*)": "<rootDir>/src/mol-task$1",
......
...@@ -8,7 +8,6 @@ import { Segmentation } from 'mol-data/int'; ...@@ -8,7 +8,6 @@ import { Segmentation } from 'mol-data/int';
import { CifWriter } from 'mol-io/writer/cif'; import { CifWriter } from 'mol-io/writer/cif';
import { Model, ModelPropertyDescriptor, ResidueIndex, Structure, StructureElement, Unit } from 'mol-model/structure'; import { Model, ModelPropertyDescriptor, ResidueIndex, Structure, StructureElement, Unit } from 'mol-model/structure';
import { residueIdFields } from 'mol-model/structure/export/categories/atom_site'; import { residueIdFields } from 'mol-model/structure/export/categories/atom_site';
import { fetchRetry } from '../utils/fetch-retry';
import CifField = CifWriter.Field; import CifField = CifWriter.Field;
type IssueMap = Map<ResidueIndex, string[]> type IssueMap = Map<ResidueIndex, string[]>
...@@ -95,12 +94,17 @@ function createIssueMap(modelData: Model, data: any): IssueMap | undefined { ...@@ -95,12 +94,17 @@ function createIssueMap(modelData: Model, data: any): IssueMap | undefined {
export namespace StructureQualityReport { export namespace StructureQualityReport {
export const Descriptor = _Descriptor; export const Descriptor = _Descriptor;
export async function attachFromPDBeApi(model: Model) { export async function attachFromCifOrApi(model: Model, params: {
// provide JSON from api
pdbEapiSourceJson?: (model: Model) => Promise<any>
}) {
// TODO: check if present in mmCIF on Model
if (!params.pdbEapiSourceJson) throw new Error('Data source not defined');
if (model.customProperties.has(Descriptor)) return true; if (model.customProperties.has(Descriptor)) return true;
const id = model.label.toLowerCase(); const id = model.label.toLowerCase();
const rawData = await fetchRetry(`https://www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry/${model.label.toLowerCase()}`, 1500, 5); const json = await params.pdbEapiSourceJson(model);
const json = await rawData.json();
const data = json[id]; const data = json[id];
if (!data) return false; if (!data) return false;
const issueMap = createIssueMap(model, data); const issueMap = createIssueMap(model, data);
......
...@@ -6,14 +6,13 @@ ...@@ -6,14 +6,13 @@
*/ */
import { Model } from 'mol-model/structure'; import { Model } from 'mol-model/structure';
import { StructureQualityReport } from './properties/structure-quality-report'; import { PDBe_structureQualityReport } from './properties/pdbe';
// import { SymmetryAnnotation } from './properties/rcsb/symmetry';
export function attachModelProperties(model: Model): Promise<any>[] { export function attachModelProperties(model: Model): Promise<any>[] {
// return a list of promises that start attaching the props in parallel // return a list of promises that start attaching the props in parallel
// (if there are downloads etc.) // (if there are downloads etc.)
return [ return [
StructureQualityReport.attachFromPDBeApi(model), PDBe_structureQualityReport(model)
// removed for now because of schema validation error // removed for now because of schema validation error
// SymmetryAnnotation.attachFromRCSB(model) // SymmetryAnnotation.attachFromRCSB(model)
]; ];
......
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
*/
import { Model } from 'mol-model/structure';
import { StructureQualityReport } from 'mol-model-props/pdbe/structure-quality-report';
import { fetchRetry } from '../utils/fetch-retry';
export function PDBe_structureQualityReport(model: Model) {
return StructureQualityReport.attachFromCifOrApi(model, {
pdbEapiSourceJson: async model => {
const rawData = await fetchRetry(`https://www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry/${model.label.toLowerCase()}`, 1500, 5);
return await rawData.json();
}
});
}
\ No newline at end of file
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
"mol-io": ["./mol-io"], "mol-io": ["./mol-io"],
"mol-math": ["./mol-math"], "mol-math": ["./mol-math"],
"mol-model": ["./mol-model"], "mol-model": ["./mol-model"],
"mol-model-props": ["./mol-model-props"],
"mol-ql": ["./mol-ql"], "mol-ql": ["./mol-ql"],
"mol-script": ["./mol-script"], "mol-script": ["./mol-script"],
"mol-task": ["./mol-task", "./mol-task/index.ts"], "mol-task": ["./mol-task", "./mol-task/index.ts"],
......
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