icn3d 3.34.6 → 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
@@ -43126,6 +43126,7 @@ class AnnoSnpClinVar {
43126
43126
  let altName = bClinvar ? 'clinvar' : 'snp';
43127
43127
  // determine whether the SNPis from virus directly
43128
43128
  let bVirus = false;
43129
+
43129
43130
  for(let resi in resi2rsnum) {
43130
43131
  for(let i = 0, il = resi2rsnum[resi].length; i < il; ++i) {
43131
43132
  if(resi2rsnum[resi][i] == 0) {
@@ -43138,7 +43139,8 @@ class AnnoSnpClinVar {
43138
43139
 
43139
43140
  if(bStartEndRes) {
43140
43141
  let title1 = 'ClinVar', title2 = 'SNP', warning = "", warning2 = "";
43141
- 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') {
43142
43144
  warning = " <span style='color:#FFA500'>(from human)</span>";
43143
43145
  warning2 = " <span style='color:#FFA500'>(based on human sequences and mapped to this structure by sequence similarity)</span>";
43144
43146
  }
@@ -43161,7 +43163,11 @@ class AnnoSnpClinVar {
43161
43163
  let pre = altName;
43162
43164
  let snpCnt = 0, clinvarCnt = 0;
43163
43165
  let snpTypeHash = {}, currSnpTypeHash = {};
43164
- 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
+
43165
43171
  if(resi2index[i] !== undefined) {
43166
43172
  ++snpCnt;
43167
43173
  let allDiseaseTitle = '';
@@ -43172,7 +43178,11 @@ class AnnoSnpClinVar {
43172
43178
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
43173
43179
  // relax the restriction to show all clinvar
43174
43180
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
43175
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + '); ';
43181
+ diseaseTitle += diseaseArray[k];
43182
+ if(sigArray[k] != '') {
43183
+ diseaseTitle += '(' + sigArray[k] + ')';
43184
+ }
43185
+ diseaseTitle += '; ';
43176
43186
  //}
43177
43187
  }
43178
43188
 
@@ -43238,18 +43248,21 @@ class AnnoSnpClinVar {
43238
43248
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqStartLen[chnid], '-');
43239
43249
  }
43240
43250
 
43241
- 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
+
43242
43255
  if(bOverview) {
43243
43256
  if(resi2index[i] !== undefined) {
43244
43257
 
43245
43258
  // get the mouse over text
43246
- let cFull = ic.giSeq[chnid][i-1];
43259
+ let cFull = ic.giSeq[chnid][index-1];
43247
43260
  let c = cFull;
43248
43261
  if(cFull.length > 1) {
43249
43262
  c = cFull[0] + '..';
43250
43263
  }
43251
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;
43252
- let pos = ic.ParserUtilsCls.getResi(chnid, i - 1);
43265
+
43253
43266
  let snpTitle = pos + c + '>';
43254
43267
  for(let j = 0, jl = resi2snp[i].length; j < jl; ++j) {
43255
43268
  snpTitle += resi2snp[i][j];
@@ -43260,24 +43273,28 @@ class AnnoSnpClinVar {
43260
43273
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
43261
43274
  // relax the restriction to show all clinvar
43262
43275
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
43263
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + '); ';
43276
+ diseaseTitle += diseaseArray[k];
43277
+ if(sigArray[k] != '') {
43278
+ diseaseTitle += '(' + sigArray[k] + ')';
43279
+ }
43280
+ diseaseTitle += '; ';
43264
43281
  //}
43265
43282
  }
43266
43283
  }
43267
43284
  }
43268
- html += ic.showSeqCls.insertGapOverview(chnid, i-1);
43269
- 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);
43270
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);
43271
43288
  //if(emptyWidth < 0) emptyWidth = 0;
43272
43289
  if(bClinvar) {
43273
- if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43290
+ // if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43274
43291
  if(emptyWidth >= 0) {
43275
43292
  html += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
43276
43293
  html += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + snpTitle + '">&nbsp;</div>';
43277
43294
  prevEmptyWidth += emptyWidth;
43278
43295
  prevLineWidth += widthPerRes;
43279
43296
  }
43280
- }
43297
+ // }
43281
43298
  }
43282
43299
  else {
43283
43300
  if(emptyWidth > 0) {
@@ -43290,20 +43307,20 @@ class AnnoSnpClinVar {
43290
43307
  }
43291
43308
  }
43292
43309
  else { // detailed view
43293
- html += ic.showSeqCls.insertGap(chnid, i-1, '-');
43310
+ html += ic.showSeqCls.insertGap(chnid, index-1, '-');
43294
43311
 
43295
43312
  if(resi2index[i] !== undefined) {
43296
43313
  if(!bClinvar && line == 1) {
43297
43314
  html += '<span>&dArr;</span>'; // or down triangle &#9660;
43298
43315
  }
43299
43316
  else {
43300
- let cFull = ic.giSeq[chnid][i-1];
43317
+ let cFull = ic.giSeq[chnid][index-1];
43301
43318
  let c = cFull;
43302
43319
  if(cFull.length > 1) {
43303
43320
  c = cFull[0] + '..';
43304
43321
  }
43305
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;
43306
- let pos = ic.ParserUtilsCls.getResi(chnid, i - 1);
43323
+ // let pos = ic.ParserUtilsCls.getResi(chnid, index - 1);
43307
43324
  let snpStr = "", snpTitle = "<div class='snptip'>";
43308
43325
  //var snpType = '';
43309
43326
  let jl = resi2snp[i].length;
@@ -43348,7 +43365,10 @@ class AnnoSnpClinVar {
43348
43365
  else {
43349
43366
  if( j === 0 || j === 1) diseaseStr = 'disease="' + diseaseArray[k] + '"';
43350
43367
  }
43351
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + ')';
43368
+ diseaseTitle += diseaseArray[k];
43369
+ if(sigArray[k] != '') {
43370
+ diseaseTitle += '(' + sigArray[k] + ')';
43371
+ }
43352
43372
  ++index;
43353
43373
  //}
43354
43374
  }
@@ -43418,23 +43438,26 @@ class AnnoSnpClinVar {
43418
43438
  let diseaseArray = resi2disease[i][j].split('; ');
43419
43439
  let sigArray = resi2sig[i][j].split('; ');
43420
43440
  let diseaseTitle = '';
43421
- let index = 0;
43441
+ let indexTmp = 0;
43422
43442
 
43423
43443
  for(let k = 0, kl = diseaseArray.length; k < kl; ++k) {
43424
43444
  // relax the restriction to show all clinvar
43425
43445
  //if(diseaseArray[k] != '' && diseaseArray[k] != 'not specified' && diseaseArray[k] != 'not provided') {
43426
- if(index > 0) {
43446
+ if(indexTmp > 0) {
43427
43447
  diseaseTitle += '; ';
43428
43448
  }
43429
43449
  else {
43430
43450
  if( j === 0 || j === 1) diseaseStr = 'disease="' + diseaseArray[k] + '"';
43431
43451
  }
43432
- diseaseTitle += diseaseArray[k] + '(' + sigArray[k] + ')';
43433
- ++index;
43452
+ diseaseTitle += diseaseArray[k];
43453
+ if(sigArray[k] != '') {
43454
+ diseaseTitle += '(' + sigArray[k] + ')';
43455
+ }
43456
+ ++indexTmp;
43434
43457
  //}
43435
43458
  }
43436
43459
 
43437
- if(diseaseTitle != '') {
43460
+ // if(diseaseTitle != '') {
43438
43461
  if(diseaseCnt < shownResCnt) snpStr += resi2snp[i][j];
43439
43462
  snpTitle += pos + c + '>' + resi2snp[i][j];
43440
43463
  //snpType = 'icn3d-clinvar';
@@ -43447,19 +43470,22 @@ class AnnoSnpClinVar {
43447
43470
  }
43448
43471
 
43449
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>";
43450
- 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
+ }
43451
43477
  if(j < jl - 1) {
43452
43478
  snpTitle += '<br><br>';
43453
43479
  }
43454
43480
  ++diseaseCnt;
43455
- } // if(diseaseTitle != '') {
43481
+ // } // if(diseaseTitle != '') {
43456
43482
  } // for(let j = start; j < jl && j < end; ++j) {
43457
43483
  //if(diseaseCnt > shownResCnt && line == 3) snpStr += '..';
43458
43484
  if(diseaseCnt > shownResCnt && line == 2) snpStr += '..';
43459
43485
  } // else { // if(bClinvar)
43460
43486
  snpTitle += '</div>';
43461
43487
  if(bClinvar) {
43462
- if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43488
+ // if(snpTypeHash[i] == 'icn3d-clinvar' || snpTypeHash[i] == 'icn3d-clinvar-path') {
43463
43489
  if(line == 1) {
43464
43490
  html += '<span>&dArr;</span>'; // or down triangle &#9660;
43465
43491
  }
@@ -43468,13 +43494,14 @@ class AnnoSnpClinVar {
43468
43494
  html += '<span>-</span>';
43469
43495
  }
43470
43496
  else {
43471
- 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>';
43472
43499
  }
43473
43500
  }
43474
- }
43475
- else {
43476
- html += '<span>-</span>';
43477
- }
43501
+ // }
43502
+ // else {
43503
+ // html += '<span>-</span>';
43504
+ // }
43478
43505
  }
43479
43506
  else {
43480
43507
  if(snpStr == '' || snpStr == ' ') {
@@ -43482,10 +43509,12 @@ class AnnoSnpClinVar {
43482
43509
  }
43483
43510
  else {
43484
43511
  if(!bSnpOnly) {
43485
- 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>';
43486
43514
  }
43487
43515
  else {
43488
- 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>';
43489
43518
  }
43490
43519
  }
43491
43520
  }
@@ -43541,23 +43570,60 @@ class AnnoSnpClinVar {
43541
43570
  }
43542
43571
  }
43543
43572
 
43573
+ let foundRealSnp = {};
43544
43574
  for(let i = 0, il = lineArray.length; i < il; ++i) {
43545
43575
  //bSnpOnly: false
43546
- //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
43547
- //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]
43548
43578
  //bSnpOnly: true
43549
- //1310770 13 14 14Y>H 1111111
43579
+ //1310770 13 14 14Y>H 1111111 0
43550
43580
  if(lineArray[i] != '') {
43551
43581
  let fieldArray =(!bSnpOnly || bVirus) ? lineArray[i] : lineArray[i].split('\t');
43552
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
+ }
43553
43592
  if(snpStr == prevSnpStr) continue;
43554
43593
  prevSnpStr = snpStr;
43555
- 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);
43556
43598
  let resi = Math.round(resiStr);
43557
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
+
43558
43623
  if(me.bNode) {
43559
43624
  let obj = {};
43560
- obj[chnid + '_' + resi] = snpStr;
43625
+ // obj[chnid + '_' + resi] = snpStr;
43626
+ obj[chnid + '_' + realResi] = realSnp;
43561
43627
 
43562
43628
  if(bSnpOnly) {
43563
43629
  ic.resid2snp[chnid].push(obj);
@@ -43567,52 +43633,53 @@ class AnnoSnpClinVar {
43567
43633
  }
43568
43634
  }
43569
43635
 
43570
- snpStr.substr(snpStr.length - 3, 1);
43571
- 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);
43572
43639
  //var rsnum = bSnpOnly ? '' : fieldArray[4];
43573
- let rsnum = fieldArray[4];
43640
+
43574
43641
  let clinAllele = bSnpOnly ? '' : fieldArray[5];
43575
43642
  let disease = bSnpOnly ? '' : fieldArray[6]; // When more than 2+ diseases, they are separated by "; "
43576
43643
  // Some are "not specified", "not provided"
43577
43644
  let clinSig = bSnpOnly ? '' : fieldArray[7]; // Clinical significance, When more than 2+ diseases, they are separated by "; "
43578
43645
  // "*" means terminating codon, "-" means deleted codon
43579
43646
  //if(currRes !== '-' && currRes !== '*' && snpRes !== '-' && snpRes !== '*') {
43580
- let realResi = ic.ParserUtilsCls.getResi(chnid, resi - 1);
43647
+
43581
43648
  // posHash[resi + ic.baseResi[chnid]] = 1;
43582
43649
  // if(disease != '') posClinHash[resi + ic.baseResi[chnid]] = 1;
43583
43650
  posHash[realResi] = 1;
43584
43651
  if(disease != '') posClinHash[realResi] = 1;
43585
- resi2index[resi] = i + 1;
43586
- if(resi2snp[resi] === undefined) {
43587
- resi2snp[resi] = [];
43652
+ resi2index[realResi] = i + 1;
43653
+ if(resi2snp[realResi] === undefined) {
43654
+ resi2snp[realResi] = [];
43588
43655
  }
43589
- resi2snp[resi].push(snpRes);
43590
- if(resi2rsnum[resi] === undefined) {
43591
- resi2rsnum[resi] = [];
43656
+ resi2snp[realResi].push(snpRes);
43657
+ if(resi2rsnum[realResi] === undefined) {
43658
+ resi2rsnum[realResi] = [];
43592
43659
  }
43593
- resi2rsnum[resi].push(rsnum);
43594
- if(resi2clinAllele[resi] === undefined) {
43595
- resi2clinAllele[resi] = [];
43660
+ resi2rsnum[realResi].push(rsnum);
43661
+ if(resi2clinAllele[realResi] === undefined) {
43662
+ resi2clinAllele[realResi] = [];
43596
43663
  }
43597
- resi2clinAllele[resi].push(clinAllele);
43598
- if(resi2disease[resi] === undefined) {
43599
- resi2disease[resi] = [];
43664
+ resi2clinAllele[realResi].push(clinAllele);
43665
+ if(resi2disease[realResi] === undefined) {
43666
+ resi2disease[realResi] = [];
43600
43667
  }
43601
- resi2disease[resi].push(disease);
43668
+ resi2disease[realResi].push(disease);
43602
43669
  if(disease != '') {
43603
- if(ic.resi2disease_nonempty[chnid][resi] === undefined) {
43604
- ic.resi2disease_nonempty[chnid][resi] = [];
43670
+ if(ic.resi2disease_nonempty[chnid][realResi] === undefined) {
43671
+ ic.resi2disease_nonempty[chnid][realResi] = [];
43605
43672
  }
43606
- ic.resi2disease_nonempty[chnid][resi].push(disease);
43673
+ ic.resi2disease_nonempty[chnid][realResi].push(disease);
43607
43674
  }
43608
- if(resi2sig[resi] === undefined) {
43609
- resi2sig[resi] = [];
43675
+ if(resi2sig[realResi] === undefined) {
43676
+ resi2sig[realResi] = [];
43610
43677
  }
43611
- resi2sig[resi].push(clinSig);
43678
+ resi2sig[realResi].push(clinSig);
43612
43679
  //}
43613
43680
  }
43614
43681
  }
43615
-
43682
+
43616
43683
  let posarray = Object.keys(posHash);
43617
43684
  let posClinArray = Object.keys(posClinHash);
43618
43685
  if(bSnpOnly) {
@@ -43631,7 +43698,7 @@ class AnnoSnpClinVar {
43631
43698
  $("#" + ic.pre + 'ov_snp_' + chnid).html(html2);
43632
43699
  $("#" + ic.pre + 'tt_snp_' + chnid).html(html3);
43633
43700
  }
43634
- else {
43701
+ else {
43635
43702
  //if(!bSnpOnly && ic.bClinvarCnt) {
43636
43703
  let bClinvar = true;
43637
43704
  htmlClinvar += this.getSnpLine(1, 2, resi2snp, resi2rsnum, resi2clinAllele, resi2disease, resi2index, resi2sig, posarray, posClinArray, 1, chnid, false, bClinvar, undefined, bSnpOnly);
@@ -43664,9 +43731,12 @@ class AnnoSnpClinVar {
43664
43731
  }
43665
43732
  async showClinvarPart2(chnid, chnidBase, gi) { let ic = this.icn3d, me = ic.icn3dui;
43666
43733
  let thisClass = this;
43734
+
43735
+ if(!ic.chainid2uniport) await this.getUniprotForAllStructures();
43736
+
43667
43737
  //var url = "https://www.ncbi.nlm.nih.gov/projects/SNP/beVarSearch_mt.cgi?appname=iCn3D&format=bed&report=pdb2bed&acc=" + chnidBase;
43668
43738
  //var url = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/clinvar.txt";
43669
- 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];
43670
43740
  if(ic.chainsGene[chnid] && ic.chainsGene[chnid].geneSymbol) {
43671
43741
  url += "&gene=" + ic.chainsGene[chnid].geneSymbol;
43672
43742
  }
@@ -43686,15 +43756,43 @@ class AnnoSnpClinVar {
43686
43756
  }
43687
43757
  catch(err) {
43688
43758
  thisClass.processNoClinvar(chnid);
43689
- ///// if(ic.deferredClinvar !== undefined) ic.deferredClinvar.resolve();
43690
43759
  return;
43691
43760
  }
43692
43761
  }
43693
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
+
43694
43790
  async showSnpPart2(chnid, chnidBase, gi) { let ic = this.icn3d, me = ic.icn3dui;
43695
43791
  let thisClass = this;
43792
+ if(!ic.chainid2uniport) await this.getUniprotForAllStructures();
43793
+
43696
43794
  if(gi !== undefined) {
43697
- 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];
43698
43796
  if(ic.chainsGene[chnid] && ic.chainsGene[chnid].geneSymbol) {
43699
43797
  url4 += "&gene=" + ic.chainsGene[chnid].geneSymbol;
43700
43798
  }
@@ -82893,7 +82991,7 @@ class iCn3DUI {
82893
82991
  //even when multiple iCn3D viewers are shown together.
82894
82992
  this.pre = this.cfg.divid + "_";
82895
82993
 
82896
- this.REVISION = '3.34.1';
82994
+ this.REVISION = '3.35.0';
82897
82995
 
82898
82996
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82899
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.6",
3
+ "version": "3.35.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {