/** * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose */ import * as React from 'react' import { View } from '../view'; import { TransformListController } from '../../controller/transform/list'; import { UrlEntity } from 'mol-view/state/entity'; import { ModelToStructure, StructureToBallAndStick, StructureToSpacefill, StructureToDistanceRestraint, StructureToBackbone, MmcifUrlToModel, StructureToCartoon } from 'mol-view/state/transform'; import { StateContext } from 'mol-view/state/context'; import { SpacefillProps } from 'mol-geo/representation/structure/representation/spacefill'; import { BallAndStickProps } from 'mol-geo/representation/structure/representation/ball-and-stick'; import { DistanceRestraintProps } from 'mol-geo/representation/structure/representation/distance-restraint'; import { BackboneProps } from 'mol-geo/representation/structure/representation/backbone'; import { CartoonProps } from 'mol-geo/representation/structure/representation/cartoon'; const spacefillProps: Partial = { doubleSided: true, colorTheme: { name: 'chain-id' }, quality: 'auto', useFog: false } const ballAndStickProps: Partial = { doubleSided: true, colorTheme: { name: 'chain-id' }, sizeTheme: { name: 'uniform', value: 0.05 }, linkRadius: 0.05, quality: 'auto', useFog: false } const distanceRestraintProps: Partial = { doubleSided: true, colorTheme: { name: 'chain-id' }, linkRadius: 0.5, quality: 'auto', useFog: false } const backboneProps: Partial = { doubleSided: true, colorTheme: { name: 'chain-id' }, quality: 'auto', useFog: false } const cartoonProps: Partial = { doubleSided: true, colorTheme: { name: 'chain-id' }, quality: 'auto', useFog: false } function getPdbdevUrl(pdbdevId: string) { return `https://pdb-dev.wwpdb.org/static/cif/${pdbdevId}.cif` } const exampleUrls = { PDBDEV_00000001: getPdbdevUrl('PDBDEV_00000001'), // ok PDBDEV_00000002: getPdbdevUrl('PDBDEV_00000002'), // ok PDBDEV_00000003: getPdbdevUrl('PDBDEV_00000003'), // ok PDBDEV_00000004: getPdbdevUrl('PDBDEV_00000004'), // TODO issue with cross-link extraction PDBDEV_00000005: getPdbdevUrl('PDBDEV_00000005'), // ok PDBDEV_00000006: getPdbdevUrl('PDBDEV_00000006'), // TODO only three spacefill atoms rendered PDBDEV_00000007: getPdbdevUrl('PDBDEV_00000007'), // TODO only three spacefill atoms rendered PDBDEV_00000008: getPdbdevUrl('PDBDEV_00000008'), // ok PDBDEV_00000010: getPdbdevUrl('PDBDEV_00000010'), // ok PDBDEV_00000011: getPdbdevUrl('PDBDEV_00000011'), // ok PDBDEV_00000012: getPdbdevUrl('PDBDEV_00000012'), // ok PDBDEV_00000014: getPdbdevUrl('PDBDEV_00000014'), // ok PDBDEV_00000016: getPdbdevUrl('PDBDEV_00000016'), } export class UrlLoader extends View { async load(name: keyof typeof exampleUrls) { console.log(exampleUrls[name]) const ctx = this.props.ctx const urlEntity = UrlEntity.ofUrl(ctx, exampleUrls[name]) console.log(await urlEntity.value.getData()) const modelEntity = await MmcifUrlToModel.apply(ctx, urlEntity) const structureEntity = await ModelToStructure.apply(ctx, modelEntity) StructureToBallAndStick.apply(ctx, structureEntity, { ...ballAndStickProps, visible: true }) StructureToSpacefill.apply(ctx, structureEntity, { ...spacefillProps, visible: false }) StructureToDistanceRestraint.apply(ctx, structureEntity, { ...distanceRestraintProps, visible: false }) StructureToBackbone.apply(ctx, structureEntity, { ...backboneProps, visible: true }) StructureToCartoon.apply(ctx, structureEntity, { ...cartoonProps, visible: false }) } render() { const exampleOptions = Object.keys(exampleUrls).map(name => { return }) return
Examples
; } }