igv-rails 1.0.9.7 → 1.0.9.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ef4d62bc474ad69828211316b07b63b320618a1
4
- data.tar.gz: a52d1f87db393300eb6dd2ab4a7b71f493f77a1c
3
+ metadata.gz: 522637f1564b6344b6869057c8cfad571365fc0e
4
+ data.tar.gz: 4ab90f4fb04c85834a280e9e2d2fcff2697c5eac
5
5
  SHA512:
6
- metadata.gz: a3318858803119a783e17bbf0c1f2733bf3040320a9b3a4983d7beb5445b083016208725034ec5094523cedfdbfebb005f255a7a1636222f99b99ac3c0d34d64
7
- data.tar.gz: 21e1dc94eba08a8f8ce87f39ed41e1357e3f3934ad5e464c4d46462f3f440687d7769019aa32b4a2e68482d043bcf60833aa9cc9259e5aa9e018b37ce35feca8
6
+ metadata.gz: 4ec03c51b2ff436abf099db5a7a55af09ea5e992e6738740011bc91172a5d9b39fb11b5e4b678cef77703d86661cd42814f19f533c632cc38de6752f711f33c4
7
+ data.tar.gz: 8deb40ef1194672452abd95cd763bb5ffe8e801d65b2b18ee3ffd56f3efd4fe572aeb2f903f164e900d9696c480e3216d91395f7f65df8e3c4b9fd28a0b89651
@@ -1,5 +1,5 @@
1
1
  module Igv
2
2
  module Rails
3
- VERSION = "1.0.9.7"
3
+ VERSION = "1.0.9.8"
4
4
  end
5
5
  end
@@ -35740,7 +35740,7 @@ var igv = (function (igv) {
35740
35740
  $fa.addClass('fa-check-hidden');
35741
35741
  }
35742
35742
 
35743
- self.trackView.update();
35743
+ self.trackView.setDataRange(undefined, undefined, self.autoscale);
35744
35744
  }
35745
35745
  });
35746
35746
 
