icn3d 3.44.0 → 3.44.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +4 -4
  2. package/css/lib/fonts/la-brands-400.eot +0 -0
  3. package/css/lib/fonts/la-brands-400.svg +0 -0
  4. package/css/lib/fonts/la-brands-400.ttf +0 -0
  5. package/css/lib/fonts/la-brands-400.woff +0 -0
  6. package/css/lib/fonts/la-brands-400.woff2 +0 -0
  7. package/css/lib/fonts/la-regular-400.eot +0 -0
  8. package/css/lib/fonts/la-regular-400.svg +0 -0
  9. package/css/lib/fonts/la-regular-400.ttf +0 -0
  10. package/css/lib/fonts/la-regular-400.woff +0 -0
  11. package/css/lib/fonts/la-regular-400.woff2 +0 -0
  12. package/css/lib/fonts/la-solid-900.eot +0 -0
  13. package/css/lib/fonts/la-solid-900.svg +0 -0
  14. package/css/lib/fonts/la-solid-900.ttf +0 -0
  15. package/css/lib/fonts/la-solid-900.woff +0 -0
  16. package/css/lib/fonts/la-solid-900.woff2 +0 -0
  17. package/css/lib/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  18. package/css/lib/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  19. package/css/lib/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  20. package/css/lib/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  21. package/css/lib/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  22. package/css/lib/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  23. package/css/lib/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  24. package/css/lib/images/ui-icons_222222_256x240.png +0 -0
  25. package/css/lib/images/ui-icons_228ef1_256x240.png +0 -0
  26. package/css/lib/images/ui-icons_ef8c08_256x240.png +0 -0
  27. package/css/lib/images/ui-icons_ffd27a_256x240.png +0 -0
  28. package/css/lib/images/ui-icons_ffffff_256x240.png +0 -0
  29. package/icn3d.js +309 -49
  30. package/icn3d.min.js +4 -4
  31. package/icn3d.module.js +309 -49
  32. package/package.json +1 -1
package/README.md CHANGED
@@ -102,11 +102,11 @@ Usage
102
102
  If your typescript compiler complains about missing type definition files, create a file named icn3d.d.ts in your project's root directory and fill it with the following:
103
103
 
104
104
  declare module 'icn3d/module' {
105
- export class iCn3DUI {
106
- constructor(cfg: object);
105
+ export class iCn3DUI {
106
+ constructor(cfg: object);
107
107
 
108
- show3DStructure(): Promise<void>;
109
- }
108
+ show3DStructure(): Promise<void>;
109
+ }
110
110
  }
111
111
 
112
112
  declare module 'icn3d/three' {}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/icn3d.js CHANGED
@@ -56237,6 +56237,13 @@ class ClickMenu {
56237
56237
  }
56238
56238
  }
56239
56239
  }
56240
+
56241
+ //https://stackoverflow.com/questions/105034/how-do-i-create-a-guid-uuid
56242
+ uuidv4() {
56243
+ return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
56244
+ (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)
56245
+ );
56246
+ }
56240
56247
 
56241
56248
  displayShownMenus() { let me = this.icn3dui; me.icn3d;
56242
56249
  let html = "<form name='" + me.pre + "selmenu'>";
@@ -56479,6 +56486,10 @@ class ClickMenu {
56479
56486
  me.htmlCls.dialogCls.openDlg('dl_state', 'Please input the state file');
56480
56487
  });
56481
56488
 
56489
+ me.myEventCls.onIds("#" + me.pre + "mn1_bcfviewpoint", "click", function(e) { me.icn3d; //e.preventDefault();
56490
+ me.htmlCls.dialogCls.openDlg('dl_bcfviewpoint', 'Please input the BCF viewpoint file');
56491
+ });
56492
+
56482
56493
  me.myEventCls.onIds("#" + me.pre + "mn1_selection", "click", function(e) { me.icn3d; //e.preventDefault();
56483
56494
  me.htmlCls.dialogCls.openDlg('dl_selection', 'Please input the selection file');
56484
56495
  });
@@ -56525,6 +56536,132 @@ class ClickMenu {
56525
56536
  ic.saveFileCls.saveFile(file_pref + '_statefile.txt', 'command');
56526
56537
  });
56527
56538
 
