react-mutation-mapper 0.8.33 → 0.8.34

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/dist/index.js CHANGED
@@ -24,7 +24,8 @@ var Select = require('react-select');
24
24
  var Select__default = _interopDefault(Select);
25
25
  var $ = _interopDefault(require('jquery'));
26
26
  var Slider = _interopDefault(require('react-rangeslider'));
27
- var request = _interopDefault(require('superagent'));
27
+ var request = require('superagent');
28
+ var request__default = _interopDefault(request);
28
29
  var memoize = _interopDefault(require('memoize-weak-decorator'));
29
30
  var mobxpromise = require('mobxpromise');
30
31
 
@@ -8470,8 +8471,24 @@ var ExonTrack = /** @class */ (function (_super) {
8470
8471
  enumerable: false,
8471
8472
  configurable: true
8472
8473
  });
8474
+ Object.defineProperty(ExonTrack.prototype, "chromosome", {
8475
+ get: function () {
8476
+ var _a, _b;
8477
+ return (_b = (_a = this.props.store.ensemblTranscriptLookUp.result) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.seq_region_name;
8478
+ },
8479
+ enumerable: false,
8480
+ configurable: true
8481
+ });
8482
+ Object.defineProperty(ExonTrack.prototype, "genomeBuild", {
8483
+ get: function () {
8484
+ return this.props.store.genomeBuild;
8485
+ },
8486
+ enumerable: false,
8487
+ configurable: true
8488
+ });
8473
8489
  Object.defineProperty(ExonTrack.prototype, "exonSpecs", {
8474
8490
  get: function () {
8491
+ var _this = this;
8475
8492
  if (!this.transcriptId || !this.transcript) {
8476
8493
  return [];
8477
8494
  }
@@ -8485,10 +8502,15 @@ var ExonTrack = /** @class */ (function (_super) {
8485
8502
  ? exonInfo.map(function (exon, index) {
8486
8503
  var startCodon = exon.start;
8487
8504
  var endCodon = exon.start + exon.length;
8488
- var exonLength = exon.length;
8489
- var stringStart = cbioportalUtils.formatExonLocation(startCodon, index);
8490
- var stringEnd = cbioportalUtils.formatExonLocation(endCodon);
8491
- var stringLength = cbioportalUtils.formatExonLength(exonLength);
8505
+ var exonStartLocation = cbioportalUtils.formatExonLocation(startCodon, index);
8506
+ var exonEndLocation = cbioportalUtils.formatExonLocation(endCodon);
8507
+ var exonLength = cbioportalUtils.formatExonLength(exon.length);
8508
+ var link = _this.chromosome
8509
+ ? "https://igv.org/app/?locus=chr" + _this.chromosome + ":" + exon.genomicLocationStart + "-" + exon.genomicLocationEnd + "&genome=" + _this.genomeBuild
8510
+ : 'https://igv.org';
8511
+ var linkText = _this.chromosome
8512
+ ? _this.genomeBuild + ":chr" + _this.chromosome + ":" + exon.genomicLocationStart + " - " + exon.genomicLocationEnd
8513
+ : exon.genomicLocationStart + " - " + exon.genomicLocationEnd;
8492
8514
  return {
8493
8515
  color: altColors[index % 2],
8494
8516
  startCodon: startCodon,
@@ -8500,14 +8522,41 @@ var ExonTrack = /** @class */ (function (_super) {
8500
8522
  " Exon ",
8501
8523
  exon.rank,
8502
8524
  " "),
8503
- "Start: ",
8504
- stringStart,
8525
+ "Start: Nucleotide",
8526
+ ' ',
8527
+ React.createElement("strong", null, exonStartLocation.nucleotideLocation),
8528
+ ' ',
8529
+ "of amino acid",
8530
+ ' ',
8531
+ React.createElement("strong", null, exonStartLocation.aminoAcidLocation),
8532
+ React.createElement("br", null),
8533
+ "End: Nucleotide",
8534
+ ' ',
8535
+ React.createElement("strong", null, exonEndLocation.nucleotideLocation),
8536
+ ' ',
8537
+ "of amino acid",
8538
+ ' ',
8539
+ React.createElement("strong", null, exonEndLocation.aminoAcidLocation),
8505
8540
  React.createElement("br", null),
8506
- "End: ",
8507
- stringEnd,
8541
+ "Length:",
8542
+ ' ',
8543
+ React.createElement("strong", null, exonLength.aminoAcidLength),
8544
+ ' ',
8545
+ "amino acids",
8546
+ ' ',
8547
+ exonLength.nucleotideLength && (React.createElement(React.Fragment, null,
8548
+ ' ',
8549
+ "and",
8550
+ ' ',
8551
+ React.createElement("strong", null, exonLength.nucleotideLength),
8552
+ ' ',
8553
+ "nucleotides")),
8508
8554
  React.createElement("br", null),
8509
- "Length: ",
8510
- stringLength)),
8555
+ "Genomic location:", " ",
8556
+ React.createElement("a", { target: "_blank", href: link, rel: "noopener noreferrer" },
8557
+ React.createElement(React.Fragment, null,
8558
+ linkText, " ",
8559
+ React.createElement("i", { className: "fa fa-external-link" }))))),
8511
8560
  };
8512
8561
  })
8513
8562
  : [];
@@ -8538,6 +8587,12 @@ var ExonTrack = /** @class */ (function (_super) {
8538
8587
  __decorate([
8539
8588
  mobx.computed
8540
8589
  ], ExonTrack.prototype, "transcript", null);
8590
+ __decorate([
8591
+ mobx.computed
8592
+ ], ExonTrack.prototype, "chromosome", null);
8593
+ __decorate([
8594
+ mobx.computed
8595
+ ], ExonTrack.prototype, "genomeBuild", null);
8541
8596
  __decorate([
8542
8597
  mobx.computed
8543
8598
  ], ExonTrack.prototype, "exonSpecs", null);
@@ -10158,7 +10213,7 @@ var DefaultPubMedCache = /** @class */ (function (_super) {
10158
10213
  switch (_a.label) {
10159
10214
  case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
10160
10215
  // TODO duplicate code from cbioportal-frontend
10161
- request
10216
+ request__default
10162
10217
  .post('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&retmode=json')
10163
10218
  .type('form')
10164
10219
  .send({ id: query })
@@ -10192,7 +10247,7 @@ var DefaultPubMedCache = /** @class */ (function (_super) {
10192
10247
 
10193
10248
  function fetchMutationAlignerLink(pfamDomainId, mutationAlignerUrlTemplate) {
10194
10249
  if (mutationAlignerUrlTemplate === void 0) { mutationAlignerUrlTemplate = DEFAULT_MUTATION_ALIGNER_PROXY_URL_TEMPLATE; }
10195
- return request
10250
+ return request__default
10196
10251
  .get(getUrl(mutationAlignerUrlTemplate, { pfamDomainId: pfamDomainId }))
10197
10252
  .accept('application/json');
10198
10253
  }
@@ -10568,7 +10623,7 @@ var DefaultMutationMapperDataFetcher = /** @class */ (function () {
10568
10623
  var myGeneData;
10569
10624
  return __generator(this, function (_a) {
10570
10625
  switch (_a.label) {
10571
- case 0: return [4 /*yield*/, request.get(getUrl(this.config.myGeneUrlTemplate || DEFAULT_MY_GENE_URL_TEMPLATE, { entrezGeneId: entrezGeneId }))];
10626
+ case 0: return [4 /*yield*/, request__default.get(getUrl(this.config.myGeneUrlTemplate || DEFAULT_MY_GENE_URL_TEMPLATE, { entrezGeneId: entrezGeneId }))];
10572
10627
  case 1:
10573
10628
  myGeneData = _a.sent();
10574
10629
  return [2 /*return*/, JSON.parse(myGeneData.text).uniprot['Swiss-Prot']];
@@ -10586,7 +10641,7 @@ var DefaultMutationMapperDataFetcher = /** @class */ (function () {
10586
10641
  var uniprotData;
10587
10642
  return __generator(this, function (_a) {
10588
10643
  switch (_a.label) {
10589
- case 0: return [4 /*yield*/, request.get(getUrl(this.config.uniprotIdUrlTemplate ||
10644
+ case 0: return [4 /*yield*/, request__default.get(getUrl(this.config.uniprotIdUrlTemplate ||
10590
10645
  DEFAULT_UNIPROT_ID_URL_TEMPLATE, { swissProtAccession: swissProtAccession }))];
10591
10646
  case 1:
10592
10647
  uniprotData = _a.sent();
@@ -10744,7 +10799,7 @@ var DefaultMutationMapperDataFetcher = /** @class */ (function () {
10744
10799
  switch (_a.label) {
10745
10800
  case 0:
10746
10801
  if (!swissProtId) return [3 /*break*/, 2];
10747
- return [4 /*yield*/, request.get(getUrl("https://www.ebi.ac.uk/proteins/api/features/<%= uniprotAccession %>?categories=" + category.join(','), { uniprotAccession: swissProtId }))];
10802
+ return [4 /*yield*/, request__default.get(getUrl("https://www.ebi.ac.uk/proteins/api/features/<%= uniprotAccession %>?categories=" + category.join(','), { uniprotAccession: swissProtId }))];
10748
10803
  case 1:
10749
10804
  uniprotData = _a.sent();
10750
10805
  featureList = JSON.parse(uniprotData.text);
@@ -11727,6 +11782,28 @@ var DefaultMutationMapperStore = /** @class */ (function () {
11727
11782
  },
11728
11783
  })
11729
11784
  });
11785
+ Object.defineProperty(this, "ensemblTranscriptLookUp", {
11786
+ enumerable: true,
11787
+ configurable: true,
11788
+ writable: true,
11789
+ value: cbioportalFrontendCommons.remoteData({
11790
+ await: function () { return [_this.activeTranscript]; },
11791
+ invoke: function () { return __awaiter(_this, void 0, void 0, function () {
11792
+ var ensemblTranscriptLookUpLink;
11793
+ return __generator(this, function (_a) {
11794
+ ensemblTranscriptLookUpLink = this.genomeBuild === 'hg19'
11795
+ ? "https://grch37.rest.ensembl.org/lookup/id/" + this.activeTranscript.result + "?content-type=application/json"
11796
+ : "https://rest.ensembl.org/lookup/id/" + this.activeTranscript.result + "?content-type=application/json";
11797
+ return [2 /*return*/, this.activeTranscript.result
11798
+ ? request.get(ensemblTranscriptLookUpLink)
11799
+ : undefined];
11800
+ });
11801
+ }); },
11802
+ onError: function () {
11803
+ // fail silently, leave the error handling responsibility to the data consumer
11804
+ },
11805
+ })
11806
+ });
11730
11807
  mobx.makeObservable(this);
11731
11808
  }
11732
11809
  Object.defineProperty(DefaultMutationMapperStore.prototype, "selectedTranscript", {
@@ -12036,6 +12113,13 @@ var DefaultMutationMapperStore = /** @class */ (function () {
12036
12113
  0);
12037
12114
  }
12038
12115
  });
12116
+ Object.defineProperty(DefaultMutationMapperStore.prototype, "genomeBuild", {
12117
+ get: function () {
12118
+ return this.config.genomeBuild || 'hg19';
12119
+ },
12120
+ enumerable: false,
12121
+ configurable: true
12122
+ });
12039
12123
  __decorate([
12040
12124
  mobx.observable
12041
12125
  ], DefaultMutationMapperStore.prototype, "_selectedTranscript", void 0);
@@ -12106,6 +12190,9 @@ var DefaultMutationMapperStore = /** @class */ (function () {
12106
12190
  __decorate([
12107
12191
  autobind
12108
12192
  ], DefaultMutationMapperStore.prototype, "getDefaultEntrezGeneId", null);
12193
+ __decorate([
12194
+ mobx.computed
12195
+ ], DefaultMutationMapperStore.prototype, "genomeBuild", null);
12109
12196
  return DefaultMutationMapperStore;
12110
12197
  }());
12111
12198