icn3d 3.34.5 → 3.35.0

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.
package/icn3d.module.js CHANGED
@@ -41178,6 +41178,8 @@ class AnnoCddSite {
41178
41178
  let resiNCBI = resiNCBIArray[i] + 1; // zero-based
41179
41179
  let residNCBI = chainid + '_' + resiNCBI;
41180
41180
  let resid = ic.ncbi2resid[residNCBI];
41181
+ if(!resid) resid = residNCBI; // this happens sometimes, e.g., Q9Y4K1
41182
+
41181
41183
  let resi = resid.split('_')[2];
41182
41184
  if(i > 0) resiArrayStr += ',';
41183
41185
  resiArrayStr += resi;
@@ -43124,6 +43126,7 @@ class AnnoSnpClinVar {
43124
43126
  let altName = bClinvar ? 'clinvar' : 'snp';
43125
43127
  // determine whether the SNPis from virus directly
43126
43128
  let bVirus = false;
43129
+
43127
43130
  for(let resi in resi2rsnum) {
43128
43131
  for(let i = 0, il = resi2rsnum[resi].length; i < il; ++i) {
43129
43132
  if(resi2rsnum[resi][i] == 0) {
@@ -43136,7 +43139,8 @@ class AnnoSnpClinVar {
43136
43139
 
43137
43140
  if(bStartEndRes) {
43138
43141
  let title1 = 'ClinVar', title2 = 'SNP', warning = "", warning2 = "";
43139
- if(!bVirus && ic.organism !== undefined && ic.organism !== 'human' && ic.organism !== 'homo sapiens') {
43142
+
43143
+ if(!bVirus && ic.organism !== undefined && ic.organism.toLowerCase() !== 'human' && ic.organism.toLowerCase() !== 'homo sapiens') {
43140
43144
  warning = " <span style='color:#FFA500'>(from human)</span>";
43141
43145
  warning2 = " <span style='color:#FFA500'>(based on human sequences and mapped to this structure by sequence similarity)</span>";
43142
43146
  }
@@ -43159,7 +43163,11 @@ class AnnoSnpClinVar {
43159
43163
  let pre = altName;
43160
43164
  let snpCnt = 0, clinvarCnt = 0;
43161
43165
  let snpTypeHash = {}, currSnpTypeHash = {};
43162
- for(let i = 1, il = ic.giSeq[chnid].length; i <= il; ++i) {
43166
+ let residHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.chains[chnid]);
43167
+ // for(let i = 1, il = ic.giSeq[chnid].length; i <= il; ++i) {
43168
+ for(let resid in residHash) {
43169
+ let i = resid.split('_')[2];
43170
+
43163
43171
  if(resi2index[i] !== undefined) {
43164
43172
  ++snpCnt;
43165
43173
  let allDiseaseTitle = '';
@@ -43170,7 +43178,11 @@ class AnnoSnpClinVar {
43170
43178
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
43171
43179
  // relax the restriction to show all clinvar
43172
43180
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
43173
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + '); ';
43181
+ diseaseTitle += diseaseArray[k];
43182
+ if(sigArray[k] != '') {
43183
+ diseaseTitle += '(' + sigArray[k] + ')';
43184
+ }
43185
+ diseaseTitle += '; ';
43174
43186
  //}
43175
43187
  }
43176
43188
 
@@ -43236,18 +43248,21 @@ class AnnoSnpClinVar {
43236
43248
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqStartLen[chnid], '-');
43237
43249
  }
43238
43250
 
43239
- for(let i = 1, il = ic.giSeq[chnid].length; i <= il; ++i) {
43251
+ for(let index = 1, indexl = ic.giSeq[chnid].length; index <= indexl; ++index) {
43252
+ let pos = ic.ParserUtilsCls.getResi(chnid, index - 1);
43253
+ let i = pos;
43254
+
43240
43255
  if(bOverview) {
43241
43256
  if(resi2index[i] !== undefined) {
43242
43257
 
43243
43258
  // get the mouse over text
43244
- let cFull = ic.giSeq[chnid][i-1];
43259
+ let cFull = ic.giSeq[chnid][index-1];
43245
43260
  let c = cFull;
43246
43261
  if(cFull.length > 1) {
43247
43262
  c = cFull[0] + '..';
43248
43263
  }
43249
43264
  // let pos =(i >= ic.matchedPos[chnid] && i-1 - ic.matchedPos[chnid] < ic.chainsSeq[chnid].length) ? ic.chainsSeq[chnid][i-1 - ic.matchedPos[chnid]].resi : ic.baseResi[chnid] + 1 + i-1;
43250
- let pos = ic.ParserUtilsCls.getResi(chnid, i - 1);
43265
+
43251
43266
  let snpTitle = pos + c + '>';
43252
43267
  for(let j = 0, jl = resi2snp[i].length; j < jl; ++j) {
43253
43268
  snpTitle += resi2snp[i][j];
@@ -43258,24 +43273,28 @@ class AnnoSnpClinVar {
43258
43273
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
43259
43274
  // relax the restriction to show all clinvar
43260
43275
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
43261
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + '); ';
43276
+ diseaseTitle += diseaseArray[k];
43277
+ if(sigArray[k] != '') {
43278
+ diseaseTitle += '(' + sigArray[k] + ')';
43279
+ }
43280
+ diseaseTitle += '; ';
43262
43281
  //}
43263
43282
  }
43264
43283
  }
43265
43284
  }
43266
- html += ic.showSeqCls.insertGapOverview(chnid, i-1);
43267
- let emptyWidth = Math.round(ic.seqAnnWidth *(i-1) /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth);
43285
+ html += ic.showSeqCls.insertGapOverview(chnid, index-1);
43286
+ let emptyWidth = Math.round(ic.seqAnnWidth *(index-1) /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth);
43268
43287
  //let emptyWidth =(me.cfg.blast_rep_id == chnid) ? Math.round(ic.seqAnnWidth *(i-1) /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth) : Math.round(ic.seqAnnWidth *(i-1) / ic.maxAnnoLength - prevEmptyWidth - prevLineWidth);
43269
43288
  //if(emptyWidth < 0) emptyWidth = 0;
43270
43289
  if(bClinvar) {
43271
- if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43290
+ // if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43272
43291
  if(emptyWidth >= 0) {
43273
43292
  html += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
43274
43293
  html += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + snpTitle + '">&nbsp;</div>';
43275
43294
  prevEmptyWidth += emptyWidth;
43276
43295
  prevLineWidth += widthPerRes;
43277
43296
  }
43278
- }
43297
+ // }
43279
43298
  }
43280
43299
  else {
43281
43300
  if(emptyWidth > 0) {
@@ -43288,20 +43307,20 @@ class AnnoSnpClinVar {
43288
43307
  }
43289
43308
  }
43290
43309
  else { // detailed view
43291
- html += ic.showSeqCls.insertGap(chnid, i-1, '-');
43310
+ html += ic.showSeqCls.insertGap(chnid, index-1, '-');
43292
43311
 
43293
43312
  if(resi2index[i] !== undefined) {
43294
43313
  if(!bClinvar && line == 1) {
43295
43314
  html += '<span>&dArr;</span>'; // or down triangle &#9660;
43296
43315
  }
43297
43316
  else {
43298
- let cFull = ic.giSeq[chnid][i-1];
43317
+ let cFull = ic.giSeq[chnid][index-1];
43299
43318
  let c = cFull;
43300
43319
  if(cFull.length > 1) {
43301
43320
  c = cFull[0] + '..';
43302
43321
  }
43303
43322
  // let pos =(i >= ic.matchedPos[chnid] && i-1 - ic.matchedPos[chnid] < ic.chainsSeq[chnid].length) ? ic.chainsSeq[chnid][i-1 - ic.matchedPos[chnid]].resi : ic.baseResi[chnid] + 1 + i-1;
43304
- let pos = ic.ParserUtilsCls.getResi(chnid, i - 1);
43323
+ // let pos = ic.ParserUtilsCls.getResi(chnid, index - 1);
43305
43324
  let snpStr = "", snpTitle = "<div class='snptip'>";
43306
43325
  //var snpType = '';
43307
43326
  let jl = resi2snp[i].length;
@@ -43346,7 +43365,10 @@ class AnnoSnpClinVar {
43346
43365
  else {
43347
43366
  if( j === 0 || j === 1) diseaseStr = 'disease="' + diseaseArray[k] + '"';
43348
43367
  }
43349
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + ')';
43368
+ diseaseTitle += diseaseArray[k];
43369
+ if(sigArray[k] != '') {
43370
+ diseaseTitle += '(' + sigArray[k] + ')';
43371
+ }
43350
43372
  ++index;
43351
43373
  //}
43352
43374
  }
@@ -43416,23 +43438,26 @@ class AnnoSnpClinVar {
43416
43438
  let diseaseArray = resi2disease[i][j].split('; ');
43417
43439
  let sigArray = resi2sig[i][j].split('; ');
43418
43440
  let diseaseTitle = '';
43419
- let index = 0;
43441
+ let indexTmp = 0;
43420
43442
 
43421
43443
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
43422
43444
  // relax the restriction to show all clinvar
43423
43445
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
43424
- if(index > 0) {
43446
+ if(indexTmp > 0) {
43425
43447
  diseaseTitle += '; ';
43426
43448
  }
43427
43449
  else {
43428
43450
  if( j === 0 || j === 1) diseaseStr = 'disease="' + diseaseArray[k] + '"';
43429
43451
  }
43430
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + ')';
43431
- ++index;
43452
+ diseaseTitle += diseaseArray[k];
43453
+ if(sigArray[k] != '') {
43454
+ diseaseTitle += '(' + sigArray[k] + ')';
43455
+ }
43456
+ ++indexTmp;
43432
43457
  //}
43433
43458
  }
43434
43459
 
43435
- if(diseaseTitle != '') {
43460
+ // if(diseaseTitle != '') {
43436
43461
  if(diseaseCnt < shownResCnt) snpStr += resi2snp[i][j];
43437
43462
  snpTitle += pos + c + '>' + resi2snp[i][j];
43438
43463
  //snpType = 'icn3d-clinvar';
@@ -43445,19 +43470,22 @@ class AnnoSnpClinVar {
43445
43470
  }
43446
43471
 
43447
43472
  //snpTitle += "<br>Links: <span class='" + ic.pre + "snpin3d icn3d-snplink' snp='" + chnid + "_" + pos + "_" + resi2snp[i][j] + "'>SNP in 3D with scap</span>, <span class='" + ic.pre + "snpinter icn3d-snplink' snp='" + chnid + "_" + pos + "_" + resi2snp[i][j] + "'>SNP Interactions in 3D</span>, <span class='" + ic.pre + "snppdb icn3d-snplink' snp='" + chnid + "_" + pos + "_" + resi2snp[i][j] + "'>SNP PDB</span>, <a href='https://www.ncbi.nlm.nih.gov/clinvar/?term=" + resi2clinAllele[i][j] + "[AlleleID]' target='_blank'>ClinVar</a>, <a href='https://www.ncbi.nlm.nih.gov/snp/?term=" + resi2rsnum[i][j] + "' target='_blank'>dbSNP(rs" + resi2rsnum[i][j] + ")</a>";
43448
- snpTitle += "<br>Links: <a href='https://www.ncbi.nlm.nih.gov/clinvar/?term=" + resi2clinAllele[i][j] + "[AlleleID]' style='color:blue' target='_blank'>ClinVar</a>, <a href='https://www.ncbi.nlm.nih.gov/snp/?term=" + resi2rsnum[i][j] + "' style='color:blue' target='_blank'>dbSNP(rs" + resi2rsnum[i][j] + ")</a>";
43473
+ snpTitle += "<br>Links: <a href='https://www.ncbi.nlm.nih.gov/clinvar/?term=" + resi2clinAllele[i][j] + "[AlleleID]' style='color:blue' target='_blank'>ClinVar</a>";
43474
+ if(resi2rsnum[i][j] != 0) {
43475
+ snpTitle += ", <a href='https://www.ncbi.nlm.nih.gov/snp/?term=" + resi2rsnum[i][j] + "' style='color:blue' target='_blank'>dbSNP(rs" + resi2rsnum[i][j] + ")</a>";
43476
+ }
43449
43477
  if(j < jl - 1) {
43450
43478
  snpTitle += '<br><br>';
43451
43479
  }
43452
43480
  ++diseaseCnt;
43453
- } // if(diseaseTitle != '') {
43481
+ // } // if(diseaseTitle != '') {
43454
43482
  } // for(let j = start; j < jl && j < end; ++j) {
43455
43483
  //if(diseaseCnt > shownResCnt && line == 3) snpStr += '..';
43456
43484
  if(diseaseCnt > shownResCnt && line == 2) snpStr += '..';
43457
43485
  } // else { // if(bClinvar)
43458
43486
  snpTitle += '</div>';
43459
43487
  if(bClinvar) {
43460
- if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43488
+ // if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43461
43489
  if(line == 1) {
43462
43490
  html += '<span>&dArr;</span>'; // or down triangle &#9660;
43463
43491
  }
@@ -43466,13 +43494,14 @@ class AnnoSnpClinVar {
43466
43494
  html += '<span>-</span>';
43467
43495
  }
43468
43496
  else {
43469
- html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
43497
+ // html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
43498
+ html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + snpTypeHash[i] + '">' + snpStr + '</span>';
43470
43499
  }
43471
43500
  }
43472
- }
43473
- else {
43474
- html += '<span>-</span>';
43475
- }
43501
+ // }
43502
+ // else {
43503
+ // html += '<span>-</span>';
43504
+ // }
43476
43505
  }
43477
43506
  else {
43478
43507
  if(snpStr == '' || snpStr == ' ') {
@@ -43480,10 +43509,12 @@ class AnnoSnpClinVar {
43480
43509
  }
43481
43510
  else {
43482
43511
  if(!bSnpOnly) {
43483
- html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
43512
+ // html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
43513
+ html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + snpTypeHash[i] + '">' + snpStr + '</span>';
43484
43514
  }
43485
43515
  else {
43486
- html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
43516
+ // html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
43517
+ html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" class="icn3d-tooltip icn3d-residue ' + snpTypeHash[i] + '">' + snpStr + '</span>';
43487
43518
  }
43488
43519
  }
43489
43520
  }
@@ -43539,23 +43570,60 @@ class AnnoSnpClinVar {
43539
43570
  }
43540
43571
  }
43541
43572
 
43573
+ let foundRealSnp = {};
43542
43574
  for(let i = 0, il = lineArray.length; i < il; ++i) {
43543
43575
  //bSnpOnly: false
43544
- //1310770 13 14 14Y>H 368771578 150500 Hereditary cancer-predisposing syndrome; Li-Fraumeni syndrome; not specified; Li-Fraumeni syndrome 1 Likely benign; Uncertain significance; Uncertain significance; Uncertain significance 1TSR_A 120407068 NP_000537.3
43545
- //Pdb_gi, Pos from, Pos to, Pos & Amino acid change, rs#, ClinVar Allele ID, Disease name, Clinical significance, master accession, master_gi, master_accession.version
43576
+ //1310770 13 14 14Y>H 368771578 150500 Hereditary cancer-predisposing syndrome; Li-Fraumeni syndrome; not specified; Li-Fraumeni syndrome 1 Likely benign; Uncertain significance; Uncertain significance; Uncertain significance 0
43577
+ //Pdb_gi, Pos from, Pos to, Pos & Amino acid change, rs#, ClinVar Allele ID, Disease name, Clinical significance, [whether data is directly from ClinVar database, 0 or 1]
43546
43578
  //bSnpOnly: true
43547
- //1310770 13 14 14Y>H 1111111
43579
+ //1310770 13 14 14Y>H 1111111 0
43548
43580
  if(lineArray[i] != '') {
43549
43581
  let fieldArray =(!bSnpOnly || bVirus) ? lineArray[i] : lineArray[i].split('\t');
43550
43582
  let snpStr = fieldArray[3];
43583
+ let rsnum = fieldArray[4];
43584
+ let bFromClinVarDb = false;
43585
+
43586
+ if(bSnpOnly) {
43587
+ if(fieldArray.length > 5) bFromClinVarDb = parseInt(fieldArray[5]);
43588
+ }
43589
+ else {
43590
+ if(fieldArray.length > 8) bFromClinVarDb = parseInt(fieldArray[8]);
43591
+ }
43551
43592
  if(snpStr == prevSnpStr) continue;
43552
43593
  prevSnpStr = snpStr;
43553
- let resiStr = snpStr.substr(0, snpStr.length - 3);
43594
+
43595
+ let posSymbol = snpStr.indexOf('>');
43596
+ // let resiStr = snpStr.substr(0, snpStr.length - 3);
43597
+ let resiStr = snpStr.substr(0, posSymbol - 1);
43554
43598
  let resi = Math.round(resiStr);
43555
43599
 
43600
+ // if the data is From ClinVar Db directly, the residue numbers are PDB residue numbers. Otherwise, the residue numbers are NCBI residue numbers.
43601
+ let realResi = (bFromClinVarDb) ? resi : ic.ParserUtilsCls.getResi(chnid, resi - 1);
43602
+
43603
+ let realSnp = realResi + snpStr.substr(posSymbol - 1);
43604
+ if(foundRealSnp.hasOwnProperty(realSnp)) {
43605
+ continue;
43606
+ }
43607
+ else {
43608
+ foundRealSnp[realSnp] = 1;
43609
+ }
43610
+
43611
+ let snpResn = snpStr.substr(posSymbol - 1, 1);
43612
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chnid + '_' + realResi]);
43613
+ let oneLetterRes = (atom) ? me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3)) : '';
43614
+ if(!bFromClinVarDb) {
43615
+ oneLetterRes = ic.chainsSeq[chnid][resi - 1].name;
43616
+ }
43617
+
43618
+ if(snpResn != oneLetterRes) {
43619
+ // console.error("The snp " + snpStr + " didn't match the residue name " + oneLetterRes);
43620
+ continue;
43621
+ }
43622
+
43556
43623
  if(me.bNode) {
43557
43624
  let obj = {};
43558
- obj[chnid + '_' + resi] = snpStr;
43625
+ // obj[chnid + '_' + resi] = snpStr;
43626
+ obj[chnid + '_' + realResi] = realSnp;
43559
43627
 
43560
43628
  if(bSnpOnly) {
43561
43629
  ic.resid2snp[chnid].push(obj);
@@ -43565,52 +43633,53 @@ class AnnoSnpClinVar {
43565
43633
  }
43566
43634
  }
43567
43635
 
43568
- snpStr.substr(snpStr.length - 3, 1);
43569
- let snpRes = snpStr.substr(snpStr.indexOf('>') + 1); //snpStr.substr(snpStr.length - 1, 1);
43636
+ // let currRes = snpStr.substr(snpStr.length - 3, 1);
43637
+ // let snpRes = snpStr.substr(snpStr.indexOf('>') + 1); //snpStr.substr(snpStr.length - 1, 1);
43638
+ let snpRes = realSnp.substr(realSnp.indexOf('>') + 1); //realSnp.substr(realSnp.length - 1, 1);
43570
43639
  //var rsnum = bSnpOnly ? '' : fieldArray[4];
43571
- let rsnum = fieldArray[4];
43640
+
43572
43641
  let clinAllele = bSnpOnly ? '' : fieldArray[5];
43573
43642
  let disease = bSnpOnly ? '' : fieldArray[6]; // When more than 2+ diseases, they are separated by "; "
43574
43643
  // Some are "not specified", "not provided"
43575
43644
  let clinSig = bSnpOnly ? '' : fieldArray[7]; // Clinical significance, When more than 2+ diseases, they are separated by "; "
43576
43645
  // "*" means terminating codon, "-" means deleted codon
43577
43646
  //if(currRes !== '-' && currRes !== '*' && snpRes !== '-' && snpRes !== '*') {
43578
- let realResi = ic.ParserUtilsCls.getResi(chnid, resi - 1);
43647
+
43579
43648
  // posHash[resi + ic.baseResi[chnid]] = 1;
43580
43649
  // if(disease != '') posClinHash[resi + ic.baseResi[chnid]] = 1;
43581
43650
  posHash[realResi] = 1;
43582
43651
  if(disease != '') posClinHash[realResi] = 1;
43583
- resi2index[resi] = i + 1;
43584
- if(resi2snp[resi] === undefined) {
43585
- resi2snp[resi] = [];
43652
+ resi2index[realResi] = i + 1;
43653
+ if(resi2snp[realResi] === undefined) {
43654
+ resi2snp[realResi] = [];
43586
43655
  }
43587
- resi2snp[resi].push(snpRes);
43588
- if(resi2rsnum[resi] === undefined) {
43589
- resi2rsnum[resi] = [];
43656
+ resi2snp[realResi].push(snpRes);
43657
+ if(resi2rsnum[realResi] === undefined) {
43658
+ resi2rsnum[realResi] = [];
43590
43659
  }
43591
- resi2rsnum[resi].push(rsnum);
43592
- if(resi2clinAllele[resi] === undefined) {
43593
- resi2clinAllele[resi] = [];
43660
+ resi2rsnum[realResi].push(rsnum);
43661
+ if(resi2clinAllele[realResi] === undefined) {
43662
+ resi2clinAllele[realResi] = [];
43594
43663
  }
43595
- resi2clinAllele[resi].push(clinAllele);
43596
- if(resi2disease[resi] === undefined) {
43597
- resi2disease[resi] = [];
43664
+ resi2clinAllele[realResi].push(clinAllele);
43665
+ if(resi2disease[realResi] === undefined) {
43666
+ resi2disease[realResi] = [];
43598
43667
  }
43599
- resi2disease[resi].push(disease);
43668
+ resi2disease[realResi].push(disease);
43600
43669
  if(disease != '') {
43601
- if(ic.resi2disease_nonempty[chnid][resi] === undefined) {
43602
- ic.resi2disease_nonempty[chnid][resi] = [];
43670
+ if(ic.resi2disease_nonempty[chnid][realResi] === undefined) {
43671
+ ic.resi2disease_nonempty[chnid][realResi] = [];
43603
43672
  }
43604
- ic.resi2disease_nonempty[chnid][resi].push(disease);
43673
+ ic.resi2disease_nonempty[chnid][realResi].push(disease);
43605
43674
  }
43606
- if(resi2sig[resi] === undefined) {
43607
- resi2sig[resi] = [];
43675
+ if(resi2sig[realResi] === undefined) {
43676
+ resi2sig[realResi] = [];
43608
43677
  }
43609
- resi2sig[resi].push(clinSig);
43678
+ resi2sig[realResi].push(clinSig);
43610
43679
  //}
43611
43680
  }
43612
43681
  }
43613
-
43682
+
43614
43683
  let posarray = Object.keys(posHash);
43615
43684
  let posClinArray = Object.keys(posClinHash);
43616
43685
  if(bSnpOnly) {
@@ -43629,7 +43698,7 @@ class AnnoSnpClinVar {
43629
43698
  $("#" + ic.pre + 'ov_snp_' + chnid).html(html2);
43630
43699
  $("#" + ic.pre + 'tt_snp_' + chnid).html(html3);
43631
43700
  }
43632
- else {
43701
+ else {
43633
43702
  //if(!bSnpOnly && ic.bClinvarCnt) {
43634
43703
  let bClinvar = true;
43635
43704
  htmlClinvar += this.getSnpLine(1, 2, resi2snp, resi2rsnum, resi2clinAllele, resi2disease, resi2index, resi2sig, posarray, posClinArray, 1, chnid, false, bClinvar, undefined, bSnpOnly);
@@ -43662,9 +43731,12 @@ class AnnoSnpClinVar {
43662
43731
  }
43663
43732
  async showClinvarPart2(chnid, chnidBase, gi) { let ic = this.icn3d, me = ic.icn3dui;
43664
43733
  let thisClass = this;
43734
+
43735
+ if(!ic.chainid2uniport) await this.getUniprotForAllStructures();
43736
+
43665
43737
  //var url = "https://www.ncbi.nlm.nih.gov/projects/SNP/beVarSearch_mt.cgi?appname=iCn3D&format=bed&report=pdb2bed&acc=" + chnidBase;
43666
43738
  //var url = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/clinvar.txt";
43667
- let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_clinvar=" + chnidBase;
43739
+ let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_clinvar=" + chnidBase + "&uniprot=" + ic.chainid2uniport[chnidBase];
43668
43740
  if(ic.chainsGene[chnid] && ic.chainsGene[chnid].geneSymbol) {
43669
43741
  url += "&gene=" + ic.chainsGene[chnid].geneSymbol;
43670
43742
  }
@@ -43684,15 +43756,43 @@ class AnnoSnpClinVar {
43684
43756
  }
43685
43757
  catch(err) {
43686
43758
  thisClass.processNoClinvar(chnid);
43687
- ///// if(ic.deferredClinvar !== undefined) ic.deferredClinvar.resolve();
43688
43759
  return;
43689
43760
  }
43690
43761
  }
43691
43762
 
43763
+ async getUniprotForAllStructures() { let ic = this.icn3d, me = ic.icn3dui;
43764
+ ic.chainid2uniport = {};
43765
+
43766
+ // get UniProt ID ffrom chainid
43767
+ for(let structure in ic.structures) {
43768
+ if(structure.length > 5) {
43769
+ let chainidArray = ic.structures[structure];
43770
+ for(let i = 0, il = chainidArray.length; i < il; ++i) {
43771
+ ic.chainid2uniport[chainidArray[i]] = structure;
43772
+ }
43773
+ }
43774
+ else {
43775
+ let structLower = structure.toLowerCase();
43776
+ let url = "https://www.ebi.ac.uk/pdbe/api/mappings/uniprot/" + structLower;
43777
+ let dataJson = await me.getAjaxPromise(url, 'json');
43778
+ let data= dataJson[structLower]['UniProt'];
43779
+ for(let uniprot in data) {
43780
+ let chainDataArray = data[uniprot].mappings;
43781
+ for(let i = 0, il = chainDataArray.length; i < il; ++i) {
43782
+ let chain = chainDataArray[i].chain_id;
43783
+ ic.chainid2uniport[structure + '_' + chain] = uniprot;
43784
+ }
43785
+ }
43786
+ }
43787
+ }
43788
+ }
43789
+
43692
43790
  async showSnpPart2(chnid, chnidBase, gi) { let ic = this.icn3d, me = ic.icn3dui;
43693
43791
  let thisClass = this;
43792
+ if(!ic.chainid2uniport) await this.getUniprotForAllStructures();
43793
+
43694
43794
  if(gi !== undefined) {
43695
- let url4 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_snp=" + chnidBase;
43795
+ let url4 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_snp=" + chnidBase + "&uniprot=" + ic.chainid2uniport[chnidBase];
43696
43796
  if(ic.chainsGene[chnid] && ic.chainsGene[chnid].geneSymbol) {
43697
43797
  url4 += "&gene=" + ic.chainsGene[chnid].geneSymbol;
43698
43798
  }
@@ -82891,7 +82991,7 @@ class iCn3DUI {
82891
82991
  //even when multiple iCn3D viewers are shown together.
82892
82992
  this.pre = this.cfg.divid + "_";
82893
82993
 
82894
- this.REVISION = '3.34.1';
82994
+ this.REVISION = '3.35.0';
82895
82995
 
82896
82996
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82897
82997
  this.bNode = (Object.keys(window).length < 2) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.34.5",
3
+ "version": "3.35.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {