|
@@ -21,6 +21,7 @@ import { Topology } from '../topology';
|
|
|
import { Task } from '../../../mol-task';
|
|
|
import { IndexPairBonds } from '../../../mol-model-formats/structure/property/bonds/index-pair';
|
|
|
import { createModels } from '../../../mol-model-formats/structure/basic/parser';
|
|
|
+import { MmcifFormat } from '../../../mol-model-formats/structure/mmcif';
|
|
|
|
|
|
/**
|
|
|
* Interface to the "source data" of the molecule.
|
|
@@ -135,4 +136,82 @@ export namespace Model {
|
|
|
model._dynamicPropertyData[CenterProp] = center
|
|
|
return center
|
|
|
}
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
+ export function isFromPdbArchive(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ return (
|
|
|
+ db.database_2.database_id.isDefined
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ export function hasSecondaryStructure(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ return (
|
|
|
+ db.struct_conf.id.isDefined ||
|
|
|
+ db.struct_sheet_range.id.isDefined
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ export function hasCrystalSymmetry(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ return (
|
|
|
+ db.symmetry._rowCount === 1 && db.cell._rowCount === 1 && !(
|
|
|
+ db.symmetry.Int_Tables_number.value(0) === 1 &&
|
|
|
+ db.cell.angle_alpha.value(0) === 90 &&
|
|
|
+ db.cell.angle_beta.value(0) === 90 &&
|
|
|
+ db.cell.angle_gamma.value(0) === 90 &&
|
|
|
+ db.cell.length_a.value(0) === 1 &&
|
|
|
+ db.cell.length_b.value(0) === 1 &&
|
|
|
+ db.cell.length_c.value(0) === 1
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ export function isFromXray(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ for (let i = 0; i < db.exptl.method.rowCount; i++) {
|
|
|
+ const v = db.exptl.method.value(i).toUpperCase()
|
|
|
+ if (v.indexOf('DIFFRACTION') >= 0) return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ export function isFromNmr(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ for (let i = 0; i < db.exptl.method.rowCount; i++) {
|
|
|
+ const v = db.exptl.method.value(i).toUpperCase()
|
|
|
+ if (v.indexOf('NMR') >= 0) return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ export function hasXrayMap(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ return db.pdbx_database_status.status_code_sf.value(0) === 'REL'
|
|
|
+ }
|
|
|
+
|
|
|
+ export function hasEmMap(model: Model) {
|
|
|
+ if (!MmcifFormat.is(model.sourceData)) return false
|
|
|
+ const { db } = model.sourceData.data
|
|
|
+ let hasEmMap = false
|
|
|
+ for (let i = 0, il = db.pdbx_database_related._rowCount; i < il; ++i) {
|
|
|
+ if (db.pdbx_database_related.db_name.value(i).toUpperCase() === 'EMDB') {
|
|
|
+ hasEmMap = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return hasEmMap
|
|
|
+ }
|
|
|
+
|
|
|
+ export function hasDensityMap(model: Model) {
|
|
|
+ return hasXrayMap(model) || hasEmMap(model)
|
|
|
+ }
|
|
|
}
|