56539
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportCamera", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
56540
+ thisClass.setLogCmd("export bcf viewpoint", false);
56541
+ let file_pref = Object.keys(ic.structures).join(',');
56542
+ //ic.saveFileCls.saveFile(file_pref + '_camera.bcf', 'bcf');
56543
+
56544
+ let url = './script/jszip.min.js';
56545
+ await me.getAjaxPromise(url, 'script');
56546
+
56547
+ let data, jszip = new JSZip();
56548
+
56549
+ let uuid1 = thisClass.uuidv4();
56550
+ let uuid2 = thisClass.uuidv4();
56551
+
56552
+ data = '';
56553
+ data += '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
56554
+ data += ' <Version VersionId="3.0"/>\n';
56555
+
56556
+ jszip.file("bcf.version", data);
56557
+
56558
+ data = '';
56559
+ data += '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
56560
+ data += ' <Extensions>\n';
56561
+ data += ' <TopicTypes>\n';
56562
+ data += ' <TopicType>ERROR</TopicType>\n';
56563
+ data += ' <TopicType>WARNING</TopicType>\n';
56564
+ data += ' <TopicType>INFORMATION</TopicType>\n';
56565
+ data += ' <TopicType>CLASH</TopicType>\n';
56566
+ data += ' <TopicType>OTHER</TopicType>\n';
56567
+ data += ' </TopicTypes>\n';
56568
+ data += ' <TopicStatuses>\n';
56569
+ data += ' <TopicStatus>OPEN</TopicStatus>\n';
56570
+ data += ' <TopicStatus>IN_PROGRESS</TopicStatus>\n';
56571
+ data += ' <TopicStatus>SOLVED</TopicStatus>\n';
56572
+ data += ' <TopicStatus>CLOSED</TopicStatus>\n';
56573
+ data += ' </TopicStatuses>\n';
56574
+ data += ' <Priorities>\n';
56575
+ data += ' <Priority>LOW</Priority>\n';
56576
+ data += ' <Priority>MEDIUM</Priority>\n';
56577
+ data += ' <Priority>HIGH</Priority>\n';
56578
+ data += ' <Priority>CRITICAL</Priority>\n';
56579
+ data += ' </Priorities>\n';
56580
+ data += ' <TopicLabels/>\n';
56581
+ data += ' <Users/>\n';
56582
+ data += ' <SnippetTypes/>\n';
56583
+ data += ' <Stages/>\n';
56584
+ data += ' </Extensions>\n';
56585
+
56586
+ jszip.file("extensions.xml", data);
56587
+
56588
+ let folder = jszip.folder(uuid1);
56589
+
56590
+ data = '';
56591
+ data += '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
56592
+ data += ' <Markup>\n';
56593
+ data += ' <Header>\n';
56594
+ data += ' <Files/>\n';
56595
+ data += ' </Header> \n';
56596
+ data += ' <Topic Guid="' + uuid1 + '">\n';
56597
+ data += ' <Title>Perspective camera</Title>\n';
56598
+
56599
+ let now = new Date();
56600
+ const isoString = now.toISOString();
56601
+
56602
+ data += ' <CreationDate>' + isoString + '</CreationDate>\n';
56603
+ data += ' <CreationAuthor>https://www.ncbi.nlm.nih.gov/Structure/icn3d</CreationAuthor>\n';
56604
+ data += ' <DocumentReferences/>\n';
56605
+ data += ' <RelatedTopics/>\n';
56606
+ data += ' <Comments/>\n';
56607
+ data += ' <Viewpoints>\n';
56608
+ data += ' <ViewPoint Guid="' + uuid2 + '">\n';
56609
+ data += ' <Viewpoint>viewpoint-' + uuid2 + '.bcfv</Viewpoint>\n';
56610
+ data += ' <Snapshot>snapshot-' + uuid2 + '.png</Snapshot>\n';
56611
+ data += ' </ViewPoint>\n';
56612
+ data += ' </Viewpoints>\n';
56613
+ data += ' </Topic>\n';
56614
+ data += ' </Markup>\n';
56615
+
56616
+ folder.file("markup.bcf", data);
56617
+ let blob = await ic.saveFileCls.saveFile('any', 'png', undefined, undefined, true);
56618
+
56619
+ folder.file("snapshot-" + uuid2 + ".png", blob);
56620
+
56621
+ data = '';
56622
+
56623
+ data += '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
56624
+ data += ' <VisualizationInfo Guid="' + uuid2 + '">\n';
56625
+ data += ' <Components>\n';
56626
+ data += ' <Selection/>\n';
56627
+ data += ' <Visibility DefaultVisibility="true" />\n';
56628
+ data += ' <Coloring/>\n';
56629
+ data += ' </Components>\n';
56630
+ data += ' <PerspectiveCamera>\n';
56631
+ data += ' <CameraViewPoint>\n';
56632
+ data += ' <X>' + ic.cam.position.x + '</X>\n';
56633
+ data += ' <Y>' + ic.cam.position.y + '</Y>\n';
56634
+ data += ' <Z>' + ic.cam.position.z + '</Z>\n';
56635
+ data += ' </CameraViewPoint>\n';
56636
+
56637
+ let direction = (new Vector3$1(0, 0, -1)).applyQuaternion(ic.cam.quaternion);
56638
+
56639
+ data += ' <CameraDirection>\n';
56640
+ data += ' <X>' + direction.x + '</X>\n';
56641
+ data += ' <Y>' + direction.y + '</Y>\n';
56642
+ data += ' <Z>' + direction.z + '</Z>\n';
56643
+ data += ' </CameraDirection>\n';
56644
+ data += ' <CameraUpVector>\n';
56645
+ data += ' <X>' + ic.cam.up.x + '</X>\n';
56646
+ data += ' <Y>' + ic.cam.up.y + '</Y>\n';
56647
+ data += ' <Z>' + ic.cam.up.z + '</Z>\n';
56648
+ data += ' </CameraUpVector>\n';
56649
+ data += ' <FieldOfView>' + ic.cam.fov + '</FieldOfView>\n'; // 20
56650
+ data += ' <AspectRatio>' + ic.container.whratio + '</AspectRatio>\n';
56651
+ data += ' </PerspectiveCamera>\n';
56652
+ data += ' <Lines/>\n';
56653
+ data += ' <ClippingPlanes/>\n';
56654
+ data += ' <Bitmaps/> \n';
56655
+ data += ' </VisualizationInfo>\n';
56656
+
56657
+ folder.file("viewpoint-" + uuid2 + ".bcfv", data);
56658
+
56659
+ jszip.generateAsync({type:"blob"})
56660
+ .then(function(content) {
56661
+ saveAs(content, file_pref + "_viewpoint.bcf");
56662
+ });
56663
+ });
56664
+
56528
56665
  me.myEventCls.onIds("#" + me.pre + "mn1_exportVideo", "click", function(e) { me.icn3d; //e.preventDefault();
56529
56666
  thisClass.setLogCmd("export video", false);
56530
56667
  me.htmlCls.dialogCls.openDlg('dl_video', 'Save canvas changes in a video');
@@ -58265,13 +58402,13 @@ class ClickMenu {
58265
58402
  thisClass.setLogCmd(value, true);
58266
58403
  let axis;
58267
58404
  if(direction == 'x') {
58268
- axis = new THREE.Vector3(1,0,0);
58405
+ axis = new Vector3$1(1,0,0);
58269
58406
  }
58270
58407
  else if(direction == 'y') {
58271
- axis = new THREE.Vector3(0,1,0);
58408
+ axis = new Vector3$1(0,1,0);
58272
58409
  }
58273
58410
  else if(direction == 'z') {
58274
- axis = new THREE.Vector3(0,0,1);
58411
+ axis = new Vector3$1(0,0,1);
58275
58412
  }
58276
58413
  let angle = 0.5 * Math.PI;
58277
58414
  ic.transformCls.setRotation(axis, angle);
@@ -58582,8 +58719,8 @@ class ClickMenu {
58582
58719
  if(!ic.quaternion) {
58583
58720
  // reset parameters
58584
58721
  ic._zoomFactor = 1.0;
58585
- ic.mouseChange = new THREE.Vector2(0,0);
58586
- ic.quaternion = new THREE.Quaternion(0,0,0,1);
58722
+ ic.mouseChange = new Vector2$1(0,0);
58723
+ ic.quaternion = new Quaternion(0,0,0,1);
58587
58724
  }
58588
58725
 
58589
58726
  transformation.factor = ic._zoomFactor;
@@ -59266,6 +59403,7 @@ class SetMenu {
59266
59403
  html += this.getLink('mn1_fixedversion', 'Share Link in Archived Ver. ' + me.htmlCls.wifiStr, undefined, 2);
59267
59404
  html += this.getLink('mn1_selection', 'Selection File', undefined, 2);
59268
59405
  html += this.getLink("mn1_collection", "Collection File", undefined, 2);
59406
+ html += this.getLink('mn1_bcfviewpoint', 'BCF Viewpoint File', undefined, 2);
59269
59407
 
59270
59408
  html += this.getMenuSep();
59271
59409
 
@@ -59388,6 +59526,7 @@ class SetMenu {
59388
59526
  html += this.getLink('mn1_exportKabat', 'Kabat', undefined, 3);
59389
59527
  html += this.getLink('mn1_exportImgt', 'IMGT', undefined, 3);
59390
59528
  html += "</ul>";
59529
+ html += this.getLink('mn1_exportCamera', 'BCF Viewpoint', undefined, 2);
59391
59530
 
59392
59531
  html += "<li><br/></li>";
59393
59532
 
@@ -60602,6 +60741,7 @@ class SetMenu {
60602
60741
 
60603
60742
  html += this.getMenuText('mn6_develop', 'Develop', undefined, undefined, 1);
60604
60743
  html += "<ul>";
60744
+ html += this.getMenuUrl('dev_contribute', me.htmlCls.baseUrl + "icn3d/icn3d.html#HowToContribute", "Become a Contributor", undefined, 2);
60605
60745
  html += this.getMenuUrl('dev_embedicn3d2', me.htmlCls.baseUrl + "icn3d/icn3d.html#HowToUse", "Embed iCn3D", undefined, 2);
60606
60746
  html += this.getMenuUrl('dev_urlpara', me.htmlCls.baseUrl + "icn3d/icn3d.html#parameters", "URL Parameters", undefined, 2);
60607
60747
  html += this.getMenuUrl('dev_command', me.htmlCls.baseUrl + "icn3d/icn3d.html#commands", "Commands", undefined, 2);
@@ -61752,6 +61892,12 @@ class SetDialog {
61752
61892
  html += me.htmlCls.buttonStr + "reload_state' style='margin-top: 6px;'>Load</button>";
61753
61893
  html += "</div>";
61754
61894
 
61895
+ html += me.htmlCls.divStr + "dl_bcfviewpoint' class='" + dialogClass + "'>";
61896
+ html += this.addNotebookTitle('dl_bcfviewpoint', 'Please input a BCF viewpoint file');
61897
+ html += "BCF viewpoint file: " + me.htmlCls.inputFileStr + "id='" + me.pre + "bcfviewpoint'><br/>";
61898
+ html += me.htmlCls.buttonStr + "reload_bcfviewpoint' style='margin-top: 6px;'>Load</button>";
61899
+ html += "</div>";
61900
+
61755
61901
  html += me.htmlCls.divStr + "dl_video' class='" + dialogClass + "'>";
61756
61902
  html += this.addNotebookTitle('dl_video', 'Save canvas changes in a video');
61757
61903
  html += "State file: " + me.htmlCls.inputFileStr + "id='" + me.pre + "state'><br/>";
@@ -62831,9 +62977,9 @@ class SetDialog {
62831
62977
 
62832
62978
  group2tpl['IgFN3'] = ['Contactin1_2ee2A_human_FN3-n9', 'IL6Rb_1bquB_human_FN3-n2', 'IL6Rb_1bquB_human_FN3-n3', 'InsulinR_8guyE_human_FN3-n1', 'InsulinR_8guyE_human_FN3-n2', 'Sidekick2_1wf5A_human_FN3-n7'];
62833
62979
 
62834
- group2tpl['IgFN3-like'] = ['ASF1A_2iijA_human', 'BArrestin1_4jqiA_rat_n1', 'C3_2qkiD_human_n1', 'MPT63_1lmiA_bacteria', 'NaCaExchanger_2fwuA_dog_n2', 'RBPJ_6py8C_human_Unk-n1', 'RBPJ_6py8C_human_Unk-n2', 'TEAD1_3kysC_human'];
62980
+ group2tpl['IgFN3-like'] = ['ASF1A_2iijA_human', 'BArrestin1_4jqiA_rat_n1', 'C3_2qkiD_human_n1', 'MPT63_1lmiA_bacteria', 'NaCaExchanger_2fwuA_dog_n2', 'RBPJ_6py8C_human_Unk-n1', 'TEAD1_3kysC_human'];
62835
62981
 
62836
- group2tpl['Other Ig'] = ['CD19_6al5A_human-n1', 'CuZnSuperoxideDismutase_1hl5C_human', 'ECadherin_4zt1A_human_n2', 'LaminAC_1ifrA_human', 'ORF7a_1xakA_virus'];
62982
+ group2tpl['Other Ig'] = ['CD19_6al5A_human-n1', 'CuZnSuperoxideDismutase_1hl5C_human', 'ECadherin_4zt1A_human_n2', 'LaminAC_1ifrA_human', 'ORF7a_1xakA_virus', 'RBPJ_6py8C_human_Unk-n2'];
62837
62983
 
62838
62984
  let tpl2strandsig = {};
62839
62985
  tpl2strandsig['ASF1A_2iijA_human'] = "A A' B C C' E F G G+";
@@ -63246,6 +63392,67 @@ class Events {
63246
63392
  }
63247
63393
  }
63248
63394
 
63395
+ async openBcf(file) { let me = this.icn3dui, ic = me.icn3d;
63396
+ let url = './script/jszip.min.js';
63397
+ await me.getAjaxPromise(url, 'script');
63398
+
63399
+ let jszip = new JSZip();
63400
+
63401
+ me.htmlCls.setHtmlCls.fileSupport();
63402
+
63403
+ jszip.loadAsync(file).then(function(zip) {
63404
+ zip.forEach(function (relativePath, zipEntry) {
63405
+ if (zipEntry.dir) {
63406
+ // Handle directory creation
63407
+ let folder = jszip.folder(relativePath);
63408
+ folder.forEach(function (filename, zipEntry2) {
63409
+ if(filename.substr(0, 9) == 'viewpoint') {
63410
+ zipEntry2.async('string') // or 'blob', 'arraybuffer'
63411
+ .then(function(fileData) {
63412
+ let parser = new DOMParser();
63413
+ let xmlDoc = parser.parseFromString(fileData, "text/xml");
63414
+
63415
+ // Accessing elements
63416
+ //const author = xmlDoc.getElementsByTagName("author")[0].textContent;
63417
+ //const author = xmlDoc.querySelector("author").textContent;
63418
+ let viewpoint = xmlDoc.querySelector("CameraViewPoint");
63419
+ let direction = xmlDoc.querySelector("CameraDirection");
63420
+ let upvector = xmlDoc.querySelector("CameraUpVector");
63421
+ let fov = xmlDoc.querySelector("FieldOfView").textContent;
63422
+ xmlDoc.querySelector("AspectRatio").textContent;
63423
+
63424
+ let childNodes, viewpointArray = [], directionArray = [], upvectorArray = [];
63425
+
63426
+ childNodes = viewpoint.children;
63427
+ viewpointArray = [childNodes[0].textContent, childNodes[1].textContent, childNodes[2].textContent];
63428
+ childNodes = direction.children;
63429
+ directionArray = [childNodes[0].textContent, childNodes[1].textContent, childNodes[2].textContent];
63430
+ childNodes = upvector.children;
63431
+ upvectorArray = [childNodes[0].textContent, childNodes[1].textContent, childNodes[2].textContent];
63432
+
63433
+ ic.cam.position.set(viewpointArray[0], viewpointArray[1], viewpointArray[2]);
63434
+ ic.cam.quaternion.setFromUnitVectors(new Vector3$1(0, 0, -1), new Vector3$1(directionArray[0], directionArray[1], directionArray[2]));
63435
+ ic.cam.up.set(upvectorArray[0], upvectorArray[1], upvectorArray[2]);
63436
+ ic.cam.fov = fov;
63437
+ //ic.container.whratio = aspect;
63438
+
63439
+ ic.drawCls.applyTransformation(ic._zoomFactor, ic.mouseChange, ic.quaternion);
63440
+ ic.drawCls.render();
63441
+ });
63442
+ }
63443
+ });
63444
+ }
63445
+ // else {
63446
+ // // Handle file extraction
63447
+ // zipEntry.async("string").then(function (content) {
63448
+ // });
63449
+ // }
63450
+ });
63451
+ }, function (e) {
63452
+ console.error("Error loading BCF viewpoint file:", e);
63453
+ });
63454
+ }
63455
+
63249
63456
  //Hold all functions related to click events.
63250
63457
  allEventFunctions() { let me = this.icn3dui, ic = me.icn3d;
63251
63458
  let thisClass = this;
@@ -63672,7 +63879,7 @@ class Events {
63672
63879
  let v2Y = $("#" + me.pre + "v2Y").val();
63673
63880
  let v2Z = $("#" + me.pre + "v2Z").val();
63674
63881
 
63675
- let angleRad = new THREE.Vector3(parseFloat(v1X), parseFloat(v1Y), parseFloat(v1Z)).angleTo(new THREE.Vector3(parseFloat(v2X), parseFloat(v2Y), parseFloat(v2Z)));
63882
+ let angleRad = new Vector3$1(parseFloat(v1X), parseFloat(v1Y), parseFloat(v1Z)).angleTo(new Vector3$1(parseFloat(v2X), parseFloat(v2Y), parseFloat(v2Z)));
63676
63883
  let angle = angleRad / 3.1416 * 180;
63677
63884
  angle = Math.abs(angle).toFixed(0);
63678
63885
  if(angle > 180) angle -= 180;
@@ -64338,6 +64545,19 @@ class Events {
64338
64545
  }
64339
64546
  });
64340
64547
 
64548
+ me.myEventCls.onIds("#" + me.pre + "reload_bcfviewpoint", "click", async function(e) { me.icn3d;
64549
+ e.preventDefault();
64550
+ if(!me.cfg.notebook) dialog.dialog( "close" );
64551
+
64552
+ let file = $("#" + me.pre + "bcfviewpoint")[0].files[0];
64553
+ if(!file) {
64554
+ var aaa = 1; //alert("Please select a file before clicking 'Load'");
64555
+ }
64556
+ else {
64557
+ await thisClass.openBcf(file);
64558
+ }
64559
+ });
64560
+
64341
64561
  me.myEventCls.onIds("#" + me.pre + "reload_selectionfile", "click", function(e) { let ic = me.icn3d;
64342
64562
  e.preventDefault();
64343
64563
  if(!me.cfg.notebook) dialog.dialog( "close" );
@@ -65773,8 +65993,8 @@ class Events {
65773
65993
  let posArray1 = ic.contactCls.getExtent(atomSet1);
65774
65994
  let posArray2 = ic.contactCls.getExtent(atomSet2);
65775
65995
 
65776
- let pos1 = new THREE.Vector3(posArray1[2][0], posArray1[2][1], posArray1[2][2]);
65777
- let pos2 = new THREE.Vector3(posArray2[2][0], posArray2[2][1], posArray2[2][2]);
65996
+ let pos1 = new Vector3$1(posArray1[2][0], posArray1[2][1], posArray1[2][2]);
65997
+ let pos2 = new Vector3$1(posArray2[2][0], posArray2[2][1], posArray2[2][2]);
65778
65998
 
65779
65999
  let radius = $("#" + me.pre + "linebtwsets_radius").val();
65780
66000
  let color = $("#" + me.pre + "linebtwsets_customcolor").val();
@@ -65798,7 +66018,7 @@ class Events {
65798
66018
  let nameArray = $("#" + me.pre + "cartoonshape").val();
65799
66019
  let atomSet1 = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
65800
66020
  let posArray1 = ic.contactCls.getExtent(atomSet1);
65801
- let pos1 = new THREE.Vector3(posArray1[2][0], posArray1[2][1], posArray1[2][2]);
66021
+ let pos1 = new Vector3$1(posArray1[2][0], posArray1[2][1], posArray1[2][2]);
65802
66022
 
65803
66023
  let shape = $("#" + me.pre + "cartoonshape_shape").val(); // Sphere or Cube
65804
66024
  let radius = $("#" + me.pre + "cartoonshape_radius").val();
@@ -66259,6 +66479,32 @@ class Events {
66259
66479
  thisClass.setLogCmd("set theme black", true);
66260
66480
  });
66261
66481
 
66482
+ // dragover and drop
66483
+ me.myEventCls.onIds("#" + me.pre + "viewer", "dragover", function(e) { me.icn3d;
66484
+ e.preventDefault();
66485
+ $("#" + me.pre + "viewer")[0].style.border = "5px solid blue";
66486
+ });
66487
+ me.myEventCls.onIds("#" + me.pre + "viewer", "drop", async function(e) { me.icn3d;
66488
+ e.preventDefault();
66489
+
66490
+ let files = e.dataTransfer.files;
66491
+
66492
+ for(let i = 0, il = e.dataTransfer.files.length; i < il; ++i) {
66493
+ let file = e.dataTransfer.files[i];
66494
+ let fileName = file.name;
66495
+
66496
+ let fileType = fileName.substr(fileName.lastIndexOf('.') + 1).toLowerCase();
66497
+ if(fileType == 'pdb' || fileType == 'mmcif' || fileType == 'png') {
66498
+ await me.htmlCls.eventsCls.readFile(true, files, i, '', (fileType == 'mmcif'), (fileType == 'png'));
66499
+ }
66500
+ else if(fileType == 'bcf') {
66501
+ await thisClass.openBcf(file);
66502
+ }
66503
+ }
66504
+
66505
+ $("#" + me.pre + "viewer")[0].style.border = "0px solid black";
66506
+ });
66507
+
66262
66508
  $(document).on("click", "." + me.pre + "snpin3d", async function(e) { let ic = me.icn3d;
66263
66509
  e.stopImmediatePropagation();
66264
66510
 
@@ -94044,9 +94290,12 @@ class Domain3d {
94044
94290
 
94045
94291
  // let subdomains = result.subdomains;
94046
94292
  // let substruct = result.substruct;
94293
+ let jsonStr = '{"data": [';
94047
94294
 
94048
94295
  let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(atoms);
94049
94296
  let residueArray = Object.keys(residueHash);
94297
+ if(residueArray.length == 0) return jsonStr + ']}';
94298
+
94050
94299
  let chnid = residueArray[0].substr(0, residueArray[0].lastIndexOf('_'));
94051
94300
 
94052
94301
  // let resid1 = residueArray[0];
@@ -94097,7 +94346,7 @@ class Domain3d {
94097
94346
  substruct = this.standardizeSubstruct(chnid, substruct, pos2resi);
94098
94347
 
94099
94348
  // m_domains1: {"data": [ {"ss": [[1,20,30,x,y,z,x,y,z], [2,50,60,x,y,z,x,y,z]], "domain": [[1,43,x,y,z],[2,58,x,y,z], ...]}, {"ss": [[1,20,30,x,y,z,x,y,z], [2,50,60,x,y,z,x,y,z]],"domain": [[1,43,x,y,z],[2,58,x,y,z], ...]} ] }
94100
- let jsonStr = '{"data": [';
94349
+
94101
94350
  //merge all subdomains into one domain
94102
94351
  jsonStr += '{"ss": ['; //secondary structure
94103
94352
 
@@ -117489,12 +117738,12 @@ class DefinedSets {
117489
117738
  }
117490
117739
 
117491
117740
  setPredefinedInMenu() { let ic = this.icn3d, me = ic.icn3dui;
117492
- // predefined sets: all chains
117493
- this.setChainsInMenu();
117494
-
117495
117741
  // predefined sets: proteins,nucleotides, chemicals
117496
117742
  this.setProtNuclLigInMenu();
117497
117743
 
117744
+ // predefined sets: all chains
117745
+ this.setChainsInMenu();
117746
+
117498
117747
  // show 3d domains for mmdbid
117499
117748
  if(me.cfg.mmdbid !== undefined || me.cfg.gi !== undefined || me.cfg.chainalign !== undefined || me.cfg.mmdbafid !== undefined) {
117500
117749
  for(let tddomainName in ic.tddomains) {
@@ -117592,10 +117841,15 @@ class DefinedSets {
117592
117841
  return html;
117593
117842
  }
117594
117843
 
117595
- setChainsInMenu() { let ic = this.icn3d; ic.icn3dui;
117844
+ setChainsInMenu() { let ic = this.icn3d, me = ic.icn3dui;
117845
+ let nonProtNuclResHash = {};
117846
+
117596
117847
  for(let chainid in ic.chains) {
117597
- // skip chains with one residue/chemical
117598
- if(ic.chainsSeq[chainid] && ic.chainsSeq[chainid].length > 1) {
117848
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]);
117849
+
117850
+ // protein or nucleotide
117851
+ // if(ic.chainsSeq[chainid] && ic.chainsSeq[chainid].length > 1) {
117852
+ if(ic.proteins.hasOwnProperty(atom.serial) || ic.nucleotides.hasOwnProperty(atom.serial)) {
117599
117853
  //ic.defNames2Atoms[chainid] = Object.keys(ic.chains[chainid]);
117600
117854
  ic.defNames2Residues[chainid] = Object.keys(ic.firstAtomObjCls.getResiduesFromAtoms(ic.chains[chainid]));
117601
117855
  ic.defNames2Descr[chainid] = chainid;
@@ -117606,6 +117860,25 @@ class DefinedSets {
117606
117860
 
117607
117861
  ic.defNames2Command[chainid] = 'select $' + structure + '.' + chain;
117608
117862
  }
117863
+ else { // chemicals, etc
117864
+ let resid = atom.structure + '_' + atom.chain + '_' + atom.resi;
117865
+ let resn = atom.resn.substr(0, 3);
117866
+
117867
+ if(!nonProtNuclResHash[resn]) {
117868
+ nonProtNuclResHash[resn] = ic.residues[resid];
117869
+ }
117870
+ else {
117871
+ nonProtNuclResHash[resn] = me.hashUtilsCls.unionHash(nonProtNuclResHash[atom.resn], ic.residues[resid]);
117872
+ }
117873
+ }
117874
+ }
117875
+
117876
+ // chemicals etc
117877
+ for(let resn in nonProtNuclResHash) {
117878
+ ic.defNames2Residues[resn] = Object.keys(ic.firstAtomObjCls.getResiduesFromAtoms(nonProtNuclResHash[resn]));
117879
+ ic.defNames2Descr[resn] = resn;
117880
+
117881
+ ic.defNames2Command[resn] = 'select :3' + resn;
117609
117882
  }
117610
117883
 
117611
117884
  // select whole structure
@@ -121884,7 +122157,7 @@ class Dssp {
121884
122157
  ic.ref2igtype['PDL1_4z18B_human_V-n1'] = 'IgV';
121885
122158
  ic.ref2igtype['Palladin_2dm3A_human_Iset-n1'] = 'IgI';
121886
122159
  ic.ref2igtype['RBPJ_6py8C_human_Unk-n1'] = 'IgFN3-like';
121887
- ic.ref2igtype['RBPJ_6py8C_human_Unk-n2'] = 'IgFN3-like';
122160
+ //ic.ref2igtype['RBPJ_6py8C_human_Unk-n2'] = 'IgFN3-like';
121888
122161
  ic.ref2igtype['Sidekick2_1wf5A_human_FN3-n7'] = 'IgFN3';
121889
122162
  ic.ref2igtype['Siglec3_5j0bB_human_C1-n2'] = 'IgC1';
121890
122163
  ic.ref2igtype['TCRa_6jxrm_human_C1-n2'] = 'IgC1';
@@ -127978,7 +128251,7 @@ class SaveFile {
127978
128251
  //The type "png" is used to save the current canvas image. The type "html" is used to save html file with the
127979
128252
  //"data". This can be used to save any text. The type "text" is used to save an array of text, where "data" is
127980
128253
  //actually an array. The type "binary" is used to save an array of binary, where "data" is actually an array.
127981
- saveFile(filename, type, text, bBlob) { let ic = this.icn3d, me = ic.icn3dui;
128254
+ async saveFile(filename, type, text, bBlob, bReturnBlobOnly) { let ic = this.icn3d, me = ic.icn3dui;
127982
128255
  let thisClass = this;
127983
128256
 
127984
128257
  //Save file
@@ -128020,7 +128293,12 @@ class SaveFile {
128020
128293
 
128021
128294
  if(me.utilsCls.isIE()) {
128022
128295
  blob = ic.renderer.domElement.msToBlob();
128296
+ }
128297
+ else {
128298
+ blob = await this.getBlobFromNonIE();
128299
+ }
128023
128300
 
128301
+ if(!bReturnBlobOnly) {
128024
128302
  if(bAddURL) {
128025
128303
  let reader = new FileReader();
128026
128304
  reader.onload = function(e) {
@@ -128046,33 +128324,7 @@ class SaveFile {
128046
128324
  }
128047
128325
  }
128048
128326
  else {
128049
- ic.renderer.domElement.toBlob(function(data) {
128050
- if(bAddURL) {
128051
- let reader = new FileReader();
128052
- reader.onload = function(e) {
128053
- let arrayBuffer = e.target.result; // or = reader.result;
128054
-
128055
- let text = ic.shareLinkCls.getPngText();
128056
-
128057
- blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
128058
-
128059
- //ic.createLinkForBlob(blob, filename);
128060
- thisClass.saveBlob(blob, filename, bBlob, width, height);
128061
-
128062
- return blob;
128063
- };
128064
-
128065
- reader.readAsArrayBuffer(data);
128066
- }
128067
- else {
128068
- blob = data;
128069
-
128070
- //ic.createLinkForBlob(blob, filename);
128071
- thisClass.saveBlob(blob, filename, bBlob, width, height);
128072
-
128073
- return blob;
128074
- }
128075
- });
128327
+ return blob;
128076
128328
  }
128077
128329
 
128078
128330
  // reset the image size
@@ -128106,12 +128358,20 @@ class SaveFile {
128106
128358
 
128107
128359
  if(type !== 'png') {
128108
128360
  //https://github.com/eligrey/FileSaver.js/
128109
- saveAs(blob, filename);
128361
+ if(!bReturnBlobOnly) saveAs(blob, filename);
128110
128362
  }
128111
128363
 
128112
128364
  return blob;
128113
128365
  }
128114
128366
 
128367
+ getBlobFromNonIE() { let ic = this.icn3d; ic.icn3dui;
128368
+ return new Promise(function(resolve, reject) {
128369
+ ic.renderer.domElement.toBlob(function(data) {
128370
+ resolve(data);
128371
+ });
128372
+ })
128373
+ }
128374
+
128115
128375
  saveBlob(blob, filename, bBlob, width, height) { let ic = this.icn3d; ic.icn3dui;
128116
128376
  if(bBlob) {
128117
128377
  let urlCreator = window.URL || window.webkitURL;
@@ -132411,7 +132671,7 @@ class iCn3DUI {
132411
132671
  //even when multiple iCn3D viewers are shown together.
132412
132672
  this.pre = this.cfg.divid + "_";
132413
132673
 
132414
- this.REVISION = '3.44.0';
132674
+ this.REVISION = '3.44.2';
132415
132675
 
132416
132676
  // In nodejs, iCn3D defines "window = {navigator: {}}"
132417
132677
  this.bNode = (Object.keys(window).length < 2) ? true : false;