Skip to content

Commit

Permalink
Draw coils for the whole structure with zero radius for the secondary…
Browse files Browse the repository at this point in the history
… structure parts.
  • Loading branch information
jiywang3 committed Jun 19, 2024
1 parent 7b650d9 commit 8e7f7c7
Show file tree
Hide file tree
Showing 5 changed files with 1,065 additions and 0 deletions.
342 changes: 342 additions & 0 deletions dist/full2_3.33.1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="iCn3D Structure Viewer">
<meta name="keywords" content="NCBI, Structure, JavaScript, iCn3D, 3D, Viewer, WebGL, three.js, sequence, chemical">
<meta name="robots" content="index,follow,noarchive">
<meta name="ncbi_app" content="structure">
<meta name="ncbi_pdid" content="icn3d">
<meta name="ncbi_page" content="full2">
<meta name="ncbi_pinger_xml_http_request_override" content="false"/>
<meta name="ncbi_pinger_click_ping_selector" content="button, a, input[type=submit], span[data-pinger], div[data-pinger], label[data-pinger]"/>
<title>iCn3D: Web-based 3D Structure Viewer</title>
<script type="text/javascript">
window.ncbi_startTime = new Date();
</script>
</head>
<body>
<div id="div0" style="float:left; padding-right:5px;"></div>
<div id="div1" style="float:left;"></div>

<link rel="stylesheet" href="lib/jquery-ui-1.13.2.min.css">
<link rel="stylesheet" href="icn3d_3.33.1.css">
<script src="lib/jquery-3.5.0.min.js"></script>
<script src="lib/jquery-ui-1.13.2.min.js"></script>
<script src="lib/three_0.151.0.min.js"></script>
<script src="icn3d_3.33.1.min.js"></script>

