@jbrowse/plugin-bed 3.2.0 → 3.3.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.
@@ -1,6 +1,7 @@
1
1
  declare const BedAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  bedLocation: {
3
3
  type: string;
4
+ description: string;
4
5
  defaultValue: {
5
6
  uri: string;
6
7
  locationType: string;
@@ -5,6 +5,7 @@ function x() { }
5
5
  const BedAdapter = (0, configuration_1.ConfigurationSchema)('BedAdapter', {
6
6
  bedLocation: {
7
7
  type: 'fileLocation',
8
+ description: 'path to bed file, also allows gzipped bed',
8
9
  defaultValue: {
9
10
  uri: '/path/to/my.bed.gz',
10
11
  locationType: 'UriLocation',
@@ -40,5 +40,4 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
40
40
  }>;
41
41
  getNames(): Promise<string[] | undefined>;
42
42
  getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
43
- freeResources(): void;
44
43
  }
@@ -99,7 +99,6 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
99
99
  observer.complete();
100
100
  }, stopToken);
101
101
  }
102
- freeResources() { }
103
102
  }
104
103
  BedTabixAdapter.capabilities = ['getFeatures', 'getRefNames'];
105
104
  exports.default = BedTabixAdapter;
@@ -1,6 +1,7 @@
1
1
  declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  bedpeLocation: {
3
3
  type: string;
4
+ description: string;
4
5
  defaultValue: {
5
6
  uri: string;
6
7
  locationType: string;
@@ -5,6 +5,7 @@ function x() { }
5
5
  const BedpeAdapter = (0, configuration_1.ConfigurationSchema)('BedpeAdapter', {
6
6
  bedpeLocation: {
7
7
  type: 'fileLocation',
8
+ description: 'can be plaintext or gzipped, not indexed so loaded into memory on startup',
8
9
  defaultValue: {
9
10
  uri: '/path/to/my.bedpe.gz',
10
11
  locationType: 'UriLocation',
@@ -90,38 +90,8 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
90
90
  const feats = await (0, util_1.updateStatus)('Downloading features', statusCallback, () => bigbed.getFeatures(query.refName, query.start, query.end, {
91
91
  basesPerSpan: query.end - query.start,
92
92
  }));
93
- if (allowRedispatch && feats.length) {
94
- let minStart = Number.POSITIVE_INFINITY;
95
- let maxEnd = Number.NEGATIVE_INFINITY;
96
- let hasAnyAggregationField = false;
97
- for (const feat of feats) {
98
- if (feat.start < minStart) {
99
- minStart = feat.start;
100
- }
101
- if (feat.end > maxEnd) {
102
- maxEnd = feat.end;
103
- }
104
- if (feat[aggregateField]) {
105
- hasAnyAggregationField = true;
106
- }
107
- }
108
- if (hasAnyAggregationField &&
109
- (maxEnd > query.end || minStart < query.start)) {
110
- await this.getFeaturesHelper({
111
- query: {
112
- ...query,
113
- start: minStart - 500000,
114
- end: maxEnd + 500000,
115
- },
116
- opts,
117
- observer,
118
- allowRedispatch: false,
119
- originalQuery: query,
120
- });
121
- return;
122
- }
123
- }
124
93
  const parentAggregation = {};
94
+ const parentAggregationFlat = [];
125
95
  if (feats.some(f => f.uniqueId === undefined)) {
126
96
  throw new Error('found uniqueId undefined');
127
97
  }
@@ -152,6 +122,7 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
152
122
  });
153
123
  if (aggr) {
154
124
  parentAggregation[aggr].push(f);
125
+ parentAggregationFlat.push(f);
155
126
  }
156
127
  else {
157
128
  if ((0, util_1.doesIntersect2)(f.start, f.end, originalQuery.start, originalQuery.end)) {
@@ -162,6 +133,32 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
162
133
  }
163
134
  }
164
135
  }
136
+ if (allowRedispatch && parentAggregationFlat.length) {
137
+ let minStart = Number.POSITIVE_INFINITY;
138
+ let maxEnd = Number.NEGATIVE_INFINITY;
139
+ for (const feat of parentAggregationFlat) {
140
+ if (feat.start < minStart) {
141
+ minStart = feat.start;
142
+ }
143
+ if (feat.end > maxEnd) {
144
+ maxEnd = feat.end;
145
+ }
146
+ }
147
+ if (maxEnd > query.end || minStart < query.start) {
148
+ await this.getFeaturesHelper({
149
+ query: {
150
+ ...query,
151
+ start: minStart - 500000,
152
+ end: maxEnd + 500000,
153
+ },
154
+ opts,
155
+ observer,
156
+ allowRedispatch: false,
157
+ originalQuery: query,
158
+ });
159
+ return;
160
+ }
161
+ }
165
162
  Object.entries(parentAggregation).map(([name, subfeatures]) => {
166
163
  var _a, _b;
167
164
  const s = (0, util_1.min)(subfeatures.map(f => f.start));
@@ -1,6 +1,7 @@
1
1
  declare const BedAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  bedLocation: {
3
3
  type: string;
4
+ description: string;
4
5
  defaultValue: {
5
6
  uri: string;
6
7
  locationType: string;
@@ -3,6 +3,7 @@ function x() { }
3
3
  const BedAdapter = ConfigurationSchema('BedAdapter', {
4
4
  bedLocation: {
5
5
  type: 'fileLocation',
6
+ description: 'path to bed file, also allows gzipped bed',
6
7
  defaultValue: {
7
8
  uri: '/path/to/my.bed.gz',
8
9
  locationType: 'UriLocation',
@@ -40,5 +40,4 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
40
40
  }>;
41
41
  getNames(): Promise<string[] | undefined>;
42
42
  getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
43
- freeResources(): void;
44
43
  }
@@ -94,7 +94,6 @@ class BedTabixAdapter extends BaseFeatureDataAdapter {
94
94
  observer.complete();
95
95
  }, stopToken);
96
96
  }
97
- freeResources() { }
98
97
  }
99
98
  BedTabixAdapter.capabilities = ['getFeatures', 'getRefNames'];
100
99
  export default BedTabixAdapter;
@@ -1,6 +1,7 @@
1
1
  declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  bedpeLocation: {
3
3
  type: string;
4
+ description: string;
4
5
  defaultValue: {
5
6
  uri: string;
6
7
  locationType: string;
@@ -3,6 +3,7 @@ function x() { }
3
3
  const BedpeAdapter = ConfigurationSchema('BedpeAdapter', {
4
4
  bedpeLocation: {
5
5
  type: 'fileLocation',
6
+ description: 'can be plaintext or gzipped, not indexed so loaded into memory on startup',
6
7
  defaultValue: {
7
8
  uri: '/path/to/my.bedpe.gz',
8
9
  locationType: 'UriLocation',
@@ -85,38 +85,8 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
85
85
  const feats = await updateStatus('Downloading features', statusCallback, () => bigbed.getFeatures(query.refName, query.start, query.end, {
86
86
  basesPerSpan: query.end - query.start,
87
87
  }));
88
- if (allowRedispatch && feats.length) {
89
- let minStart = Number.POSITIVE_INFINITY;
90
- let maxEnd = Number.NEGATIVE_INFINITY;
91
- let hasAnyAggregationField = false;
92
- for (const feat of feats) {
93
- if (feat.start < minStart) {
94
- minStart = feat.start;
95
- }
96
- if (feat.end > maxEnd) {
97
- maxEnd = feat.end;
98
- }
99
- if (feat[aggregateField]) {
100
- hasAnyAggregationField = true;
101
- }
102
- }
103
- if (hasAnyAggregationField &&
104
- (maxEnd > query.end || minStart < query.start)) {
105
- await this.getFeaturesHelper({
106
- query: {
107
- ...query,
108
- start: minStart - 500000,
109
- end: maxEnd + 500000,
110
- },
111
- opts,
112
- observer,
113
- allowRedispatch: false,
114
- originalQuery: query,
115
- });
116
- return;
117
- }
118
- }
119
88
  const parentAggregation = {};
89
+ const parentAggregationFlat = [];
120
90
  if (feats.some(f => f.uniqueId === undefined)) {
121
91
  throw new Error('found uniqueId undefined');
122
92
  }
@@ -147,6 +117,7 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
147
117
  });
148
118
  if (aggr) {
149
119
  parentAggregation[aggr].push(f);
120
+ parentAggregationFlat.push(f);
150
121
  }
151
122
  else {
152
123
  if (doesIntersect2(f.start, f.end, originalQuery.start, originalQuery.end)) {
@@ -157,6 +128,32 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
157
128
  }
158
129
  }
159
130
  }
131
+ if (allowRedispatch && parentAggregationFlat.length) {
132
+ let minStart = Number.POSITIVE_INFINITY;
133
+ let maxEnd = Number.NEGATIVE_INFINITY;
134
+ for (const feat of parentAggregationFlat) {
135
+ if (feat.start < minStart) {
136
+ minStart = feat.start;
137
+ }
138
+ if (feat.end > maxEnd) {
139
+ maxEnd = feat.end;
140
+ }
141
+ }
142
+ if (maxEnd > query.end || minStart < query.start) {
143
+ await this.getFeaturesHelper({
144
+ query: {
145
+ ...query,
146
+ start: minStart - 500000,
147
+ end: maxEnd + 500000,
148
+ },
149
+ opts,
150
+ observer,
151
+ allowRedispatch: false,
152
+ originalQuery: query,
153
+ });
154
+ return;
155
+ }
156
+ }
160
157
  Object.entries(parentAggregation).map(([name, subfeatures]) => {
161
158
  var _a, _b;
162
159
  const s = min(subfeatures.map(f => f.start));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-bed",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "JBrowse 2 bed adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -41,7 +41,7 @@
41
41
  "@gmod/bed": "^2.1.2",
42
42
  "@gmod/bgzf-filehandle": "^2.0.1",
43
43
  "@gmod/tabix": "^2.0.0",
44
- "@jbrowse/core": "^3.2.0",
44
+ "@jbrowse/core": "^3.3.0",
45
45
  "mobx": "^6.0.0",
46
46
  "mobx-react": "^9.0.0",
47
47
  "mobx-state-tree": "^5.0.0",
@@ -53,5 +53,5 @@
53
53
  "distModule": "esm/index.js",
54
54
  "srcModule": "src/index.ts",
55
55
  "module": "esm/index.js",
56
- "gitHead": "c750e3f56706a490c19ba75abd807fec5e38aebf"
56
+ "gitHead": "0bb64d8cc7ecdd167515308b31eec3d9acbc59e4"
57
57
  }