igv 2.12.1 → 2.12.2

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/README.md CHANGED
@@ -12,19 +12,19 @@ Below are examples and a quickstart guide. See the [Wiki](https://github.com/ig
12
12
 
13
13
  # Examples
14
14
 
15
- ***[Alignments](https://igv.org/web/release/2.12.1/examples/cram-vcf.html)***
15
+ ***[Alignments](https://igv.org/web/release/2.12.2/examples/cram-vcf.html)***
16
16
 
17
- ***[Interactions](https://igv.org/web/release/2.12.1/examples/interact.html)***
17
+ ***[Interactions](https://igv.org/web/release/2.12.2/examples/interact.html)***
18
18
 
19
- ***[Copy number](https://igv.org/web/release/2.12.1/examples/copyNumber.html)***
19
+ ***[Copy number](https://igv.org/web/release/2.12.2/examples/copyNumber.html)***
20
20
 
21
- ***[Multiple regions](https://igv.org/web/release/2.12.1/examples/multi-locus.html)***
21
+ ***[Multiple regions](https://igv.org/web/release/2.12.2/examples/multi-locus.html)***
22
22
 
23
- ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.12.1/examples/maf-tcga.html)***
23
+ ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.12.2/examples/maf-tcga.html)***
24
24
 
25
- ***[Variant color options](https://igv.org/web/release/2.12.1/examples/variant-colors.html)***
25
+ ***[Variant color options](https://igv.org/web/release/2.12.2/examples/variant-colors.html)***
26
26
 
27
- ***[More](https://igv.org/web/release/2.12.1/examples/)***
27
+ ***[More](https://igv.org/web/release/2.12.2/examples/)***
28
28
 
29
29
 
30
30
  # Quickstart
@@ -33,18 +33,18 @@ Below are examples and a quickstart guide. See the [Wiki](https://github.com/ig
33
33
  igv.js consists of a single javascript file with no external dependencies.
34
34
 
35
35
  Pre-built files for ES5 (igv.min.js) and ES6 (igv.esm.min.js)
36
- can be downloaded from [https://cdn.jsdelivr.net/npm/igv@2.12.1/dist/](https://cdn.jsdelivr.net/npm/igv@2.12.1/dist/).
36
+ can be downloaded from [https://cdn.jsdelivr.net/npm/igv@2.12.2/dist/](https://cdn.jsdelivr.net/npm/igv@2.12.2/dist/).
37
37
 
38
38
  To import igv as an ES6 module
39
39
 
40
40
  ```javascript
41
- import igv from "https://cdn.jsdelivr.net/npm/igv@2.12.1/dist/igv.esm.min.js"
41
+ import igv from "https://cdn.jsdelivr.net/npm/igv@2.12.2/dist/igv.esm.min.js"
42
42
  ```
43
43
 
44
44
  Or as a script include (defines the "igv" global)
45
45
 
46
46
  ```html
47
- <script src="https://cdn.jsdelivr.net/npm/igv@2.12.1/dist/igv.min.js"></script>
47
+ <script src="https://cdn.jsdelivr.net/npm/igv@2.12.2/dist/igv.min.js"></script>
48
48
  ```
49
49
 
50
50
  Alternatively you can install with npm
package/dist/igv.esm.js CHANGED
@@ -22796,7 +22796,7 @@ const Cytoband = function (start, end, name, typestain) {
22796
22796
  }
22797
22797
  };
22798
22798
 
22799
- const _version = "2.12.1";
22799
+ const _version = "2.12.2";
22800
22800
  function version() {
22801
22801
  return _version
22802
22802
  }
@@ -24397,6 +24397,10 @@ class PairedAlignment {
24397
24397
  return this.firstAlignment.mate.strand // Assumption is mate is first-of-pair
24398
24398
  }
24399
24399
  }
24400
+
24401
+ hasTag(str) {
24402
+ return this.firstAlignment.hasTag(str) || (this.secondAlignment && this.secondAlignment.hasTag(str))
24403
+ }
24400
24404
  }
24401
24405
 
24402
24406
  /*
@@ -31566,27 +31570,45 @@ const makePairedAlignmentChords = (alignments) => {
31566
31570
 
31567
31571
  const chords = [];
31568
31572
  for (let a of alignments) {
31569
- const mate = a.mate;
31570
- if (mate && mate.chr && mate.position) {
31571
- chords.push({
31572
- uniqueId: a.readName,
31573
- refName: shortChrName(a.chr),
31574
- start: a.start,
31575
- end: a.end,
31576
- mate: {
31577
- refName: shortChrName(mate.chr),
31578
- start: mate.position - 1,
31579
- end: mate.position,
31580
- }
31581
- });
31573
+
31574
+ if(a.paired) {
31575
+ if(a.firstAlignment && a.secondAlignment) {
31576
+ chords.push({
31577
+ uniqueId: a.readName,
31578
+ refName: shortChrName(a.firstAlignment.chr),
31579
+ start: a.firstAlignment.start,
31580
+ end: a.firstAlignment.end,
31581
+ mate: {
31582
+ refName: shortChrName(a.secondAlignment.chr),
31583
+ start: a.secondAlignment.start,
31584
+ end: a.secondAlignment.end,
31585
+ }
31586
+ });
31587
+ }
31588
+ }
31589
+ else {
31590
+ const mate = a.mate;
31591
+ if (mate && mate.chr && mate.position) {
31592
+ chords.push({
31593
+ uniqueId: a.readName,
31594
+ refName: shortChrName(a.chr),
31595
+ start: a.start,
31596
+ end: a.end,
31597
+ mate: {
31598
+ refName: shortChrName(mate.chr),
31599
+ start: mate.position - 1,
31600
+ end: mate.position,
31601
+ }
31602
+ });
31603
+ }
31582
31604
  }
31583
31605
  }
31584
31606
  return chords
31585
31607
  };
31586
31608
 
31587
31609
  const makeSupplementalAlignmentChords = (alignments) => {
31588
- const chords = [];
31589
- for (let a of alignments) {
31610
+
31611
+ const makeChords = (a) => {
31590
31612
  const sa = a.tags()['SA'];
31591
31613
  const supAl = createSupplementaryAlignments(sa);
31592
31614
  let n = 0;
@@ -31605,6 +31627,18 @@ const makeSupplementalAlignmentChords = (alignments) => {
31605
31627
  });
31606
31628
  }
31607
31629
  }
31630
+ };
31631
+
31632
+ const chords = [];
31633
+ for (let a of alignments) {
31634
+ if(a.paired) {
31635
+ makeChords(a.firstAlignment);
31636
+ if(a.secondAlignment) {
31637
+ makeChords(a.secondAlignment);
31638
+ }
31639
+ } else {
31640
+ makeChords(a);
31641
+ }
31608
31642
  }
31609
31643
  return chords
31610
31644
  };
@@ -32326,11 +32360,18 @@ class BAMTrack extends TrackBase {
32326
32360
  const refFrame = viewport.referenceFrame;
32327
32361
  for (let a of viewport.cachedFeatures.allAlignments()) {
32328
32362
  if (a.end >= refFrame.start
32329
- && a.start <= refFrame.end
32330
- && a.mate
32331
- && a.mate.chr
32332
- && (a.mate.chr !== a.chr || Math.max(a.fragmentLength) > maxTemplateLength)) {
32333
- inView.push(a);
32363
+ && a.start <= refFrame.end) {
32364
+ if (a.paired) {
32365
+ if (a.end - a.start > maxTemplateLength) {
32366
+ inView.push(a);
32367
+ }
32368
+ } else {
32369
+ if (a.mate
32370
+ && a.mate.chr
32371
+ && (a.mate.chr !== a.chr || Math.max(a.fragmentLength) > maxTemplateLength)) {
32372
+ inView.push(a);
32373
+ }
32374
+ }
32334
32375
  }
32335
32376
  }
32336
32377
  const chords = makePairedAlignmentChords(inView);
@@ -33909,7 +33950,7 @@ class SampleNameViewport {
33909
33950
  for (let {sampleNameViewport} of this.browser.trackViews) {
33910
33951
  sampleNameViewport.setWidth(this.browser.sampleNameViewportWidth);
33911
33952
  }
33912
- this.browser.resize();
33953
+ this.browser.layoutChange();
33913
33954
  }
33914
33955
  };
33915
33956
 
@@ -48642,7 +48683,7 @@ class SampleNameControl {
48642
48683
  }
48643
48684
  }
48644
48685
 
48645
- browser.resize();
48686
+ browser.layoutChange();
48646
48687
 
48647
48688
 
48648
48689
  });
@@ -50312,7 +50353,16 @@ class Browser {
50312
50353
 
50313
50354
  }
50314
50355
 
50356
+ /**
50357
+ * API function to signal that this browser visibility has changed, e.g. from hiding/showing in a tab interface.
50358
+ *
50359
+ * @returns {Promise<void>}
50360
+ */
50315
50361
  async visibilityChange() {
50362
+ this.layoutChange();
50363
+ }
50364
+
50365
+ async layoutChange() {
50316
50366
 
50317
50367
  const status = this.referenceFrameList.find(referenceFrame => referenceFrame.bpPerPixel < 0);
50318
50368