<script type="text/javascript">
$( document ).ready(async function() {
if (navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // If Internet Explorer
// iCn3D version 2.24.7 doesn't work with three_0.128.0.min.js
//$.getScript('icn3d_full_ui_2.24.7.min.js', function() {
// var version = 2;
// launchIcn3d(version);
//});

var fixedUrl = document.URL.replace('full2.html', 'full2_2.24.7.html');
window.open(fixedUrl, '_self');

alert("IE does NOT work with the current iCn3D version 3. The old iCn3D version 2 is used instead.");
}
else {
//$.getScript('icn3d_3.33.1.min.js', function() {
var version = 3;
await launchIcn3d(version);
//});
}

async function launchIcn3d(version) {
// use the FIXED name "icn3duiHash" for side-by-side view
window.icn3duiHash = {};

var cfg = getConfig();
cfg.version = version;

if(cfg.bcifid !== undefined) {
await setupViewer('bcifid', cfg.bcifid, cfg);
}
else if(cfg.mmtfid !== undefined) {
await setupViewer('mmtfid', cfg.mmtfid, cfg);
}
else if(cfg.pdbid !== undefined) {
await setupViewer('pdbid', cfg.pdbid, cfg);
}
else if(cfg.afid !== undefined) {
await setupViewer('afid', cfg.afid, cfg);
}
else if(cfg.opmid !== undefined) {
await setupViewer('opmid', cfg.opmid, cfg);
}
else if(cfg.cid !== undefined) {
await setupViewer('cid', cfg.cid, cfg);
}
else if(cfg.mmcifid !== undefined) {
await setupViewer('mmcifid', cfg.mmcifid, cfg);
}
else if(cfg.mmdbid !== undefined) {
await setupViewer('mmdbid', cfg.mmdbid, cfg);
}
else if(cfg.gi !== undefined) {
await setupViewer('gi', cfg.gi, cfg);
}
else if(cfg.blast_rep_id !== undefined) {
if( (from === 'blast' || from === 'icn3d') && command == '') {
command = 'view+annotations;+set+annotation+cdd;+set+annotation+site;+set+view+detailed+view;+select+chain+'
+ cfg.blast_rep_id + ';+show+selection';
}

await setupViewer('blast_rep_id', cfg.blast_rep_id, cfg);
}
else if(cfg.urlname !== undefined) {
var urlname = decodeURIComponent(cfg.urlname);
await setupViewer('url', cfg.urltype + '|' + urlname, cfg);
}
// e.g., align=103701,1,4,68563,1,167 [mmdbid1,biounit,molecule,mmdbid2,biounit,molecule]
else if(cfg.align !== undefined) {
cfg.width = '49%'; //width,
cfg.mobilemenu = true; //mobilemenu,
cfg.closepopup = true; //closepopup,
cfg.controlGl = true;
cfg.bSidebyside = true;

cfg.divid = 'div0';
cfg.align = cfg.align;
cfg.showalignseq = cfg.showalignseq;

// VAST+ uses biological units
cfg.bu = 1;

cfg.idname = 'align';
cfg.idvalue = cfg.align;

var icn3dui = new icn3d.iCn3DUI(cfg);
window.icn3duiHash['div0'] = icn3dui;
await icn3dui.show3DStructure();

var cfg2 = cfg;
cfg2.divid = 'div1';
var icn3dui2 = new icn3d.iCn3DUI(cfg2);
window.icn3duiHash['div1'] = icn3dui2;
await icn3dui2.show3DStructure();
}
else if(cfg.chainalign !== undefined || cfg.mmdbafid !== undefined) {
cfg.width = '49%'; //width,
cfg.mobilemenu = true; //mobilemenu,
cfg.closepopup = true; //closepopup,
cfg.controlGl = true;
cfg.bSidebyside = true;

cfg.divid = 'div0';
//cfg.chainalign = cfg.chainalign;
//cfg.resnum = cfg.resnum;
//cfg.showalignseq = cfg.showalignseq;

if(cfg.chainalign !== undefined) {
cfg.idname = 'chainalign';
cfg.idvalue = cfg.chainalign;
}
else {
cfg.idname = 'mmdbafid';
cfg.idvalue = cfg.mmdbafid;
}

var icn3dui = new icn3d.iCn3DUI(cfg);
window.icn3duiHash['div0'] = icn3dui;
await icn3dui.show3DStructure();

var cfg2 = cfg;
cfg2.divid = 'div1';
var icn3dui2 = new icn3d.iCn3DUI(cfg2);
window.icn3duiHash['div1'] = icn3dui2;
await icn3dui2.show3DStructure();
}
else {
await setupViewer('', '', cfg);
}
}

async function setupViewer(idName, idValue, cfg) {
cfg.idname = idName;
cfg.idvalue = idValue;

var maxStructure = 5; // show max 5 structures

var idArray = idValue.replace(/\s/g, '').split(',');

//if(idArray.length > 1) {
cfg.resize = false;

if(cfg.width && cfg.width.indexOf('%') != -1) {
cfg.width = 400;
cfg.height = 400;
}
//}

//for(var i = 0, il = idArray.length; i < il && i < maxStructure; ++i) {
var i = 0;
cfg.divid = 'div' + i;
cfg.width = '49%'; //width,
cfg.mobilemenu = true; //mobilemenu,
cfg.closepopup = true; //closepopup,
cfg.controlGl = true;
cfg.bSidebyside = true;

if(idName !== '') cfg[idName] = idArray[i];

var icn3dui = new icn3d.iCn3DUI(cfg);
window.icn3duiHash['div0'] = icn3dui;
await icn3dui.show3DStructure();
if(idName === '') $("#div" + i + "_wait").hide();

i = 1;
var cfg2 = cfg;
cfg2.divid = 'div' + i;
var icn3dui2 = new icn3d.iCn3DUI(cfg2);
window.icn3duiHash['div1'] = icn3dui2;
await icn3dui2.show3DStructure();
if(idName === '') $("#div" + i + "_wait").hide();
//}
}

function getConfig() {
// separating the GET parameters from the current URL
// repalce "color #" with "color " in the url
var url = document.URL.replace(/\#/g, '');

var bNopara = false;
var ampPos = url.indexOf("?");
if(ampPos === -1) {
// alert("Please include '?pdbid=1GPK,2POR,...' in your url");
bNopara = true;
}

var params = url.split("?");
// transforming the GET parameters into a dictionary
var search = params[params.length - 1];

var cfg = {};

if(!bNopara) {
var decodeSearch = decodeURIComponent(search).replace(/\+/g, ' ');

// command could contains '&', for example when loading statefile 'load mmdb 1kq2 | parameters &atype=1'
var commandPos = decodeSearch.indexOf('&command=');
if(commandPos != -1) {
cfg.command = decodeSearch.substr(commandPos + 9); // ";" separated commands
decodeSearch = decodeSearch.substr(0, commandPos);

var paraPos = decodeSearch.indexOf(' | parameters ');

if(paraPos != -1) { //When loading statefile (e.g., 'load mmdb 1kq2 | parameters &atype=1'), the commands ends with '}}'.
var tmpPos = cfg.command.indexOf('}}&');
if(tmpPos != -1) { // more parameters after the command
decodeSearch += cfg.command.substr(tmpPos + 2);
cfg.command = cfg.command.substr(0, tmpPos + 2);
}
}
else {
var paraPos = cfg.command.indexOf(' | parameters ');

if(paraPos != -1) { //"&command=load mmdb 7DDD | parameters &mmdbid=7DDD; select..." the commands ends with '}}'.
var tmpPos = cfg.command.indexOf('}}&');
if(tmpPos != -1) { // more parameters after the command
decodeSearch += cfg.command.substr(tmpPos + 2);
cfg.command = cfg.command.substr(0, tmpPos + 2);
}
}
else {
var tmpPos = cfg.command.indexOf('&');
if(tmpPos != -1) {
decodeSearch += cfg.command.substr(tmpPos);
cfg.command = cfg.command.substr(0, tmpPos);
}
}
}
}
else {
cfg.command = '';
}

var hashes = decodeSearch.split('&');
for (var i = 0; i < hashes.length; i++) {
var hash = hashes[i].split('=');
cfg[hash[0].trim()] = (hash[1] !== undefined) ? hash[1].trim() : undefined;
}

// for mmdb structures, pass the parameters after the first "&" sign
cfg.inpara = "&" + url.substr(ampPos + 1);
}

// changed some parameter names
cfg.rid = cfg.RID;

cfg.urlname = cfg.url;
if(cfg.urlname && cfg.urlname.indexOf('%3A%2F%2F') === -1) { // decoded URL
// should encode it
cfg.urlname = encodeURIComponent(cfg.urlname);
}
cfg.urltype = (cfg.type === undefined) ? 'pdb' : cfg.type;

cfg.version = getValue(cfg.v);

if(cfg.version !== undefined && window.localStorage && localStorage.getItem('fixedversion')) {
var fixedUrl = url.replace('full.html', 'full_' + cfg.version + '.html');
window.open(fixedUrl, '_self');

localStorage.removeItem('fixedversion');
}

// standardize the input values
for(var i in cfg) {
if(i == 'bu') {
cfg[i] = getInt(cfg[i]);
}
else {
cfg[i] = getValue(cfg[i]);
}
}

// backward compatible with showseq
cfg.showanno = cfg.showanno || cfg.showseq;

cfg.shownote = 1; //cfg.shownote;
cfg.options = (cfg.options !== undefined) ? JSON.parse(cfg.options) : undefined;

// default to show biological unit
if(cfg.bu === undefined) cfg.bu = 1; //0;
if(cfg.buidx !== undefined) cfg.bu = cfg.buidx;

return cfg;
}

function getValue(input) {
if(input == 'true') { // || input == '1') {
input = true;
}
else if(input == 'false') { // || input == '0') {
input = false;
}

return input;
}

function getInt(input) {
if(input == 'true' || input == '1') {
input = 1;
}
else if(input == 'false' || input == '0') {
input = 0;
}

return input;
}
}); // document ready

</script>

<!-- log & Google Analytics -->
<script type="text/javascript" src="https://www.ncbi.nlm.nih.gov/core/pinger/pinger.js"></script>
</body></html>

Loading

0 comments on commit 8e7f7c7

Please sign in to comment.
-