Browse Source

initial release

bioinsilico 3 years ago
parent
commit
6f9abf0e90
6 changed files with 55 additions and 33 deletions
  1. 1 1
      CHANGELOG.md
  2. 1 1
      README.md
  3. 1 1
      docs/index.html
  4. 4 4
      package-lock.json
  5. 2 2
      package.json
  6. 46 24
      src/examples/assembly/index.ts

+ 1 - 1
CHANGELOG.md

@@ -2,6 +2,6 @@
 
 [Semantic Versioning](https://semver.org/)
 
-## [1.0.0] - 2021-10-22
+## [1.0.0] - 2021-10-27
 ### General
 - Initial release

+ 1 - 1
README.md

@@ -9,7 +9,7 @@ The package allows access to RCSB Saguaro and Molstar methods to add or change t
 <div id="pfv"></div>
 <script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
 <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
-<script crossorigin src="https://cdn.jsdelivr.net/npm/@rcsb/rcsb-saguaro-3d@1.0.1-beta/build/dist/app.js"></script>
+<script crossorigin src="https://cdn.jsdelivr.net/npm/@rcsb/rcsb-saguaro-3d@1.0.0/build/dist/app.js"></script>
 <script type="text/javascript">
 var __assign = (this && this.__assign) || function () {
     __assign = Object.assign || function(t) {

+ 1 - 1
docs/index.html

@@ -75,7 +75,7 @@
 <div id="pfv"></div>
 <script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
 <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
-<script crossorigin src="https://cdn.jsdelivr.net/npm/@rcsb/rcsb-saguaro-3d@1.0.1-beta/build/dist/app.js"></script>
+<script crossorigin src="https://cdn.jsdelivr.net/npm/@rcsb/rcsb-saguaro-3d@1.0.0/build/dist/app.js"></script>
 <script type="text/javascript">
 var __assign = (this && this.__assign) || function () {
     __assign = Object.assign || function(t) {

+ 4 - 4
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "1.0.0",
+  "version": "1.0.2-beta",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -2205,9 +2205,9 @@
       }
     },
     "@rcsb/rcsb-saguaro-app": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/@rcsb/rcsb-saguaro-app/-/rcsb-saguaro-app-3.0.0.tgz",
-      "integrity": "sha512-VIiYHMkkeFdhxcZvhuQC1aTZ+oHodxjY3iA2GACuX7cABkIeCL8VnScWGdq++PYnC95vqaUCDf8vGT4Lb1akfA==",
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/@rcsb/rcsb-saguaro-app/-/rcsb-saguaro-app-3.1.0.tgz",
+      "integrity": "sha512-0wyiUOtUoFByQOj/4lzUuRzl2fFhbwmMF5M3QU6n7VOIsROcR112NeSzMQcjqq6Cd0YaGvZ5Heu6FU9Ymu1urA==",
       "requires": {
         "@rcsb/rcsb-api-tools": "^2.2.1",
         "@rcsb/rcsb-saguaro": "^2.0.0",

+ 2 - 2
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "1.0.2-beta",
+  "version": "1.0.0",
   "description": "RCSB Molstar/Saguaro Web App",
   "main": "build/dist/RcsbFv3DBuilder.js",
   "files": [
@@ -83,7 +83,7 @@
     "@rcsb/rcsb-molstar": "^2.0.0-dev.8",
     "@rcsb/rcsb-saguaro": "^2.0.0",
     "@rcsb/rcsb-saguaro-api": "^2.1.0",
-    "@rcsb/rcsb-saguaro-app": "^3.0.0",
+    "@rcsb/rcsb-saguaro-app": "^3.1.0",
     "molstar": "^2.0.7",
     "react-select": "^3.0.8"
   },

+ 46 - 24
src/examples/assembly/index.ts

@@ -1,9 +1,14 @@
 
 import './index.html';
-import {RcsbFv3DAssembly, RcsbFv3DAssemblyInterface} from "../../RcsbFv3D/RcsbFv3DAssembly";
-import {AlignmentResponse, AnnotationFeatures} from "@rcsb/rcsb-saguaro-api/build/RcsbGraphQL/Types/Borrego/GqlTypes";
+import {RcsbFv3DAssembly} from "../../RcsbFv3D/RcsbFv3DAssembly";
+import {
+    AlignmentResponse,
+    AnnotationFeatures,
+    Type
+} from "@rcsb/rcsb-saguaro-api/build/RcsbGraphQL/Types/Borrego/GqlTypes";
 import {SequenceCollectorDataInterface} from "@rcsb/rcsb-saguaro-app/build/dist/RcsbCollectTools/SequenceCollector/SequenceCollector";
 import {RcsbFvDisplayTypes, RcsbFvRowConfigInterface} from "@rcsb/rcsb-saguaro";
+import {PolymerEntityInstanceInterface} from "@rcsb/rcsb-saguaro-app/build/dist/RcsbCollectTools/Translators/PolymerEntityInstancesCollector";
 
 document.addEventListener("DOMContentLoaded", function(event) {
 
@@ -35,29 +40,46 @@ document.addEventListener("DOMContentLoaded", function(event) {
                     console.log(`Element clicked ${e?.type}`)
                 }
             },
-            externalTrackBuilder:{
-                processAlignmentAndFeatures(data: { annotations?: Array<AnnotationFeatures>; alignments?: AlignmentResponse }) {
-                },
-                filterFeatures(annotations: Array<AnnotationFeatures>) {
-                },
-                addTo(tracks: { alignmentTracks?: SequenceCollectorDataInterface; annotationTracks?: Array<RcsbFvRowConfigInterface> }) {
-                    const myTrack: RcsbFvRowConfigInterface = {
-                        trackId: "blockTrack",
-                        trackHeight: 20,
-                        trackColor: "#F9F9F9",
-                        displayType: RcsbFvDisplayTypes.BLOCK,
-                        displayColor: "#FF0000",
-                        rowTitle: "MY TRACK",
-                        trackData: [{
-                            begin: 30,
-                            end: 60
-                        }]
-                    }
-                    tracks.annotationTracks?.push(myTrack);
-                }
-            }
+            externalTrackBuilder:externalTrackBuilder()
         }
     });
     panel3d.render();
 
-});
+});
+
+function externalTrackBuilder(){
+    let myComputedTrack: RcsbFvRowConfigInterface = {
+        trackId: "blockTrack",
+        trackHeight: 20,
+        trackColor: "#F9F9F9",
+        titleFlagColor: "#48a1b3",
+        displayType: RcsbFvDisplayTypes.BLOCK,
+        displayColor: "#56e0f5",
+        rowTitle: "COMPUTED",
+        trackData: []
+    };
+    return {
+        processAlignmentAndFeatures(data: { annotations?: Array<AnnotationFeatures>; alignments?: AlignmentResponse }): void {
+            myComputedTrack.trackData = [];
+            data.annotations?.forEach(a=>{
+                a.features?.forEach(f=>{
+                    if(f!=null && f.type === Type.Site){
+                        if(f.feature_positions)
+                           myComputedTrack.trackData?.push( ...f.feature_positions?.map(p=>({
+                               begin:p?.beg_seq_id ?? 0,
+                               end:p?.end_seq_id ?? undefined
+                           })))
+                    }
+                })
+            })
+        },
+        addTo(tracks: { alignmentTracks?: SequenceCollectorDataInterface; annotationTracks?: Array<RcsbFvRowConfigInterface>; rcsbContext?: Partial<PolymerEntityInstanceInterface>; }): void {
+            if(tracks.rcsbContext?.asymId === "A" && myComputedTrack?.trackData && myComputedTrack.trackData.length > 0) {
+                tracks.annotationTracks?.push(myComputedTrack);
+            }
+        },
+        filterFeatures(annotations: Array<AnnotationFeatures>): Array<AnnotationFeatures> {
+            return annotations;
+        }
+    }
+}