@apollo-annotation/shared 0.1.19 → 0.1.20
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/Changes/AddAssemblyAndFeaturesFromFileChange.d.ts +33 -0
- package/dist/Changes/AddAssemblyAndFeaturesFromFileChange.js +83 -0
- package/dist/Changes/AddAssemblyAndFeaturesFromFileChange.js.map +1 -0
- package/dist/Changes/AddAssemblyFromExternalChange.d.ts +34 -0
- package/dist/Changes/AddAssemblyFromExternalChange.js +97 -0
- package/dist/Changes/AddAssemblyFromExternalChange.js.map +1 -0
- package/dist/Changes/AddAssemblyFromFileChange.d.ts +43 -0
- package/dist/Changes/AddAssemblyFromFileChange.js +140 -0
- package/dist/Changes/AddAssemblyFromFileChange.js.map +1 -0
- package/dist/Changes/AddFeatureChange.d.ts +35 -0
- package/dist/Changes/AddFeatureChange.js +169 -0
- package/dist/Changes/AddFeatureChange.js.map +1 -0
- package/dist/Changes/AddFeaturesFromFileChange.d.ts +32 -0
- package/dist/Changes/AddFeaturesFromFileChange.js +76 -0
- package/dist/Changes/AddFeaturesFromFileChange.js.map +1 -0
- package/dist/Changes/AddRefSeqAliasesChange.d.ts +20 -0
- package/dist/Changes/AddRefSeqAliasesChange.js +61 -0
- package/dist/Changes/AddRefSeqAliasesChange.js.map +1 -0
- package/dist/Changes/DeleteAssemblyChange.d.ts +18 -0
- package/dist/Changes/DeleteAssemblyChange.js +72 -0
- package/dist/Changes/DeleteAssemblyChange.js.map +1 -0
- package/dist/Changes/DeleteFeatureChange.d.ts +42 -0
- package/dist/Changes/DeleteFeatureChange.js +143 -0
- package/dist/Changes/DeleteFeatureChange.js.map +1 -0
- package/dist/Changes/DeleteUserChange.d.ts +25 -0
- package/dist/Changes/DeleteUserChange.js +53 -0
- package/dist/Changes/DeleteUserChange.js.map +1 -0
- package/dist/Changes/FeatureAttributeChange.d.ts +31 -0
- package/dist/Changes/FeatureAttributeChange.js +112 -0
- package/dist/Changes/FeatureAttributeChange.js.map +1 -0
- package/dist/Changes/FromFileBaseChange.d.ts +9 -0
- package/dist/Changes/FromFileBaseChange.js +187 -0
- package/dist/Changes/FromFileBaseChange.js.map +1 -0
- package/dist/Changes/ImportJBrowseConfigChange.d.ts +43 -0
- package/dist/Changes/ImportJBrowseConfigChange.js +67 -0
- package/dist/Changes/ImportJBrowseConfigChange.js.map +1 -0
- package/dist/Changes/LocationEndChange.d.ts +32 -0
- package/dist/Changes/LocationEndChange.js +129 -0
- package/dist/Changes/LocationEndChange.js.map +1 -0
- package/dist/Changes/LocationStartChange.d.ts +32 -0
- package/dist/Changes/LocationStartChange.js +129 -0
- package/dist/Changes/LocationStartChange.js.map +1 -0
- package/dist/Changes/StrandChange.d.ts +31 -0
- package/dist/Changes/StrandChange.js +114 -0
- package/dist/Changes/StrandChange.js.map +1 -0
- package/dist/Changes/TypeChange.d.ts +31 -0
- package/dist/Changes/TypeChange.js +114 -0
- package/dist/Changes/TypeChange.js.map +1 -0
- package/dist/Changes/UserChange.d.ts +25 -0
- package/dist/Changes/UserChange.js +51 -0
- package/dist/Changes/UserChange.js.map +1 -0
- package/dist/Changes/index.d.ts +50 -0
- package/dist/Changes/index.js +55 -0
- package/dist/Changes/index.js.map +1 -0
- package/dist/Checks/CDSCheck.d.ts +8 -0
- package/dist/Checks/CDSCheck.js +197 -0
- package/dist/Checks/CDSCheck.js.map +1 -0
- package/dist/Checks/index.d.ts +1 -0
- package/dist/Checks/index.js +5 -0
- package/dist/Checks/index.js.map +1 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/Common/index.js +5 -0
- package/dist/Common/index.js.map +1 -0
- package/dist/Common/jwtPayload.d.ts +12 -0
- package/dist/Common/jwtPayload.js +16 -0
- package/dist/Common/jwtPayload.js.map +1 -0
- package/dist/GFF3/gff3ToAnnotationFeature.d.ts +3 -0
- package/dist/GFF3/gff3ToAnnotationFeature.js +211 -0
- package/dist/GFF3/gff3ToAnnotationFeature.js.map +1 -0
- package/dist/GFF3/gff3ToAnnotationFeature.test.d.ts +1 -0
- package/dist/GFF3/gff3ToAnnotationFeature.test.js +174 -0
- package/dist/GFF3/gff3ToAnnotationFeature.test.js.map +1 -0
- package/dist/GFF3/gffReservedKeys.d.ts +5 -0
- package/dist/GFF3/gffReservedKeys.js +34 -0
- package/dist/GFF3/gffReservedKeys.js.map +1 -0
- package/dist/GFF3/index.d.ts +2 -0
- package/dist/GFF3/index.js +6 -0
- package/dist/GFF3/index.js.map +1 -0
- package/dist/Messages.d.ts +28 -0
- package/dist/Messages.js +3 -0
- package/dist/Messages.js.map +1 -0
- package/dist/Operations/GetAssembliesOperation.d.ts +13 -0
- package/dist/Operations/GetAssembliesOperation.js +20 -0
- package/dist/Operations/GetAssembliesOperation.js.map +1 -0
- package/dist/Operations/GetFeaturesOperation.d.ts +26 -0
- package/dist/Operations/GetFeaturesOperation.js +42 -0
- package/dist/Operations/GetFeaturesOperation.js.map +1 -0
- package/dist/Operations/index.d.ts +8 -0
- package/dist/Operations/index.js +10 -0
- package/dist/Operations/index.js.map +1 -0
- package/dist/Validations/CoreValidation.d.ts +17 -0
- package/dist/Validations/CoreValidation.js +36 -0
- package/dist/Validations/CoreValidation.js.map +1 -0
- package/dist/Validations/ParentChildValidation.d.ts +17 -0
- package/dist/Validations/ParentChildValidation.js +61 -0
- package/dist/Validations/ParentChildValidation.js.map +1 -0
- package/dist/Validations/Validation.d.ts +27 -0
- package/dist/Validations/Validation.js +27 -0
- package/dist/Validations/Validation.js.map +1 -0
- package/dist/Validations/ValidationSet.d.ts +24 -0
- package/dist/Validations/ValidationSet.js +86 -0
- package/dist/Validations/ValidationSet.js.map +1 -0
- package/dist/Validations/index.d.ts +4 -0
- package/dist/Validations/index.js +8 -0
- package/dist/Validations/index.js.map +1 -0
- package/dist/Validations/soSequenceTypes.d.ts +2 -0
- package/dist/Validations/soSequenceTypes.js +1868 -0
- package/dist/Validations/soSequenceTypes.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/util.d.ts +4 -0
- package/dist/util.js +102 -0
- package/dist/util.js.map +1 -0
- package/package.json +8 -5
- package/src/Changes/AddAssemblyAndFeaturesFromFileChange.ts +6 -5
- package/src/Changes/AddAssemblyFromFileChange.ts +126 -41
- package/src/Checks/CDSCheck.ts +202 -252
- package/src/GFF3/gff3ToAnnotationFeature.test.ts +165 -5
- package/src/GFF3/gff3ToAnnotationFeature.ts +16 -16
- package/src/util.ts +1 -0
- package/test_data/braker.gff +13 -0
- package/test_data/example01.gff3 +26 -0
- package/test_data/example01.json +236 -0
- package/test_data/example02.json +225 -0
- package/test_data/example04.json +225 -0
- package/test_data/example05.gff3 +30 -0
- package/test_data/example06.gff3 +30 -0
- package/test_data/example07.gff3 +30 -0
- package/test_data/gene_mrna.gff3 +4 -0
- package/test_data/gene_representations.gff3 +1781 -0
- package/test_data/one_cds.gff3 +9 -0
- package/test_data/one_cds.json +67 -0
- package/test_data/two_cds.gff3 +9 -0
- package/test_data/two_cds.json +67 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gff3ToAnnotationFeature = gff3ToAnnotationFeature;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const bson_objectid_1 = tslib_1.__importDefault(require("bson-objectid"));
|
|
7
|
+
const gffReservedKeys_1 = require("./gffReservedKeys");
|
|
8
|
+
function gff3ToAnnotationFeature(gff3Feature, refSeq, featureIds) {
|
|
9
|
+
const [firstFeature] = gff3Feature;
|
|
10
|
+
const { end, seq_id: refName, start, strand, type } = firstFeature;
|
|
11
|
+
if (!refName) {
|
|
12
|
+
throw new Error(`feature does not have seq_id: ${JSON.stringify(firstFeature)}`);
|
|
13
|
+
}
|
|
14
|
+
if (!type) {
|
|
15
|
+
throw new Error(`feature does not have type: ${JSON.stringify(firstFeature)}`);
|
|
16
|
+
}
|
|
17
|
+
if (start === null) {
|
|
18
|
+
throw new Error(`feature does not have start: ${JSON.stringify(firstFeature)}`);
|
|
19
|
+
}
|
|
20
|
+
if (end === null) {
|
|
21
|
+
throw new Error(`feature does not have end: ${JSON.stringify(firstFeature)}`);
|
|
22
|
+
}
|
|
23
|
+
const [min, max] = getFeatureMinMax(gff3Feature);
|
|
24
|
+
const convertedChildren = convertChildren(gff3Feature, refSeq, featureIds);
|
|
25
|
+
const convertedAttributes = convertFeatureAttributes(gff3Feature);
|
|
26
|
+
const feature = {
|
|
27
|
+
_id: new bson_objectid_1.default().toHexString(),
|
|
28
|
+
refSeq: refSeq ?? refName,
|
|
29
|
+
type,
|
|
30
|
+
min,
|
|
31
|
+
max,
|
|
32
|
+
};
|
|
33
|
+
if (strand) {
|
|
34
|
+
if (strand === '+') {
|
|
35
|
+
feature.strand = 1;
|
|
36
|
+
}
|
|
37
|
+
else if (strand === '-') {
|
|
38
|
+
feature.strand = -1;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw new Error(`Unknown strand: "${strand}"`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (convertedChildren) {
|
|
45
|
+
feature.children = convertedChildren;
|
|
46
|
+
}
|
|
47
|
+
if (convertedAttributes) {
|
|
48
|
+
feature.attributes = convertedAttributes;
|
|
49
|
+
}
|
|
50
|
+
if (featureIds) {
|
|
51
|
+
featureIds.push(feature._id);
|
|
52
|
+
}
|
|
53
|
+
return feature;
|
|
54
|
+
}
|
|
55
|
+
function getFeatureMinMax(gff3Feature) {
|
|
56
|
+
if (gff3Feature.length > 1 && !gff3Feature.every((f) => f.type === 'CDS')) {
|
|
57
|
+
throw new Error('GFF3 features has multiple locations but is not a CDS');
|
|
58
|
+
}
|
|
59
|
+
const mins = gff3Feature.map((f) => f.start).filter((m) => m !== null);
|
|
60
|
+
const maxes = gff3Feature.map((f) => f.end).filter((m) => m !== null);
|
|
61
|
+
const min = Math.min(...mins);
|
|
62
|
+
const max = Math.max(...maxes);
|
|
63
|
+
return [min - 1, max];
|
|
64
|
+
}
|
|
65
|
+
function convertFeatureAttributes(gff3Feature) {
|
|
66
|
+
const convertedAttributes = {};
|
|
67
|
+
const scores = gff3Feature
|
|
68
|
+
.map((f) => f.score)
|
|
69
|
+
.filter((score) => score !== null);
|
|
70
|
+
const sources = gff3Feature
|
|
71
|
+
.map((f) => f.source)
|
|
72
|
+
.filter((source) => source !== null);
|
|
73
|
+
const attributesCollections = gff3Feature
|
|
74
|
+
.map((f) => f.attributes)
|
|
75
|
+
.filter((attributes) => attributes !== null);
|
|
76
|
+
if (scores.length > 0) {
|
|
77
|
+
let [score] = scores;
|
|
78
|
+
if (scores.length > 1) {
|
|
79
|
+
const scoresSum = scores.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
80
|
+
// Average score
|
|
81
|
+
score = scoresSum / scores.length;
|
|
82
|
+
}
|
|
83
|
+
convertedAttributes.gff_score = [String(score)];
|
|
84
|
+
}
|
|
85
|
+
if (sources.length > 0) {
|
|
86
|
+
let [source] = sources;
|
|
87
|
+
if (sources.length > 1) {
|
|
88
|
+
const sourceSet = new Set(sources);
|
|
89
|
+
source = [...sourceSet].join(',');
|
|
90
|
+
}
|
|
91
|
+
convertedAttributes.gff_source = [source];
|
|
92
|
+
}
|
|
93
|
+
if (attributesCollections.length > 0) {
|
|
94
|
+
for (const attributesCollection of attributesCollections) {
|
|
95
|
+
for (const [key, val] of Object.entries(attributesCollection)) {
|
|
96
|
+
if (!val || key === 'Parent') {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const newKey = (0, gffReservedKeys_1.isGFFReservedAttribute)(key) ? gffReservedKeys_1.gffToInternal[key] : key;
|
|
100
|
+
const existingVal = convertedAttributes[newKey];
|
|
101
|
+
if (existingVal) {
|
|
102
|
+
const valSet = new Set([...existingVal, ...val]);
|
|
103
|
+
convertedAttributes[newKey] = [...valSet];
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
convertedAttributes[newKey] = val;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (Object.keys(convertedAttributes).length > 0) {
|
|
112
|
+
return convertedAttributes;
|
|
113
|
+
}
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
function convertChildren(gff3Feature, refSeq, featureIds) {
|
|
117
|
+
const convertedChildren = {};
|
|
118
|
+
const locationsWithChildren = gff3Feature.filter((feature) => feature.child_features.length > 0);
|
|
119
|
+
if (locationsWithChildren.length > 1) {
|
|
120
|
+
throw new Error('Features with multiple locations may not have children');
|
|
121
|
+
}
|
|
122
|
+
if (locationsWithChildren.length === 0) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const [firstFeature] = locationsWithChildren;
|
|
126
|
+
const { child_features: childFeatures } = firstFeature;
|
|
127
|
+
const cdsFeatures = [];
|
|
128
|
+
for (const childFeature of childFeatures) {
|
|
129
|
+
const [firstChildFeatureLocation] = childFeature;
|
|
130
|
+
if (firstChildFeatureLocation.type === 'three_prime_UTR' ||
|
|
131
|
+
firstChildFeatureLocation.type === 'five_prime_UTR' ||
|
|
132
|
+
firstChildFeatureLocation.type === 'intron' ||
|
|
133
|
+
firstChildFeatureLocation.type === 'start_codon' ||
|
|
134
|
+
firstChildFeatureLocation.type === 'stop_codon') {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (firstChildFeatureLocation.type === 'CDS') {
|
|
138
|
+
cdsFeatures.push(childFeature);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const child = gff3ToAnnotationFeature(childFeature, refSeq, featureIds);
|
|
142
|
+
convertedChildren[child._id] = child;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const processedCDS = cdsFeatures.length > 0 ? processCDS(cdsFeatures, refSeq, featureIds) : [];
|
|
146
|
+
for (const cds of processedCDS) {
|
|
147
|
+
convertedChildren[cds._id] = cds;
|
|
148
|
+
}
|
|
149
|
+
if (Object.keys(convertedChildren).length > 0) {
|
|
150
|
+
return convertedChildren;
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* If a GFF3 file has CDS features that either (1) don't have an ID or (2) have
|
|
156
|
+
* different IDs for each CDS, we have to do a bit of guessing about how they
|
|
157
|
+
* should be represented in our internal structure
|
|
158
|
+
* @param cdsFeatures -
|
|
159
|
+
*/
|
|
160
|
+
function processCDS(cdsFeatures, refSeq, featureIds) {
|
|
161
|
+
const locationCounts = cdsFeatures.map((cds) => cds.length);
|
|
162
|
+
// If any CDS have multiple locations, assume it really is multiple CDS
|
|
163
|
+
// (e.g. the mRNA has multiple alternative translational start sites)
|
|
164
|
+
// and process normally.
|
|
165
|
+
if (locationCounts.some((count) => count > 1)) {
|
|
166
|
+
return cdsFeatures.map((cds) => gff3ToAnnotationFeature(cds, refSeq, featureIds));
|
|
167
|
+
}
|
|
168
|
+
// If all CDS have a single location, we guess that this GFF3 represented CDS
|
|
169
|
+
// as multiple features instead of a single feature with multiple locations.
|
|
170
|
+
// To figure out if it's actually representing one vs. multiple CDS features,
|
|
171
|
+
// first check to see if any of the CDS overlap
|
|
172
|
+
const sortedCDSLocations = cdsFeatures
|
|
173
|
+
.map((cds) => cds[0])
|
|
174
|
+
.filter((cds) => cds.start !== null && cds.end !== null)
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
176
|
+
.sort((cdsA, cdsB) => cdsA.start - cdsB.start);
|
|
177
|
+
const overlapping = sortedCDSLocations.some((loc, idx) => {
|
|
178
|
+
const nextLoc = sortedCDSLocations.at(idx + 1);
|
|
179
|
+
if (!nextLoc) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
183
|
+
return (0, util_1.doesIntersect2)(loc.start, loc.end, nextLoc.start, nextLoc.end);
|
|
184
|
+
});
|
|
185
|
+
// If no overlaps, assume it's a single CDS feature
|
|
186
|
+
if (!overlapping) {
|
|
187
|
+
return [gff3ToAnnotationFeature(sortedCDSLocations, refSeq, featureIds)];
|
|
188
|
+
}
|
|
189
|
+
// Some CDS locations overlap, the best we can do is use the original order to
|
|
190
|
+
// guess how to group the locations into features
|
|
191
|
+
const cdsLocations = cdsFeatures.map((cds) => cds[0]);
|
|
192
|
+
const groupedLocations = [];
|
|
193
|
+
for (const location of cdsLocations) {
|
|
194
|
+
const lastGroup = groupedLocations.at(-1);
|
|
195
|
+
if (!lastGroup) {
|
|
196
|
+
groupedLocations.push([location]);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const overlaps = lastGroup.some((lastGroupLoc) => (0, util_1.doesIntersect2)(
|
|
200
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
201
|
+
lastGroupLoc.start, lastGroupLoc.end, location.start, location.end));
|
|
202
|
+
if (overlaps) {
|
|
203
|
+
groupedLocations.push([location]);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
lastGroup.push(location);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return groupedLocations.map((group) => gff3ToAnnotationFeature(group, refSeq, featureIds));
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=gff3ToAnnotationFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gff3ToAnnotationFeature.js","sourceRoot":"","sources":["../../src/GFF3/gff3ToAnnotationFeature.ts"],"names":[],"mappings":";;AAOA,0DA4DC;;AAjED,6CAAmD;AACnD,0EAAoC;AAEpC,uDAAyE;AAEzE,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,MAAe,EACf,UAAqB;IAErB,MAAM,CAAC,YAAY,CAAC,GAAG,WAAW,CAAA;IAClC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAA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,QAAQ,EAAE,CAAC;YACb,gBAAgB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;QACnC,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACpC,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CACnD,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
5
|
+
const node_test_1 = require("node:test");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const gff_1 = tslib_1.__importDefault(require("@gmod/gff"));
|
|
8
|
+
const chai_1 = require("chai");
|
|
9
|
+
const chai_exclude_1 = tslib_1.__importDefault(require("chai-exclude"));
|
|
10
|
+
const gff3ToAnnotationFeature_1 = require("./gff3ToAnnotationFeature");
|
|
11
|
+
(0, chai_1.use)(chai_exclude_1.default);
|
|
12
|
+
const testCases = [
|
|
13
|
+
[
|
|
14
|
+
'a feature with no children',
|
|
15
|
+
'ctgA example remark 1000 2000 . . . Name=Remark:hga;Alias=hga\n',
|
|
16
|
+
{
|
|
17
|
+
_id: '66c51f3e002c683eaf98a223',
|
|
18
|
+
refSeq: 'ctgA',
|
|
19
|
+
type: 'remark',
|
|
20
|
+
min: 999,
|
|
21
|
+
max: 2000,
|
|
22
|
+
attributes: {
|
|
23
|
+
gff_source: ['example'],
|
|
24
|
+
gff_name: ['Remark:hga'],
|
|
25
|
+
gff_alias: ['hga'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
'a feature with two children',
|
|
31
|
+
`ctgA est EST_match 1050 3202 . + . ID=Match1;Name=agt830.5;Target=agt830.5 1 654
|
|
32
|
+
ctgA est match_part 1050 1500 . + . Parent=Match1;Name=agt830.5;Target=agt830.5 1 451
|
|
33
|
+
ctgA est match_part 3000 3202 . + . Parent=Match1;Name=agt830.5;Target=agt830.5 452 654
|
|
34
|
+
`,
|
|
35
|
+
{
|
|
36
|
+
_id: '66cf9fbb4e947fa2c27d3d6a',
|
|
37
|
+
refSeq: 'ctgA',
|
|
38
|
+
type: 'EST_match',
|
|
39
|
+
min: 1049,
|
|
40
|
+
max: 3202,
|
|
41
|
+
strand: 1,
|
|
42
|
+
children: {
|
|
43
|
+
'66cf9fbb4e947fa2c27d3d68': {
|
|
44
|
+
_id: '66cf9fbb4e947fa2c27d3d68',
|
|
45
|
+
refSeq: 'ctgA',
|
|
46
|
+
type: 'match_part',
|
|
47
|
+
min: 1049,
|
|
48
|
+
max: 1500,
|
|
49
|
+
strand: 1,
|
|
50
|
+
attributes: {
|
|
51
|
+
gff_source: ['est'],
|
|
52
|
+
gff_name: ['agt830.5'],
|
|
53
|
+
gff_target: ['agt830.5 1 451'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
'66cf9fbb4e947fa2c27d3d69': {
|
|
57
|
+
_id: '66cf9fbb4e947fa2c27d3d69',
|
|
58
|
+
refSeq: 'ctgA',
|
|
59
|
+
type: 'match_part',
|
|
60
|
+
min: 2999,
|
|
61
|
+
max: 3202,
|
|
62
|
+
strand: 1,
|
|
63
|
+
attributes: {
|
|
64
|
+
gff_source: ['est'],
|
|
65
|
+
gff_name: ['agt830.5'],
|
|
66
|
+
gff_target: ['agt830.5 452 654'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
attributes: {
|
|
71
|
+
gff_source: ['est'],
|
|
72
|
+
gff_id: ['Match1'],
|
|
73
|
+
gff_name: ['agt830.5'],
|
|
74
|
+
gff_target: ['agt830.5 1 654'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
];
|
|
79
|
+
function childrenToArray(feature) {
|
|
80
|
+
const { children } = feature;
|
|
81
|
+
if (!children) {
|
|
82
|
+
return feature;
|
|
83
|
+
}
|
|
84
|
+
const childrenArray = Object.values(children).map((child) => childrenToArray(child));
|
|
85
|
+
return { ...feature, children: childrenArray };
|
|
86
|
+
}
|
|
87
|
+
function compareFeatures(feature1, feature2) {
|
|
88
|
+
chai_1.assert.deepEqualExcludingEvery(childrenToArray(feature1), childrenToArray(feature2), '_id');
|
|
89
|
+
}
|
|
90
|
+
function readFeatureFile(fn) {
|
|
91
|
+
const lines = (0, node_fs_1.readFileSync)(fn).toString().split('\n');
|
|
92
|
+
const feature = [];
|
|
93
|
+
for (const line of lines) {
|
|
94
|
+
if (!line.startsWith('#')) {
|
|
95
|
+
feature.push(line);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const inGff = gff_1.default.parseStringSync(feature.join('\n'));
|
|
99
|
+
return inGff;
|
|
100
|
+
}
|
|
101
|
+
function readAnnotationFeatureSnapshot(fn) {
|
|
102
|
+
const lines = (0, node_fs_1.readFileSync)(fn).toString();
|
|
103
|
+
return JSON.parse(lines);
|
|
104
|
+
}
|
|
105
|
+
const [ex1, ex2, ex3, ex4] = readFeatureFile('test_data/gene_representations.gff3');
|
|
106
|
+
(0, node_test_1.describe)('gff3ToAnnotationFeature examples', () => {
|
|
107
|
+
(0, node_test_1.it)('Convert one CDS', () => {
|
|
108
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(readFeatureFile('test_data/one_cds.gff3')[0]);
|
|
109
|
+
const expected = readAnnotationFeatureSnapshot('test_data/one_cds.json');
|
|
110
|
+
compareFeatures(actual, expected);
|
|
111
|
+
});
|
|
112
|
+
(0, node_test_1.it)('Convert two CDSs', () => {
|
|
113
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(readFeatureFile('test_data/two_cds.gff3')[0]);
|
|
114
|
+
const expected = readAnnotationFeatureSnapshot('test_data/two_cds.json');
|
|
115
|
+
compareFeatures(actual, expected);
|
|
116
|
+
});
|
|
117
|
+
(0, node_test_1.it)('Convert example 1', () => {
|
|
118
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(ex1);
|
|
119
|
+
const txt = JSON.stringify(actual, null, 2);
|
|
120
|
+
chai_1.assert.equal(txt.match(/"type": "CDS"/g)?.length, 4);
|
|
121
|
+
chai_1.assert.equal(txt.match(/"type": "TF_binding_site"/g)?.length, 1);
|
|
122
|
+
const expected = readAnnotationFeatureSnapshot('test_data/example01.json');
|
|
123
|
+
compareFeatures(actual, expected);
|
|
124
|
+
});
|
|
125
|
+
(0, node_test_1.it)('Convert example 2', () => {
|
|
126
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(ex2);
|
|
127
|
+
const txt = JSON.stringify(actual, null, 2);
|
|
128
|
+
chai_1.assert.equal(txt.match(/"type": "CDS"/g)?.length, 4);
|
|
129
|
+
const expected = readAnnotationFeatureSnapshot('test_data/example02.json');
|
|
130
|
+
compareFeatures(actual, expected);
|
|
131
|
+
});
|
|
132
|
+
(0, node_test_1.it)('Convert example 3', () => {
|
|
133
|
+
// NB: In example 3 (and in the other examples) mRNA10003 produces two proteins.
|
|
134
|
+
// In the other examples the two proteins are identified by sharing the same cds id.
|
|
135
|
+
// In example 3 instead each cds has a unique id so the two proteins are identified by the order they
|
|
136
|
+
// appear in the gff.
|
|
137
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(ex3);
|
|
138
|
+
const txt = JSON.stringify(actual, null, 2);
|
|
139
|
+
chai_1.assert.equal(txt.match(/"type": "CDS"/g)?.length, 4);
|
|
140
|
+
// const expected = readAnnotationFeatureSnapshot('test_data/example03.json')
|
|
141
|
+
// compareFeatures(actual, expected)
|
|
142
|
+
});
|
|
143
|
+
(0, node_test_1.it)('Convert example 4', () => {
|
|
144
|
+
const ft = JSON.stringify(ex4, null, 2);
|
|
145
|
+
chai_1.assert.equal(ft.match(/"type": "five_prime_UTR"/g)?.length, 6);
|
|
146
|
+
chai_1.assert.equal(ft.match(/"type": "three_prime_UTR"/g)?.length, 3);
|
|
147
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(ex4);
|
|
148
|
+
const txt = JSON.stringify(actual, null, 2);
|
|
149
|
+
chai_1.assert.equal(txt.match(/"type": "CDS"/g)?.length, 4);
|
|
150
|
+
chai_1.assert.equal(txt.match(/prime_UTR/g), null);
|
|
151
|
+
const expected = readAnnotationFeatureSnapshot('test_data/example04.json');
|
|
152
|
+
compareFeatures(actual, expected);
|
|
153
|
+
});
|
|
154
|
+
(0, node_test_1.it)('Convert braker gff', () => {
|
|
155
|
+
const [gffFeature] = readFeatureFile('test_data/braker.gff');
|
|
156
|
+
const actual = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(gffFeature);
|
|
157
|
+
const txt = JSON.stringify(actual, null, 2);
|
|
158
|
+
chai_1.assert.equal(txt.match(/intron/g), null);
|
|
159
|
+
chai_1.assert.equal(txt.match(/_codon/g), null);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
(0, node_test_1.describe)('gff3ToAnnotationFeature', () => {
|
|
163
|
+
for (const testCase of testCases) {
|
|
164
|
+
const [description, featureLine, convertedFeature] = testCase;
|
|
165
|
+
(0, node_test_1.it)(`converts ${description}`, () => {
|
|
166
|
+
const gff3Feature = gff_1.default.parseStringSync(featureLine, {
|
|
167
|
+
parseSequences: false,
|
|
168
|
+
});
|
|
169
|
+
const feature = (0, gff3ToAnnotationFeature_1.gff3ToAnnotationFeature)(gff3Feature[0]);
|
|
170
|
+
compareFeatures(convertedFeature, feature);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
//# sourceMappingURL=gff3ToAnnotationFeature.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gff3ToAnnotationFeature.test.js","sourceRoot":"","sources":["../../src/GFF3/gff3ToAnnotationFeature.test.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,yCAAwC;AACxC,qCAAsC;AAEtC,4DAA4C;AAC5C,+BAAkC;AAClC,wEAAsC;AAEtC,uEAAmE;AAGnE,IAAA,UAAG,EAAC,sBAAW,CAAC,CAAA;AAEhB,MAAM,SAAS,GAAkD;IAC/D;QACE,4BAA4B;QAC5B,iEAAiE;QACjE;YACE,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,IAAI;YACT,UAAU,EAAE;gBACV,UAAU,EAAE,CAAC,SAAS,CAAC;gBACvB,QAAQ,EAAE,CAAC,YAAY,CAAC;gBACxB,SAAS,EAAE,CAAC,KAAK,CAAC;aACnB;SACF;KACF;IACD;QACE,6BAA6B;QAC7B;;;CAGH;QACG;YACE,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;YACjB,GAAG,EAAE,IAAI;YACT,GAAG,EAAE,IAAI;YACT,MAAM,EAAE,CAAC;YACT,QAAQ,EAAE;gBACR,0BAA0B,EAAE;oBAC1B,GAAG,EAAE,0BAA0B;oBAC/B,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,YAAY;oBAClB,GAAG,EAAE,IAAI;oBACT,GAAG,EAAE,IAAI;oBACT,MAAM,EAAE,CAAC;oBACT,UAAU,EAAE;wBACV,UAAU,EAAE,CAAC,KAAK,CAAC;wBACnB,QAAQ,EAAE,CAAC,UAAU,CAAC;wBACtB,UAAU,EAAE,CAAC,gBAAgB,CAAC;qBAC/B;iBACF;gBACD,0BAA0B,EAAE;oBAC1B,GAAG,EAAE,0BAA0B;oBAC/B,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,YAA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K,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA;QACxC,aAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,IAAA,oBAAQ,EAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAA;QAC7D,IAAA,cAAE,EAAC,YAAY,WAAW,EAAE,EAAE,GAAG,EAAE;YACjC,MAAM,WAAW,GAAG,aAAG,CAAC,eAAe,CAAC,WAAW,EAAE;gBACnD,cAAc,EAAE,KAAK;aACtB,CAAC,CAAA;YACF,MAAM,OAAO,GAAG,IAAA,iDAAuB,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;YACvD,eAAe,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type GFFReservedAttribute = 'ID' | 'Name' | 'Alias' | 'Parent' | 'Target' | 'Gap' | 'Derives_from' | 'Note' | 'Dbxref' | 'Ontology_term' | 'Is_circular';
|
|
2
|
+
export type GFFInternalAttribute = 'gff_id' | 'gff_name' | 'gff_alias' | 'gff_parent' | 'gff_target' | 'gff_gap' | 'gff_derives_from' | 'gff_note' | 'gff_dbxref' | 'gff_ontology_term' | 'gff_is_circular';
|
|
3
|
+
export declare const gffToInternal: Record<GFFReservedAttribute, GFFInternalAttribute>;
|
|
4
|
+
export declare function isGFFReservedAttribute(attribute: string): attribute is GFFReservedAttribute;
|
|
5
|
+
export declare const internalToGFF: Record<GFFInternalAttribute, GFFReservedAttribute>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.internalToGFF = exports.gffToInternal = void 0;
|
|
4
|
+
exports.isGFFReservedAttribute = isGFFReservedAttribute;
|
|
5
|
+
exports.gffToInternal = {
|
|
6
|
+
ID: 'gff_id',
|
|
7
|
+
Name: 'gff_name',
|
|
8
|
+
Alias: 'gff_alias',
|
|
9
|
+
Parent: 'gff_parent',
|
|
10
|
+
Target: 'gff_target',
|
|
11
|
+
Gap: 'gff_gap',
|
|
12
|
+
Derives_from: 'gff_derives_from',
|
|
13
|
+
Note: 'gff_note',
|
|
14
|
+
Dbxref: 'gff_dbxref',
|
|
15
|
+
Ontology_term: 'gff_ontology_term',
|
|
16
|
+
Is_circular: 'gff_is_circular',
|
|
17
|
+
};
|
|
18
|
+
function isGFFReservedAttribute(attribute) {
|
|
19
|
+
return attribute in exports.gffToInternal;
|
|
20
|
+
}
|
|
21
|
+
exports.internalToGFF = {
|
|
22
|
+
gff_id: 'ID',
|
|
23
|
+
gff_name: 'Name',
|
|
24
|
+
gff_alias: 'Alias',
|
|
25
|
+
gff_parent: 'Parent',
|
|
26
|
+
gff_target: 'Target',
|
|
27
|
+
gff_gap: 'Gap',
|
|
28
|
+
gff_derives_from: 'Derives_from',
|
|
29
|
+
gff_note: 'Note',
|
|
30
|
+
gff_dbxref: 'Dbxref',
|
|
31
|
+
gff_ontology_term: 'Ontology_term',
|
|
32
|
+
gff_is_circular: 'Is_circular',
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=gffReservedKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gffReservedKeys.js","sourceRoot":"","sources":["../../src/GFF3/gffReservedKeys.ts"],"names":[],"mappings":";;;AAyCA,wDAIC;AAnBY,QAAA,aAAa,GACxB;IACE,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,GAAG,EAAE,SAAS;IACd,YAAY,EAAE,kBAAkB;IAChC,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,mBAAmB;IAClC,WAAW,EAAE,iBAAiB;CAC/B,CAAA;AAEH,SAAgB,sBAAsB,CACpC,SAAiB;IAEjB,OAAO,SAAS,IAAI,qBAAa,CAAA;AACnC,CAAC;AAEY,QAAA,aAAa,GACxB;IACE,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE,cAAc;IAChC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,QAAQ;IACpB,iBAAiB,EAAE,eAAe;IAClC,eAAe,EAAE,aAAa;CAC/B,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./gffReservedKeys"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./gff3ToAnnotationFeature"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/GFF3/index.ts"],"names":[],"mappings":";;;AAAA,4DAAiC;AACjC,oEAAyC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SerializedChange } from '@apollo-annotation/common';
|
|
2
|
+
import { CheckResultSnapshot } from '@apollo-annotation/mst';
|
|
3
|
+
interface BaseMessage {
|
|
4
|
+
channel: string;
|
|
5
|
+
userName: string;
|
|
6
|
+
userSessionId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ChangeMessage extends BaseMessage {
|
|
9
|
+
changeInfo: SerializedChange;
|
|
10
|
+
changeSequence: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CheckResultUpdate extends BaseMessage {
|
|
13
|
+
checkResult: CheckResultSnapshot;
|
|
14
|
+
deleted?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface UserLocation {
|
|
17
|
+
assemblyId: string;
|
|
18
|
+
refSeq: string;
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}
|
|
22
|
+
export interface UserLocationMessage extends BaseMessage {
|
|
23
|
+
locations: UserLocation[];
|
|
24
|
+
}
|
|
25
|
+
export interface RequestUserInformationMessage extends BaseMessage {
|
|
26
|
+
readonly reqType: 'CURRENT_LOCATION';
|
|
27
|
+
}
|
|
28
|
+
export {};
|
package/dist/Messages.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../src/Messages.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LocalGFF3DataStore, Operation, SerializedOperation, ServerDataStore } from '@apollo-annotation/common';
|
|
2
|
+
interface SerializedGetAssembliesOperation extends SerializedOperation {
|
|
3
|
+
typeName: 'GetAssembliesOperation';
|
|
4
|
+
}
|
|
5
|
+
export declare class GetAssembliesOperation extends Operation {
|
|
6
|
+
typeName: "GetAssembliesOperation";
|
|
7
|
+
toJSON(): SerializedGetAssembliesOperation;
|
|
8
|
+
executeOnServer(backend: ServerDataStore): Promise<(import("mongoose").Document<unknown, any, import("@apollo-annotation/schemas").AssemblyDocument> & Omit<import("@apollo-annotation/schemas").Assembly & Document & {
|
|
9
|
+
_id: import("mongoose").Types.ObjectId;
|
|
10
|
+
}, never>)[]>;
|
|
11
|
+
executeOnLocalGFF3(_backend: LocalGFF3DataStore): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAssembliesOperation = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/require-await */
|
|
5
|
+
const common_1 = require("@apollo-annotation/common");
|
|
6
|
+
class GetAssembliesOperation extends common_1.Operation {
|
|
7
|
+
typeName = 'GetAssembliesOperation';
|
|
8
|
+
toJSON() {
|
|
9
|
+
const { typeName } = this;
|
|
10
|
+
return { typeName };
|
|
11
|
+
}
|
|
12
|
+
executeOnServer(backend) {
|
|
13
|
+
return backend.assemblyModel.find({ status: 0 }).exec();
|
|
14
|
+
}
|
|
15
|
+
async executeOnLocalGFF3(_backend) {
|
|
16
|
+
throw new Error('executeOnLocalGFF3 not implemented');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.GetAssembliesOperation = GetAssembliesOperation;
|
|
20
|
+
//# sourceMappingURL=GetAssembliesOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetAssembliesOperation.js","sourceRoot":"","sources":["../../src/Operations/GetAssembliesOperation.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,sDAKkC;AAMlC,MAAa,sBAAuB,SAAQ,kBAAS;IACnD,QAAQ,GAAG,wBAAiC,CAAA;IAE5C,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QACzB,OAAO,EAAE,QAAQ,EAAE,CAAA;IACrB,CAAC;IAED,eAAe,CAAC,OAAwB;QACtC,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAA4B;QACnD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;CACF;AAfD,wDAeC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LocalGFF3DataStore, Operation, OperationOptions, SerializedOperation, ServerDataStore } from '@apollo-annotation/common';
|
|
2
|
+
interface SerializedGetFeaturesOperation extends SerializedOperation {
|
|
3
|
+
typeName: 'GetFeaturesOperation';
|
|
4
|
+
refSeq: string;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class GetFeaturesOperation extends Operation {
|
|
9
|
+
typeName: "GetFeaturesOperation";
|
|
10
|
+
refSeq: string;
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
constructor(json: SerializedGetFeaturesOperation, options?: OperationOptions);
|
|
14
|
+
toJSON(): SerializedGetFeaturesOperation;
|
|
15
|
+
/**
|
|
16
|
+
* Fetch features based on Reference seq, Start and End -values
|
|
17
|
+
* @param request - Contain search criteria i.e. refSeq, start and end -parameters
|
|
18
|
+
* @returns Return Array of features if search was successful
|
|
19
|
+
* or if search data was not found or in case of error throw exception
|
|
20
|
+
*/
|
|
21
|
+
executeOnServer(backend: ServerDataStore): Promise<(import("@apollo-annotation/schemas").FeatureDocument & Required<{
|
|
22
|
+
_id: import("mongoose").Types.ObjectId;
|
|
23
|
+
}>)[]>;
|
|
24
|
+
executeOnLocalGFF3(_backend: LocalGFF3DataStore): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetFeaturesOperation = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/require-await */
|
|
5
|
+
const common_1 = require("@apollo-annotation/common");
|
|
6
|
+
class GetFeaturesOperation extends common_1.Operation {
|
|
7
|
+
typeName = 'GetFeaturesOperation';
|
|
8
|
+
refSeq;
|
|
9
|
+
start;
|
|
10
|
+
end;
|
|
11
|
+
constructor(json, options) {
|
|
12
|
+
super(json, options);
|
|
13
|
+
this.refSeq = json.refSeq;
|
|
14
|
+
this.start = json.start;
|
|
15
|
+
this.end = json.end;
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
const { end, refSeq, start, typeName } = this;
|
|
19
|
+
return { typeName, refSeq, start, end };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetch features based on Reference seq, Start and End -values
|
|
23
|
+
* @param request - Contain search criteria i.e. refSeq, start and end -parameters
|
|
24
|
+
* @returns Return Array of features if search was successful
|
|
25
|
+
* or if search data was not found or in case of error throw exception
|
|
26
|
+
*/
|
|
27
|
+
executeOnServer(backend) {
|
|
28
|
+
return backend.featureModel
|
|
29
|
+
.find({
|
|
30
|
+
refSeq: this.refSeq,
|
|
31
|
+
min: { $lte: this.end },
|
|
32
|
+
max: { $gte: this.start },
|
|
33
|
+
status: 0,
|
|
34
|
+
})
|
|
35
|
+
.exec();
|
|
36
|
+
}
|
|
37
|
+
async executeOnLocalGFF3(_backend) {
|
|
38
|
+
throw new Error('executeOnLocalGFF3 not implemented');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.GetFeaturesOperation = GetFeaturesOperation;
|
|
42
|
+
//# sourceMappingURL=GetFeaturesOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetFeaturesOperation.js","sourceRoot":"","sources":["../../src/Operations/GetFeaturesOperation.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,sDAMkC;AASlC,MAAa,oBAAqB,SAAQ,kBAAS;IACjD,QAAQ,GAAG,sBAA+B,CAAA;IAC1C,MAAM,CAAQ;IACd,KAAK,CAAQ;IACb,GAAG,CAAQ;IAEX,YACE,IAAoC,EACpC,OAA0B;QAE1B,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACrB,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;IACzC,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,OAAwB;QACtC,OAAO,OAAO,CAAC,YAAY;aACxB,IAAI,CAAC;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE;YACvB,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE;YACzB,MAAM,EAAE,CAAC;SACV,CAAC;aACD,IAAI,EAAE,CAAA;IACX,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAA4B;QACnD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;CACF;AAzCD,oDAyCC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetAssembliesOperation } from './GetAssembliesOperation';
|
|
2
|
+
import { GetFeaturesOperation } from './GetFeaturesOperation';
|
|
3
|
+
export declare const operations: {
|
|
4
|
+
GetAssembliesOperation: typeof GetAssembliesOperation;
|
|
5
|
+
GetFeaturesOperation: typeof GetFeaturesOperation;
|
|
6
|
+
};
|
|
7
|
+
export * from './GetAssembliesOperation';
|
|
8
|
+
export * from './GetFeaturesOperation';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operations = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const GetAssembliesOperation_1 = require("./GetAssembliesOperation");
|
|
6
|
+
const GetFeaturesOperation_1 = require("./GetFeaturesOperation");
|
|
7
|
+
exports.operations = { GetAssembliesOperation: GetAssembliesOperation_1.GetAssembliesOperation, GetFeaturesOperation: GetFeaturesOperation_1.GetFeaturesOperation };
|
|
8
|
+
tslib_1.__exportStar(require("./GetAssembliesOperation"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./GetFeaturesOperation"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|