@@ -35814,12 +35814,7 @@ var igv = (function (igv) {
35814
35814
 
35815
35815
 
35816
35816
  if (features && features.length > 0) {
35817
- // if (self.autoscale === undefined && self.dataRange === undefined && (typeof self.featureSource.getDefaultRange === "function")) {
35818
- // defaultRange = self.featureSource.getDefaultRange();
35819
- // if (!isNaN(defaultRange.min) && !isNaN(defaultRange.max)) {
35820
- // self.dataRange = defaultRange;
35821
- // }
35822
- // }
35817
+
35823
35818
  if (self.autoscale || self.dataRange === undefined) {
35824
35819
  var s = autoscale(features);
35825
35820
  featureValueMinimum = self.config.min || s.min; // If min is explicitly set use it
@@ -36877,7 +36872,7 @@ var igv = (function (igv) {
36877
36872
 
36878
36873
 
36879
36874
  // Start the recursive load cycle. Data is fetched in chunks, if more data is available a "nextPageToken" is returned.
36880
- loadChunk();
36875
+ return loadChunk();
36881
36876
 
36882
36877
  function loadChunk(pageToken) {
36883
36878
 
@@ -36895,40 +36890,42 @@ var igv = (function (igv) {
36895
36890
  sendData: sendData,
36896
36891
  contentType: "application/json",
36897
36892
  headers: ga4ghHeaders()
36898
- }).then(function (json) {
36899
- var nextPageToken, tmp;
36893
+ })
36894
+ .then(function (json) {
36895
+ var nextPageToken, tmp;
36900
36896
 
36901
- if (json) {
36897
+ if (json) {
36902
36898
 
36903
- tmp = decode ? decode(json) : json;
36899
+ tmp = decode ? decode(json) : json;
36904
36900
 
36905
- if (tmp) {
36901
+ if (tmp) {
36906
36902
 
36907
- tmp.forEach(function (a) {
36908
- var keep = true; // TODO -- conditionally keep (downsample)
36909
- if (keep) {
36910
- results.push(a);
36911
- }
36912
- });
36913
- }
36903
+ tmp.forEach(function (a) {
36904
+ var keep = true; // TODO -- conditionally keep (downsample)
36905
+ if (keep) {
36906
+ results.push(a);
36907
+ }
36908
+ });
36909
+ }
36914
36910
 
36915
36911
 
36916
- nextPageToken = json["nextPageToken"];
36912
+ nextPageToken = json["nextPageToken"];
36917
36913
 
36918
- if (nextPageToken) {
36919
- loadChunk(nextPageToken);
36914
+ if (nextPageToken) {
36915
+ loadChunk(nextPageToken);
36916
+ }
36917
+ else {
36918
+ fulfill(results);
36919
+ }
36920
36920
  }
36921
36921
  else {
36922
36922
  fulfill(results);
36923
36923
  }
36924
- }
36925
- else {
36926
- fulfill(results);
36927
- }
36928
36924
 
36929
- }).catch(function (error) {
36930
- reject(error);
36931
- });
36925
+ })
36926
+ .catch(function (error) {
36927
+ reject(error);
36928
+ });
36932
36929
  }
36933
36930
 
36934
36931
  });
@@ -37134,60 +37131,56 @@ var igv = (function (igv) {
37134
37131
 
37135
37132
  var self = this;
37136
37133
 
37137
- return new Promise(function (fulfill, reject) {
37138
37134
 
37135
+ if (self.header) {
37136
+ return Promise.resolve(self.header);
37137
+ }
37138
+
37139
+ else {
37139
37140
 
37140
- if (self.header) {
37141
- fulfill(self.header);
37142
- }
37141
+ self.header = {};
37143
37142
 
37143
+ if (self.includeCalls === false) {
37144
+ return Promise.resolve(self.header);
37145
+ }
37144
37146
  else {
37145
37147
 
37146
- self.header = {};
37147
-
37148
- if (self.includeCalls === false) {
37149
- fulfill(self.header);
37150
- }
37151
- else {
37148
+ var readURL = self.url + "/callsets/search";
37152
37149
 
37153
- var readURL = self.url + "/callsets/search";
37150
+ return igv.ga4ghSearch({
37151
+ url: readURL,
37152
+ fields: "nextPageToken,callSets(id,name)",
37153
+ body: {
37154
+ "variantSetIds": (Array.isArray(self.variantSetId) ? self.variantSetId : [self.variantSetId]),
37155
+ "pageSize": "10000"
37156
+ },
37157
+ decode: function (json) {
37158
+ // If specific callSetIds are specified filter to those
37159
+ if (self.callSetIds) {
37160
+ var filteredCallSets = [],
37161
+ csIdSet = new Set();
37154
37162
 
37155
- igv.ga4ghSearch({
37156
- url: readURL,
37157
- fields: "nextPageToken,callSets(id,name)",
37158
- body: {
37159
- "variantSetIds": (Array.isArray(self.variantSetId) ? self.variantSetId : [self.variantSetId]),
37160
- "pageSize": "10000"
37161
- },
37162
- decode: function (json) {
37163
- // If specific callSetIds are specified filter to those
37164
- if (self.callSetIds) {
37165
- var filteredCallSets = [],
37166
- csIdSet = new Set();
37167
-
37168
- self.callSetIds.forEach(function (csid) {
37169
- csIdSet.add(csid);
37170
- })
37171
- json.callSets.forEach(function (cs) {
37172
- if (csIdSet.has(cs.id)) {
37173
- filteredCallSets.push(cs);
37174
- }
37175
- });
37176
- return filteredCallSets;
37177
- }
37178
- else {
37179
- return json.callSets;
37180
- }
37163
+ self.callSetIds.forEach(function (csid) {
37164
+ csIdSet.add(csid);
37165
+ })
37166
+ json.callSets.forEach(function (cs) {
37167
+ if (csIdSet.has(cs.id)) {
37168
+ filteredCallSets.push(cs);
37169
+ }
37170
+ });
37171
+ return filteredCallSets;
37181
37172
  }
37182
- }).then(function (callSets) {
37173
+ else {
37174
+ return json.callSets;
37175
+ }
37176
+ }
37177
+ })
37178
+ .then(function (callSets) {
37183
37179
  self.header.callSets = callSets;
37184
- fulfill(self.header);
37185
- }).catch(reject);
37186
- }
37180
+ return self.header;
37181
+ })
37187
37182
  }
37188
-
37189
- });
37190
-
37183
+ }
37191
37184
  }
37192
37185
 
37193
37186
 
@@ -37209,7 +37202,7 @@ var igv = (function (igv) {
37209
37202
 
37210
37203
  return igv.ga4ghSearch({
37211
37204
  url: readURL,
37212
- fields: (self.includeCalls ? undefined : "nextPageToken,variants(id,variantSetId,names,referenceName,start,end,referenceBases,alternateBases,quality, filter, info)"),
37205
+ fields: (self.includeCalls ? undefined : "nextPageToken,variants(id,variantSetId,names,referenceName,start,end,referenceBases,alternateBases,quality,filter,info)"),
37213
37206
  body: {
37214
37207
  "variantSetIds": (Array.isArray(self.variantSetId) ? self.variantSetId : [self.variantSetId]),
37215
37208
  "callSetIds": (self.callSetIds ? self.callSetIds : undefined),
@@ -37219,10 +37212,18 @@ var igv = (function (igv) {
37219
37212
  "pageSize": "10000"
37220
37213
  },
37221
37214
  decode: function (json) {
37215
+
37216
+ var v;
37217
+
37222
37218
  var variants = [];
37223
37219
 
37224
37220
  json.variants.forEach(function (json) {
37225
- variants.push(igv.createGAVariant(json));
37221
+
37222
+ v = igv.createGAVariant(json);
37223
+
37224
+ if (!v.isRefBlock()) {
37225
+ variants.push(v);
37226
+ }
37226
37227
  });
37227
37228
 
37228
37229
  return variants;
@@ -48555,9 +48556,17 @@ var igv = (function (igv) {
48555
48556
  };
48556
48557
 
48557
48558
  igv.TrackView.prototype.setDataRange = function (min, max, autoscale) {
48558
- this.track.dataRange.min = min;
48559
- this.track.dataRange.max = max;
48559
+
48560
+ if (min !== undefined) {
48561
+ this.track.dataRange.min = min;
48562
+ }
48563
+
48564
+ if (max !== undefined) {
48565
+ this.track.dataRange.max = max;
48566
+ }
48567
+
48560
48568
  this.track.autoscale = autoscale;
48569
+
48561
48570
  this.update();
48562
48571
  };
48563
48572
 
@@ -49934,7 +49943,7 @@ var igv = (function (igv) {
49934
49943
  if (!infoStr) return undefined;
49935
49944
 
49936
49945
  var info = {};
49937
- infoStr.split(';').forEach(function (elem) {
49946
+ infoStr.split('; ').forEach(function (elem) {
49938
49947
  var element = elem.split('=');
49939
49948
  info[element[0]] = element[1];
49940
49949
  });
@@ -49952,11 +49961,11 @@ var igv = (function (igv) {
49952
49961
  variant.start = parseInt(json.start); // Might get overriden below
49953
49962
  variant.end = parseInt(json.end); // Might get overriden below
49954
49963
  variant.pos = variant.start + 1; // GA4GH is 0 based.
49955
- variant.names = arrayToCommaString(json.names);
49956
- variant.referenceBases = json.referenceBases + '';
49957
- variant.alternateBases = json.alternateBases + '';
49964
+ variant.names = arrayToString(json.names, "; ");
49965
+ variant.referenceBases = json.referenceBases;
49966
+ variant.alternateBases = arrayToString(json.alternateBases);
49958
49967
  variant.quality = json.quality;
49959
- variant.filter = arrayToCommaString(json.filter);
49968
+ variant.filter = arrayToString(json.filter);
49960
49969
  variant.info = json.info;
49961
49970
 
49962
49971
 
@@ -49990,10 +49999,11 @@ var igv = (function (igv) {
49990
49999
  //Alleles
49991
50000
  var altTokens = variant.alternateBases.split(","),
49992
50001
  minAltLength = variant.referenceBases.length,
49993
- maxAltLength = variant.referenceBases.length;
50002
+ maxAltLength = variant.referenceBases.length,
50003
+ start, end;
49994
50004
 
49995
50005
 
49996
- if (variant.info["PERIOD"]) {
50006
+ if (variant.info && variant.info["PERIOD"]) {
49997
50007
  variant.type = 'str';
49998
50008
  }
49999
50009
 
@@ -50007,7 +50017,7 @@ var igv = (function (igv) {
50007
50017
  variant.start = variant.pos - 1;
50008
50018
  variant.end = variant.start + variant.referenceBases.length;
50009
50019
 
50010
- } else if (isRefBlock(variant.alternateBases)) {
50020
+ } else if (isRef(variant.alternateBases)) {
50011
50021
  variant.type = "refblock";
50012
50022
  }
50013
50023
 
@@ -50015,14 +50025,16 @@ var igv = (function (igv) {
50015
50025
  variant.heterozygosity = 0;
50016
50026
 
50017
50027
  } else {
50018
- altTokens.forEach(function (alt) {
50028
+
50029
+ altTokens.forEach(function (alt, index) {
50030
+
50019
50031
  var a, s, e, diff;
50020
50032
 
50021
50033
  variant.alleles.push(alt);
50022
50034
 
50023
50035
  // Adjust for padding, used for insertions and deletions, unless variant is a short tandem repeat.
50024
50036
 
50025
- if (!("str" === variant.type) && alt.length > 0) {
50037
+ if ("str" !== variant.type && alt.length > 0) {
50026
50038
 
50027
50039
  diff = variant.referenceBases.length - alt.length;
50028
50040
 
@@ -50033,20 +50045,25 @@ var igv = (function (igv) {
50033
50045
  } else if (diff < 0) {
50034
50046
  // Insertion, assume left padded, insertion begins to "right" of last ref base
50035
50047
  s = variant.pos - 1 + variant.referenceBases.length;
50036
- e = s + 1; // Insertion between s & 3
50048
+ e = s + 1; // Insertion between s & e
50037
50049
  } else {
50038
50050
  s = variant.pos - 1;
50039
50051
  e = s + 1;
50040
50052
  }
50041
- variant.start = variant.start === undefined ? s : Math.min(variant.start, s);
50042
- variant.end = variant.end === undefined ? e : Math.max(variant.end, e);
50053
+
50054
+ start = start === undefined ? s : Math.min(start, s);
50055
+ end = end === undefined ? e : Math.max(end, e);
50043
50056
  }
50044
50057
 
50045
50058
  minAltLength = Math.min(minAltLength, alt.length);
50046
50059
  maxAltLength = Math.max(maxAltLength, alt.length);
50047
50060
 
50048
50061
  });
50049
- if (variant.info.AC && variant.info.AN) {
50062
+
50063
+ variant.start = start;
50064
+ variant.end = end;
50065
+
50066
+ if (variant.info && variant.info.AC && variant.info.AN) {
50050
50067
  variant.heterozygosity = calcHeterozygosity(variant.info.AC, variant.info.AN).toFixed(3);
50051
50068
  }
50052
50069
  }
@@ -50075,6 +50092,16 @@ var igv = (function (igv) {
50075
50092
  return 1 - sum;
50076
50093
  };
50077
50094
 
50095
+
50096
+ function isRef(altAlleles) {
50097
+
50098
+ return !altAlleles ||
50099
+ altAlleles.trim().length === 0 ||
50100
+ altAlleles === "<NON_REF>" ||
50101
+ altAlleles === "<*>";
50102
+
50103
+ };
50104
+
50078
50105
  }
50079
50106
 
50080
50107
  igv.Variant = function () {
@@ -50111,29 +50138,27 @@ var igv = (function (igv) {
50111
50138
  if (this.info) {
50112
50139
  fields.push('<hr>');
50113
50140
  Object.keys(this.info).forEach(function (key) {
50114
- fields.push({name: key, value: arrayToCommaString(self.info[key])});
50141
+ fields.push({name: key, value: arrayToString(self.info[key])});
50115
50142
  });
50116
50143
  }
50117
50144
  return fields;
50118
50145
 
50146
+
50147
+
50119
50148
  };
50120
-
50121
-
50122
- function arrayToCommaString(value) {
50123
- if (!(Array.isArray(value))) {
50124
- return value;
50125
- }
50126
- return value.join(',');
50127
- }
50128
50149
 
50150
+ igv.Variant.prototype.isRefBlock = function () {
50151
+ return "refblock" === this.type;
50152
+ }
50129
50153
 
50130
- function isRefBlock(altAlleles) {
50154
+ function arrayToString(value, delim) {
50131
50155
 
50132
- return !altAlleles ||
50133
- altAlleles.trim().length === 0 ||
50134
- altAlleles === "\u003cNON_REF\u003e" ||
50135
- altAlleles === "\u003c*\u003e";
50156
+ if(delim === undefined) delim = ",";
50136
50157
 
50158
+ if (!(Array.isArray(value))) {
50159
+ return value;
50160
+ }
50161
+ return value.join(delim);
50137
50162
  }
50138
50163
 
50139
50164
  return igv;
@@ -50390,7 +50415,7 @@ var igv = (function (igv) {
50390
50415
  ctx.fillRect(px, py, pw, h);
50391
50416
 
50392
50417
 
50393
- if (callSets && variant.calls && "COLLAPSED" !== this.displayMode) {
50418
+ if (nCalls > 0 && variant.calls && "COLLAPSED" !== this.displayMode) {
50394
50419
 
50395
50420
  h = callHeight;
50396
50421
 
@@ -51071,8 +51096,8 @@ var igv = (function (igv) {
51071
51096
  if (tokens.length >= 8) {
51072
51097
 
51073
51098
  variant = igv.createVCFVariant(tokens);
51074
-
51075
- if("refblock" === variant.type) continue; // Skip reference blocks
51099
+
51100
+ if (variant.isRefBlock()) continue; // Skip reference blocks
51076
51101
 
51077
51102
  variant.header = this.header; // Keep a pointer to the header to interpret fields for popup text
51078
51103
  allFeatures.push(variant);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: igv-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9.7
4
+ version: 1.0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Van Etten, PhD
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties