Ver Fonte

assemblyId url param

Alexander Rose há 6 anos atrás
pai
commit
d58f27eaba
2 ficheiros alterados com 5 adições e 4 exclusões
  1. 2 2
      src/apps/canvas/app.ts
  2. 3 2
      src/apps/canvas/index.ts

+ 2 - 2
src/apps/canvas/app.ts

@@ -31,11 +31,11 @@ export class App {
         }
     }
 
-    async loadPdbId(id: string) {
+    async loadPdbId(id: string, assemblyId?: string) {
         if (this.structureView) this.structureView.destroy()
         const cif = await getCifFromUrl(`https://files.rcsb.org/download/${id}.cif`)
         const models = await getModelsFromMmcif(cif)
-        this.structureView = await StructureView(this.viewer, models)
+        this.structureView = await StructureView(this.viewer, models, { assemblyId })
         this.pdbIdLoaded.next(this.structureView)
     }
 }

+ 3 - 2
src/apps/canvas/index.ts

@@ -19,5 +19,6 @@ if (!elm) throw new Error('Can not find element with id "app".')
 const app = new App()
 ReactDOM.render(React.createElement(AppComponent, { app }), elm);
 
-const pdbid = urlQueryParameter('pdbid')
-if (pdbid) app.loadPdbId(pdbid)
+const assemblyId = urlQueryParameter('assembly')
+const pdbId = urlQueryParameter('pdb')
+if (pdbId) app.loadPdbId(pdbId, assemblyId)