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.js CHANGED
@@ -40277,6 +40277,8 @@ class AnnoCddSite {
40277
40277
  let resiNCBI = resiNCBIArray[i] + 1; // zero-based
40278
40278
  let residNCBI = chainid + '_' + resiNCBI;
40279
40279
  let resid = ic.ncbi2resid[residNCBI];
40280
+ if(!resid) resid = residNCBI; // this happens sometimes, e.g., Q9Y4K1
40281
+
40280
40282
  let resi = resid.split('_')[2];
40281
40283
  if(i > 0) resiArrayStr += ',';
40282
40284
  resiArrayStr += resi;
@@ -42223,6 +42225,7 @@ class AnnoSnpClinVar {
42223
42225
  let altName = bClinvar ? 'clinvar' : 'snp';
42224
42226
  // determine whether the SNPis from virus directly
42225
42227
  let bVirus = false;
42228
+
42226
42229
  for(let resi in resi2rsnum) {
42227
42230
  for(let i = 0, il = resi2rsnum[resi].length; i < il; ++i) {
42228
42231
  if(resi2rsnum[resi][i] == 0) {
@@ -42235,7 +42238,8 @@ class AnnoSnpClinVar {
42235
42238
 
42236
42239
  if(bStartEndRes) {
42237
42240
  let title1 = 'ClinVar', title2 = 'SNP', warning = "", warning2 = "";
42238
- if(!bVirus && ic.organism !== undefined && ic.organism !== 'human' && ic.organism !== 'homo sapiens') {
42241
+
42242
+ if(!bVirus && ic.organism !== undefined && ic.organism.toLowerCase() !== 'human' && ic.organism.toLowerCase() !== 'homo sapiens') {
42239
42243
  warning = " <span style='color:#FFA500'>(from human)</span>";
42240
42244
  warning2 = " <span style='color:#FFA500'>(based on human sequences and mapped to this structure by sequence similarity)</span>";
42241
42245
  }
@@ -42258,7 +42262,11 @@ class AnnoSnpClinVar {
42258
42262
  let pre = altName;
42259
42263
  let snpCnt = 0, clinvarCnt = 0;
42260
42264
  let snpTypeHash = {}, currSnpTypeHash = {};
42261
- for(let i = 1, il = ic.giSeq[chnid].length; i <= il; ++i) {
42265
+ let residHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.chains[chnid]);
42266
+ // for(let i = 1, il = ic.giSeq[chnid].length; i <= il; ++i) {
42267
+ for(let resid in residHash) {
42268
+ let i = resid.split('_')[2];
42269
+
42262
42270
  if(resi2index[i] !== undefined) {
42263
42271
  ++snpCnt;
42264
42272
  let allDiseaseTitle = '';
@@ -42269,7 +42277,11 @@ class AnnoSnpClinVar {
42269
42277
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
42270
42278
  // relax the restriction to show all clinvar
42271
42279
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
42272
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + '); ';
42280
+ diseaseTitle += diseaseArray[k];
42281
+ if(sigArray[k] != '') {
42282
+ diseaseTitle += '(' + sigArray[k] + ')';
42283
+ }
42284
+ diseaseTitle += '; ';
42273
42285
  //}
42274
42286
  }
42275
42287
 
@@ -42335,18 +42347,21 @@ class AnnoSnpClinVar {
42335
42347
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqStartLen[chnid], '-');
42336
42348
  }
42337
42349
 
42338
- for(let i = 1, il = ic.giSeq[chnid].length; i <= il; ++i) {
42350
+ for(let index = 1, indexl = ic.giSeq[chnid].length; index <= indexl; ++index) {
42351
+ let pos = ic.ParserUtilsCls.getResi(chnid, index - 1);
42352
+ let i = pos;
42353
+
42339
42354
  if(bOverview) {
42340
42355
  if(resi2index[i] !== undefined) {
42341
42356
 
42342
42357
  // get the mouse over text
42343
- let cFull = ic.giSeq[chnid][i-1];
42358
+ let cFull = ic.giSeq[chnid][index-1];
42344
42359
  let c = cFull;
42345
42360
  if(cFull.length > 1) {
42346
42361
  c = cFull[0] + '..';
42347
42362
  }
42348
42363
  // 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;
42349
- let pos = ic.ParserUtilsCls.getResi(chnid, i - 1);
42364
+
42350
42365
  let snpTitle = pos + c + '>';
42351
42366
  for(let j = 0, jl = resi2snp[i].length; j < jl; ++j) {
42352
42367
  snpTitle += resi2snp[i][j];
@@ -42357,24 +42372,28 @@ class AnnoSnpClinVar {
42357
42372
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
42358
42373
  // relax the restriction to show all clinvar
42359
42374
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
42360
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + '); ';
42375
+ diseaseTitle += diseaseArray[k];
42376
+ if(sigArray[k] != '') {
42377
+ diseaseTitle += '(' + sigArray[k] + ')';
42378
+ }
42379
+ diseaseTitle += '; ';
42361
42380
  //}
42362
42381
  }
42363
42382
  }
42364
42383
  }
42365
- html += ic.showSeqCls.insertGapOverview(chnid, i-1);
42366
- let emptyWidth = Math.round(ic.seqAnnWidth *(i-1) /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth);
42384
+ html += ic.showSeqCls.insertGapOverview(chnid, index-1);
42385
+ let emptyWidth = Math.round(ic.seqAnnWidth *(index-1) /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth);
42367
42386
  //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);
42368
42387
  //if(emptyWidth < 0) emptyWidth = 0;
42369
42388
  if(bClinvar) {
42370
- if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
42389
+ // if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
42371
42390
  if(emptyWidth >= 0) {
42372
42391
  html += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
42373
42392
  html += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + snpTitle + '">&nbsp;</div>';
42374
42393
  prevEmptyWidth += emptyWidth;
42375
42394
  prevLineWidth += widthPerRes;
42376
42395
  }
42377
- }
42396
+ // }
42378
42397
  }
42379
42398
  else {
42380
42399
  if(emptyWidth > 0) {
@@ -42387,20 +42406,20 @@ class AnnoSnpClinVar {
42387
42406
  }
42388
42407
  }
42389
42408
  else { // detailed view
42390
- html += ic.showSeqCls.insertGap(chnid, i-1, '-');
42409
+ html += ic.showSeqCls.insertGap(chnid, index-1, '-');
42391
42410
 
42392
42411
  if(resi2index[i] !== undefined) {
42393
42412
  if(!bClinvar && line == 1) {
42394
42413
  html += '<span>&dArr;</span>'; // or down triangle &#9660;
42395
42414
  }
42396
42415
  else {
42397
- let cFull = ic.giSeq[chnid][i-1];
42416
+ let cFull = ic.giSeq[chnid][index-1];
42398
42417
  let c = cFull;
42399
42418
  if(cFull.length > 1) {
42400
42419
  c = cFull[0] + '..';
42401
42420
  }
42402
42421
  // 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;
42403
- let pos = ic.ParserUtilsCls.getResi(chnid, i - 1);
42422
+ // let pos = ic.ParserUtilsCls.getResi(chnid, index - 1);
42404
42423
  let snpStr = "", snpTitle = "<div class='snptip'>";
42405
42424
  //var snpType = '';
42406
42425
  let jl = resi2snp[i].length;
@@ -42445,7 +42464,10 @@ class AnnoSnpClinVar {
42445
42464
  else {
42446
42465
  if( j === 0 || j === 1) diseaseStr = 'disease="' + diseaseArray[k] + '"';
42447
42466
  }
42448
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + ')';
42467
+ diseaseTitle += diseaseArray[k];
42468
+ if(sigArray[k] != '') {
42469
+ diseaseTitle += '(' + sigArray[k] + ')';
42470
+ }
42449
42471
  ++index;
42450
42472
  //}
42451
42473
  }
@@ -42515,23 +42537,26 @@ class AnnoSnpClinVar {
42515
42537
  let diseaseArray = resi2disease[i][j].split('; ');
42516
42538
  let sigArray = resi2sig[i][j].split('; ');
42517
42539
  let diseaseTitle = '';
42518
- let index = 0;
42540
+ let indexTmp = 0;
42519
42541
 
42520
42542
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
42521
42543
  // relax the restriction to show all clinvar
42522
42544
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
42523
- if(index > 0) {
42545
+ if(indexTmp > 0) {
42524
42546
  diseaseTitle += '; ';
42525
42547
  }
42526
42548
  else {
42527
42549
  if( j === 0 || j === 1) diseaseStr = 'disease="' + diseaseArray[k] + '"';
42528
42550
  }
42529
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + ')';
42530
- ++index;
42551
+ diseaseTitle += diseaseArray[k];
42552
+ if(sigArray[k] != '') {
42553
+ diseaseTitle += '(' + sigArray[k] + ')';
42554
+ }
42555
+ ++indexTmp;
42531
42556
  //}
42532
42557
  }
42533
42558
 
42534
- if(diseaseTitle != '') {
42559
+ // if(diseaseTitle != '') {
42535
42560
  if(diseaseCnt < shownResCnt) snpStr += resi2snp[i][j];
42536
42561
  snpTitle += pos + c + '>' + resi2snp[i][j];
42537
42562
  //snpType = 'icn3d-clinvar';
@@ -42544,19 +42569,22 @@ class AnnoSnpClinVar {
42544
42569
  }
42545
42570
 
42546
42571
  //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>";
42547
- 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>";
42572
+ snpTitle += "<br>Links: <a href='https://www.ncbi.nlm.nih.gov/clinvar/?term=" + resi2clinAllele[i][j] + "[AlleleID]' style='color:blue' target='_blank'>ClinVar</a>";
42573
+ if(resi2rsnum[i][j] != 0) {
42574
+ 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>";
42575
+ }
42548
42576
  if(j < jl - 1) {
42549
42577
  snpTitle += '<br><br>';
42550
42578
  }
42551
42579
  ++diseaseCnt;
42552
- } // if(diseaseTitle != '') {
42580
+ // } // if(diseaseTitle != '') {
42553
42581
  } // for(let j = start; j < jl && j < end; ++j) {
42554
42582
  //if(diseaseCnt > shownResCnt && line == 3) snpStr += '..';
42555
42583
  if(diseaseCnt > shownResCnt && line == 2) snpStr += '..';
42556
42584
  } // else { // if(bClinvar)
42557
42585
  snpTitle += '</div>';
42558
42586
  if(bClinvar) {
42559
- if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
42587
+ // if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
42560
42588
  if(line == 1) {
42561
42589
  html += '<span>&dArr;</span>'; // or down triangle &#9660;
42562
42590
  }
@@ -42565,13 +42593,14 @@ class AnnoSnpClinVar {
42565
42593
  html += '<span>-</span>';
42566
42594
  }
42567
42595
  else {
42568
- html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
42596
+ // html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
42597
+ html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + snpTypeHash[i] + '">' + snpStr + '</span>';
42569
42598
  }
42570
42599
  }
42571
- }
42572
- else {
42573
- html += '<span>-</span>';
42574
- }
42600
+ // }
42601
+ // else {
42602
+ // html += '<span>-</span>';
42603
+ // }
42575
42604
  }
42576
42605
  else {
42577
42606
  if(snpStr == '' || snpStr == ' ') {
@@ -42579,10 +42608,12 @@ class AnnoSnpClinVar {
42579
42608
  }
42580
42609
  else {
42581
42610
  if(!bSnpOnly) {
42582
- html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
42611
+ // html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
42612
+ html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" ' + diseaseStr + ' class="icn3d-tooltip icn3d-residue ' + snpTypeHash[i] + '">' + snpStr + '</span>';
42583
42613
  }
42584
42614
  else {
42585
- html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
42615
+ // html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" class="icn3d-tooltip icn3d-residue ' + currSnpTypeHash[i] + '">' + snpStr + '</span>';
42616
+ html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" label title="' + snpTitle + '" class="icn3d-tooltip icn3d-residue ' + snpTypeHash[i] + '">' + snpStr + '</span>';
42586
42617
  }
42587
42618
  }
42588
42619
  }
@@ -42638,23 +42669,60 @@ class AnnoSnpClinVar {
42638
42669
  }
42639
42670
  }
42640
42671
 
42672
+ let foundRealSnp = {};
42641
42673
  for(let i = 0, il = lineArray.length; i < il; ++i) {
42642
42674
  //bSnpOnly: false
42643
- //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
42644
- //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
42675
+ //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
42676
+ //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]
42645
42677
  //bSnpOnly: true
42646
- //1310770 13 14 14Y>H 1111111
42678
+ //1310770 13 14 14Y>H 1111111 0
42647
42679
  if(lineArray[i] != '') {
42648
42680
  let fieldArray =(!bSnpOnly || bVirus) ? lineArray[i] : lineArray[i].split('\t');
42649
42681
  let snpStr = fieldArray[3];
42682
+ let rsnum = fieldArray[4];
42683
+ let bFromClinVarDb = false;
42684
+
42685
+ if(bSnpOnly) {
42686
+ if(fieldArray.length > 5) bFromClinVarDb = parseInt(fieldArray[5]);
42687
+ }
42688
+ else {
42689
+ if(fieldArray.length > 8) bFromClinVarDb = parseInt(fieldArray[8]);
42690
+ }
42650
42691
  if(snpStr == prevSnpStr) continue;
42651
42692
  prevSnpStr = snpStr;
42652
- let resiStr = snpStr.substr(0, snpStr.length - 3);
42693
+
42694
+ let posSymbol = snpStr.indexOf('>');
42695
+ // let resiStr = snpStr.substr(0, snpStr.length - 3);
42696
+ let resiStr = snpStr.substr(0, posSymbol - 1);
42653
42697
  let resi = Math.round(resiStr);
42654
42698
 
42699
+ // if the data is From ClinVar Db directly, the residue numbers are PDB residue numbers. Otherwise, the residue numbers are NCBI residue numbers.
42700
+ let realResi = (bFromClinVarDb) ? resi : ic.ParserUtilsCls.getResi(chnid, resi - 1);
42701
+
42702
+ let realSnp = realResi + snpStr.substr(posSymbol - 1);
42703
+ if(foundRealSnp.hasOwnProperty(realSnp)) {
42704
+ continue;
42705
+ }
42706
+ else {
42707
+ foundRealSnp[realSnp] = 1;
42708
+ }
42709
+
42710
+ let snpResn = snpStr.substr(posSymbol - 1, 1);
42711
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chnid + '_' + realResi]);
42712
+ let oneLetterRes = (atom) ? me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3)) : '';
42713
+ if(!bFromClinVarDb) {
42714
+ oneLetterRes = ic.chainsSeq[chnid][resi - 1].name;
42715
+ }
42716
+
42717
+ if(snpResn != oneLetterRes) {
42718
+ // console.error("The snp " + snpStr + " didn't match the residue name " + oneLetterRes);
42719
+ continue;
42720
+ }
42721
+
42655
42722
  if(me.bNode) {
42656
42723
  let obj = {};
42657
- obj[chnid + '_' + resi] = snpStr;
42724
+ // obj[chnid + '_' + resi] = snpStr;
42725
+ obj[chnid + '_' + realResi] = realSnp;
42658
42726
 
42659
42727
  if(bSnpOnly) {
42660
42728
  ic.resid2snp[chnid].push(obj);
@@ -42664,52 +42732,53 @@ class AnnoSnpClinVar {
42664
42732
  }
42665
42733
  }
42666
42734
 
42667
- snpStr.substr(snpStr.length - 3, 1);
42668
- let snpRes = snpStr.substr(snpStr.indexOf('>') + 1); //snpStr.substr(snpStr.length - 1, 1);
42735
+ // let currRes = snpStr.substr(snpStr.length - 3, 1);
42736
+ // let snpRes = snpStr.substr(snpStr.indexOf('>') + 1); //snpStr.substr(snpStr.length - 1, 1);
42737
+ let snpRes = realSnp.substr(realSnp.indexOf('>') + 1); //realSnp.substr(realSnp.length - 1, 1);
42669
42738
  //var rsnum = bSnpOnly ? '' : fieldArray[4];
42670
- let rsnum = fieldArray[4];
42739
+
42671
42740
  let clinAllele = bSnpOnly ? '' : fieldArray[5];
42672
42741
  let disease = bSnpOnly ? '' : fieldArray[6]; // When more than 2+ diseases, they are separated by "; "
42673
42742
  // Some are "not specified", "not provided"
42674
42743
  let clinSig = bSnpOnly ? '' : fieldArray[7]; // Clinical significance, When more than 2+ diseases, they are separated by "; "
42675
42744
  // "*" means terminating codon, "-" means deleted codon
42676
42745
  //if(currRes !== '-' && currRes !== '*' && snpRes !== '-' && snpRes !== '*') {
42677
- let realResi = ic.ParserUtilsCls.getResi(chnid, resi - 1);
42746
+
42678
42747
  // posHash[resi + ic.baseResi[chnid]] = 1;
42679
42748
  // if(disease != '') posClinHash[resi + ic.baseResi[chnid]] = 1;
42680
42749
  posHash[realResi] = 1;
42681
42750
  if(disease != '') posClinHash[realResi] = 1;
42682
- resi2index[resi] = i + 1;
42683
- if(resi2snp[resi] === undefined) {
42684
- resi2snp[resi] = [];
42751
+ resi2index[realResi] = i + 1;
42752
+ if(resi2snp[realResi] === undefined) {
42753
+ resi2snp[realResi] = [];
42685
42754
  }
42686
- resi2snp[resi].push(snpRes);
42687
- if(resi2rsnum[resi] === undefined) {
42688
- resi2rsnum[resi] = [];
42755
+ resi2snp[realResi].push(snpRes);
42756
+ if(resi2rsnum[realResi] === undefined) {
42757
+ resi2rsnum[realResi] = [];
42689
42758
  }
42690
- resi2rsnum[resi].push(rsnum);
42691
- if(resi2clinAllele[resi] === undefined) {
42692
- resi2clinAllele[resi] = [];
42759
+ resi2rsnum[realResi].push(rsnum);
42760
+ if(resi2clinAllele[realResi] === undefined) {
42761
+ resi2clinAllele[realResi] = [];
42693
42762
  }
42694
- resi2clinAllele[resi].push(clinAllele);
42695
- if(resi2disease[resi] === undefined) {
42696
- resi2disease[resi] = [];
42763
+ resi2clinAllele[realResi].push(clinAllele);
42764
+ if(resi2disease[realResi] === undefined) {
42765
+ resi2disease[realResi] = [];
42697
42766
  }
42698
- resi2disease[resi].push(disease);
42767
+ resi2disease[realResi].push(disease);
42699
42768
  if(disease != '') {
42700
- if(ic.resi2disease_nonempty[chnid][resi] === undefined) {
42701
- ic.resi2disease_nonempty[chnid][resi] = [];
42769
+ if(ic.resi2disease_nonempty[chnid][realResi] === undefined) {
42770
+ ic.resi2disease_nonempty[chnid][realResi] = [];
42702
42771
  }
42703
- ic.resi2disease_nonempty[chnid][resi].push(disease);
42772
+ ic.resi2disease_nonempty[chnid][realResi].push(disease);
42704
42773
  }
42705
- if(resi2sig[resi] === undefined) {
42706
- resi2sig[resi] = [];
42774
+ if(resi2sig[realResi] === undefined) {
42775
+ resi2sig[realResi] = [];
42707
42776
  }
42708
- resi2sig[resi].push(clinSig);
42777
+ resi2sig[realResi].push(clinSig);
42709
42778
  //}
42710
42779
  }
42711
42780
  }
42712
-
42781
+
42713
42782
  let posarray = Object.keys(posHash);
42714
42783
  let posClinArray = Object.keys(posClinHash);
42715
42784
  if(bSnpOnly) {
@@ -42728,7 +42797,7 @@ class AnnoSnpClinVar {
42728
42797
  $("#" + ic.pre + 'ov_snp_' + chnid).html(html2);
42729
42798
  $("#" + ic.pre + 'tt_snp_' + chnid).html(html3);
42730
42799
  }
42731
- else {
42800
+ else {
42732
42801
  //if(!bSnpOnly && ic.bClinvarCnt) {
42733
42802
  let bClinvar = true;
42734
42803
  htmlClinvar += this.getSnpLine(1, 2, resi2snp, resi2rsnum, resi2clinAllele, resi2disease, resi2index, resi2sig, posarray, posClinArray, 1, chnid, false, bClinvar, undefined, bSnpOnly);
@@ -42761,9 +42830,12 @@ class AnnoSnpClinVar {
42761
42830
  }
42762
42831
  async showClinvarPart2(chnid, chnidBase, gi) { let ic = this.icn3d, me = ic.icn3dui;
42763
42832
  let thisClass = this;
42833
+
42834
+ if(!ic.chainid2uniport) await this.getUniprotForAllStructures();
42835
+
42764
42836
  //var url = "https://www.ncbi.nlm.nih.gov/projects/SNP/beVarSearch_mt.cgi?appname=iCn3D&format=bed&report=pdb2bed&acc=" + chnidBase;
42765
42837
  //var url = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/clinvar.txt";
42766
- let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_clinvar=" + chnidBase;
42838
+ let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_clinvar=" + chnidBase + "&uniprot=" + ic.chainid2uniport[chnidBase];
42767
42839
  if(ic.chainsGene[chnid] && ic.chainsGene[chnid].geneSymbol) {
42768
42840
  url += "&gene=" + ic.chainsGene[chnid].geneSymbol;
42769
42841
  }
@@ -42783,15 +42855,43 @@ class AnnoSnpClinVar {
42783
42855
  }
42784
42856
  catch(err) {
42785
42857
  thisClass.processNoClinvar(chnid);
42786
- ///// if(ic.deferredClinvar !== undefined) ic.deferredClinvar.resolve();
42787
42858
  return;
42788
42859
  }
42789
42860
  }
42790
42861
 
42862
+ async getUniprotForAllStructures() { let ic = this.icn3d, me = ic.icn3dui;
42863
+ ic.chainid2uniport = {};
42864
+
42865
+ // get UniProt ID ffrom chainid
42866
+ for(let structure in ic.structures) {
42867
+ if(structure.length > 5) {
42868
+ let chainidArray = ic.structures[structure];
42869
+ for(let i = 0, il = chainidArray.length; i < il; ++i) {
42870
+ ic.chainid2uniport[chainidArray[i]] = structure;
42871
+ }
42872
+ }
42873
+ else {
42874
+ let structLower = structure.toLowerCase();
42875
+ let url = "https://www.ebi.ac.uk/pdbe/api/mappings/uniprot/" + structLower;
42876
+ let dataJson = await me.getAjaxPromise(url, 'json');
42877
+ let data= dataJson[structLower]['UniProt'];
42878
+ for(let uniprot in data) {
42879
+ let chainDataArray = data[uniprot].mappings;
42880
+ for(let i = 0, il = chainDataArray.length; i < il; ++i) {
42881
+ let chain = chainDataArray[i].chain_id;
42882
+ ic.chainid2uniport[structure + '_' + chain] = uniprot;
42883
+ }
42884
+ }
42885
+ }
42886
+ }
42887
+ }
42888
+
42791
42889
  async showSnpPart2(chnid, chnidBase, gi) { let ic = this.icn3d, me = ic.icn3dui;
42792
42890
  let thisClass = this;
42891
+ if(!ic.chainid2uniport) await this.getUniprotForAllStructures();
42892
+
42793
42893
  if(gi !== undefined) {
42794
- let url4 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_snp=" + chnidBase;
42894
+ let url4 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid_snp=" + chnidBase + "&uniprot=" + ic.chainid2uniport[chnidBase];
42795
42895
  if(ic.chainsGene[chnid] && ic.chainsGene[chnid].geneSymbol) {
42796
42896
  url4 += "&gene=" + ic.chainsGene[chnid].geneSymbol;
42797
42897
  }
@@ -81990,7 +82090,7 @@ class iCn3DUI {
81990
82090
  //even when multiple iCn3D viewers are shown together.
81991
82091
  this.pre = this.cfg.divid + "_";
81992
82092
 
81993
- this.REVISION = '3.34.1';
82093
+ this.REVISION = '3.35.0';
81994
82094
 
81995
82095
  // In nodejs, iCn3D defines "window = {navigator: {}}"
81996
82096
  this.bNode = (Object.keys(window).length < 2) ? true : false;