@teselagen/bio-parsers 0.4.4 → 0.4.5
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/genbankToJson.d.ts +1 -0
- package/index.d.ts +1 -1
- package/index.js +42 -25
- package/index.mjs +42 -25
- package/index.umd.js +42 -25
- package/package.json +2 -2
- package/src/genbankToJson.js +51 -33
- package/src/index.js +1 -1
package/genbankToJson.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as anyToJson } from "./anyToJson";
|
|
2
2
|
export { default as fastaToJson } from "./fastaToJson";
|
|
3
|
-
export { default as genbankToJson } from "./genbankToJson";
|
|
4
3
|
export { default as sbolXmlToJson } from "./sbolXmlToJson";
|
|
5
4
|
export { default as geneiousXmlToJson } from "./geneiousXmlToJson";
|
|
6
5
|
export { default as jbeiXmlToJson } from "./jbeiXmlToJson";
|
|
@@ -12,5 +11,6 @@ export { default as cleanUpTeselagenJsonForExport } from "./utils/cleanUpTeselag
|
|
|
12
11
|
export { default as parseUracilFeatures } from "./utils/parseUracilFeatures";
|
|
13
12
|
export { default as jsonToJsonString } from "./jsonToJsonString";
|
|
14
13
|
export { default as validateSequenceArray } from "./utils/validateSequenceArray";
|
|
14
|
+
export { default as genbankToJson, parseFeatureLocation } from "./genbankToJson";
|
|
15
15
|
export { default as ab1ToJson, convertBasePosTraceToPerBpTrace } from "./ab1ToJson";
|
|
16
16
|
export { default as searchWholeObjByName, searchWholeObjByNameSimple, searchWholeObjByNameSimpleArray } from "./utils/searchWholeObjByName";
|
package/index.js
CHANGED
|
@@ -19779,6 +19779,30 @@ function flattenSequenceArray(parsingResultArray, opts) {
|
|
|
19779
19779
|
return parsingResultArray;
|
|
19780
19780
|
}
|
|
19781
19781
|
__name(flattenSequenceArray, "flattenSequenceArray");
|
|
19782
|
+
function parseFeatureLocation(locStr, isProtein, inclusive1BasedStart, inclusive1BasedEnd) {
|
|
19783
|
+
locStr = locStr.trim();
|
|
19784
|
+
const locArr = [];
|
|
19785
|
+
locStr.replace(/(\d+)/g, function(string, match) {
|
|
19786
|
+
locArr.push(match);
|
|
19787
|
+
});
|
|
19788
|
+
const locArray = [];
|
|
19789
|
+
for (let i = 0; i < locArr.length; i += 2) {
|
|
19790
|
+
const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
19791
|
+
let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
19792
|
+
if (isNaN(end)) {
|
|
19793
|
+
end = start;
|
|
19794
|
+
}
|
|
19795
|
+
const location = {
|
|
19796
|
+
start,
|
|
19797
|
+
end
|
|
19798
|
+
};
|
|
19799
|
+
locArray.push(
|
|
19800
|
+
isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
19801
|
+
);
|
|
19802
|
+
}
|
|
19803
|
+
return locArray;
|
|
19804
|
+
}
|
|
19805
|
+
__name(parseFeatureLocation, "parseFeatureLocation");
|
|
19782
19806
|
function genbankToJson(string, options = {}) {
|
|
19783
19807
|
const {
|
|
19784
19808
|
inclusive1BasedStart,
|
|
@@ -20103,7 +20127,15 @@ function genbankToJson(string, options = {}) {
|
|
|
20103
20127
|
}
|
|
20104
20128
|
if (isFeatureLineRunon(line, featureLocationIndentation)) {
|
|
20105
20129
|
if (lastLineWasLocation) {
|
|
20106
|
-
|
|
20130
|
+
const feat = getCurrentFeature();
|
|
20131
|
+
feat.locations = feat.locations.concat(
|
|
20132
|
+
parseFeatureLocation(
|
|
20133
|
+
line.trim(),
|
|
20134
|
+
options.isProtein,
|
|
20135
|
+
inclusive1BasedStart,
|
|
20136
|
+
inclusive1BasedEnd
|
|
20137
|
+
)
|
|
20138
|
+
);
|
|
20107
20139
|
lastLineWasLocation = true;
|
|
20108
20140
|
} else {
|
|
20109
20141
|
if (currentFeatureNote) {
|
|
@@ -20129,7 +20161,14 @@ function genbankToJson(string, options = {}) {
|
|
|
20129
20161
|
const feat = getCurrentFeature();
|
|
20130
20162
|
feat.type = key;
|
|
20131
20163
|
feat.strand = strand;
|
|
20132
|
-
|
|
20164
|
+
feat.locations = feat.locations.concat(
|
|
20165
|
+
parseFeatureLocation(
|
|
20166
|
+
val2,
|
|
20167
|
+
options.isProtein,
|
|
20168
|
+
inclusive1BasedStart,
|
|
20169
|
+
inclusive1BasedEnd
|
|
20170
|
+
)
|
|
20171
|
+
);
|
|
20133
20172
|
lastLineWasLocation = true;
|
|
20134
20173
|
}
|
|
20135
20174
|
}
|
|
@@ -20152,29 +20191,6 @@ function genbankToJson(string, options = {}) {
|
|
|
20152
20191
|
return qual;
|
|
20153
20192
|
}
|
|
20154
20193
|
__name(isNote, "isNote");
|
|
20155
|
-
function parseFeatureLocation(locStr, options2) {
|
|
20156
|
-
locStr = locStr.trim();
|
|
20157
|
-
const locArr = [];
|
|
20158
|
-
locStr.replace(/(\d+)/g, function(string2, match) {
|
|
20159
|
-
locArr.push(match);
|
|
20160
|
-
});
|
|
20161
|
-
for (let i = 0; i < locArr.length; i += 2) {
|
|
20162
|
-
const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
20163
|
-
let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
20164
|
-
if (isNaN(end)) {
|
|
20165
|
-
end = start;
|
|
20166
|
-
}
|
|
20167
|
-
const location = {
|
|
20168
|
-
start,
|
|
20169
|
-
end
|
|
20170
|
-
};
|
|
20171
|
-
const feat = getCurrentFeature();
|
|
20172
|
-
feat.locations.push(
|
|
20173
|
-
options2.isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
20174
|
-
);
|
|
20175
|
-
}
|
|
20176
|
-
}
|
|
20177
|
-
__name(parseFeatureLocation, "parseFeatureLocation");
|
|
20178
20194
|
function parseFeatureNote(line) {
|
|
20179
20195
|
let newLine;
|
|
20180
20196
|
newLine = line.trimLeft();
|
|
@@ -32765,6 +32781,7 @@ exports.jsonToBed = jsonToBed;
|
|
|
32765
32781
|
exports.jsonToFasta = jsonToFasta;
|
|
32766
32782
|
exports.jsonToGenbank = jsonToGenbank;
|
|
32767
32783
|
exports.jsonToJsonString = jsonToJsonString;
|
|
32784
|
+
exports.parseFeatureLocation = parseFeatureLocation;
|
|
32768
32785
|
exports.parseUracilFeatures = parseUracilFeatures;
|
|
32769
32786
|
exports.sbolXmlToJson = sbolXmlToJson;
|
|
32770
32787
|
exports.searchWholeObjByName = searchWholeObjByName;
|
package/index.mjs
CHANGED
|
@@ -19777,6 +19777,30 @@ function flattenSequenceArray(parsingResultArray, opts) {
|
|
|
19777
19777
|
return parsingResultArray;
|
|
19778
19778
|
}
|
|
19779
19779
|
__name(flattenSequenceArray, "flattenSequenceArray");
|
|
19780
|
+
function parseFeatureLocation(locStr, isProtein, inclusive1BasedStart, inclusive1BasedEnd) {
|
|
19781
|
+
locStr = locStr.trim();
|
|
19782
|
+
const locArr = [];
|
|
19783
|
+
locStr.replace(/(\d+)/g, function(string, match) {
|
|
19784
|
+
locArr.push(match);
|
|
19785
|
+
});
|
|
19786
|
+
const locArray = [];
|
|
19787
|
+
for (let i = 0; i < locArr.length; i += 2) {
|
|
19788
|
+
const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
19789
|
+
let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
19790
|
+
if (isNaN(end)) {
|
|
19791
|
+
end = start;
|
|
19792
|
+
}
|
|
19793
|
+
const location = {
|
|
19794
|
+
start,
|
|
19795
|
+
end
|
|
19796
|
+
};
|
|
19797
|
+
locArray.push(
|
|
19798
|
+
isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
19799
|
+
);
|
|
19800
|
+
}
|
|
19801
|
+
return locArray;
|
|
19802
|
+
}
|
|
19803
|
+
__name(parseFeatureLocation, "parseFeatureLocation");
|
|
19780
19804
|
function genbankToJson(string, options = {}) {
|
|
19781
19805
|
const {
|
|
19782
19806
|
inclusive1BasedStart,
|
|
@@ -20101,7 +20125,15 @@ function genbankToJson(string, options = {}) {
|
|
|
20101
20125
|
}
|
|
20102
20126
|
if (isFeatureLineRunon(line, featureLocationIndentation)) {
|
|
20103
20127
|
if (lastLineWasLocation) {
|
|
20104
|
-
|
|
20128
|
+
const feat = getCurrentFeature();
|
|
20129
|
+
feat.locations = feat.locations.concat(
|
|
20130
|
+
parseFeatureLocation(
|
|
20131
|
+
line.trim(),
|
|
20132
|
+
options.isProtein,
|
|
20133
|
+
inclusive1BasedStart,
|
|
20134
|
+
inclusive1BasedEnd
|
|
20135
|
+
)
|
|
20136
|
+
);
|
|
20105
20137
|
lastLineWasLocation = true;
|
|
20106
20138
|
} else {
|
|
20107
20139
|
if (currentFeatureNote) {
|
|
@@ -20127,7 +20159,14 @@ function genbankToJson(string, options = {}) {
|
|
|
20127
20159
|
const feat = getCurrentFeature();
|
|
20128
20160
|
feat.type = key;
|
|
20129
20161
|
feat.strand = strand;
|
|
20130
|
-
|
|
20162
|
+
feat.locations = feat.locations.concat(
|
|
20163
|
+
parseFeatureLocation(
|
|
20164
|
+
val2,
|
|
20165
|
+
options.isProtein,
|
|
20166
|
+
inclusive1BasedStart,
|
|
20167
|
+
inclusive1BasedEnd
|
|
20168
|
+
)
|
|
20169
|
+
);
|
|
20131
20170
|
lastLineWasLocation = true;
|
|
20132
20171
|
}
|
|
20133
20172
|
}
|
|
@@ -20150,29 +20189,6 @@ function genbankToJson(string, options = {}) {
|
|
|
20150
20189
|
return qual;
|
|
20151
20190
|
}
|
|
20152
20191
|
__name(isNote, "isNote");
|
|
20153
|
-
function parseFeatureLocation(locStr, options2) {
|
|
20154
|
-
locStr = locStr.trim();
|
|
20155
|
-
const locArr = [];
|
|
20156
|
-
locStr.replace(/(\d+)/g, function(string2, match) {
|
|
20157
|
-
locArr.push(match);
|
|
20158
|
-
});
|
|
20159
|
-
for (let i = 0; i < locArr.length; i += 2) {
|
|
20160
|
-
const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
20161
|
-
let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
20162
|
-
if (isNaN(end)) {
|
|
20163
|
-
end = start;
|
|
20164
|
-
}
|
|
20165
|
-
const location = {
|
|
20166
|
-
start,
|
|
20167
|
-
end
|
|
20168
|
-
};
|
|
20169
|
-
const feat = getCurrentFeature();
|
|
20170
|
-
feat.locations.push(
|
|
20171
|
-
options2.isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
20172
|
-
);
|
|
20173
|
-
}
|
|
20174
|
-
}
|
|
20175
|
-
__name(parseFeatureLocation, "parseFeatureLocation");
|
|
20176
20192
|
function parseFeatureNote(line) {
|
|
20177
20193
|
let newLine;
|
|
20178
20194
|
newLine = line.trimLeft();
|
|
@@ -32764,6 +32780,7 @@ export {
|
|
|
32764
32780
|
jsonToFasta,
|
|
32765
32781
|
jsonToGenbank,
|
|
32766
32782
|
jsonToJsonString,
|
|
32783
|
+
parseFeatureLocation,
|
|
32767
32784
|
parseUracilFeatures,
|
|
32768
32785
|
sbolXmlToJson,
|
|
32769
32786
|
searchWholeObjByName,
|
package/index.umd.js
CHANGED
|
@@ -19781,6 +19781,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19781
19781
|
return parsingResultArray;
|
|
19782
19782
|
}
|
|
19783
19783
|
__name(flattenSequenceArray, "flattenSequenceArray");
|
|
19784
|
+
function parseFeatureLocation(locStr, isProtein, inclusive1BasedStart, inclusive1BasedEnd) {
|
|
19785
|
+
locStr = locStr.trim();
|
|
19786
|
+
const locArr = [];
|
|
19787
|
+
locStr.replace(/(\d+)/g, function(string, match) {
|
|
19788
|
+
locArr.push(match);
|
|
19789
|
+
});
|
|
19790
|
+
const locArray = [];
|
|
19791
|
+
for (let i2 = 0; i2 < locArr.length; i2 += 2) {
|
|
19792
|
+
const start = parseInt(locArr[i2], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
19793
|
+
let end = parseInt(locArr[i2 + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
19794
|
+
if (isNaN(end)) {
|
|
19795
|
+
end = start;
|
|
19796
|
+
}
|
|
19797
|
+
const location = {
|
|
19798
|
+
start,
|
|
19799
|
+
end
|
|
19800
|
+
};
|
|
19801
|
+
locArray.push(
|
|
19802
|
+
isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
19803
|
+
);
|
|
19804
|
+
}
|
|
19805
|
+
return locArray;
|
|
19806
|
+
}
|
|
19807
|
+
__name(parseFeatureLocation, "parseFeatureLocation");
|
|
19784
19808
|
function genbankToJson(string, options = {}) {
|
|
19785
19809
|
const {
|
|
19786
19810
|
inclusive1BasedStart,
|
|
@@ -20105,7 +20129,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20105
20129
|
}
|
|
20106
20130
|
if (isFeatureLineRunon(line, featureLocationIndentation)) {
|
|
20107
20131
|
if (lastLineWasLocation) {
|
|
20108
|
-
|
|
20132
|
+
const feat = getCurrentFeature();
|
|
20133
|
+
feat.locations = feat.locations.concat(
|
|
20134
|
+
parseFeatureLocation(
|
|
20135
|
+
line.trim(),
|
|
20136
|
+
options.isProtein,
|
|
20137
|
+
inclusive1BasedStart,
|
|
20138
|
+
inclusive1BasedEnd
|
|
20139
|
+
)
|
|
20140
|
+
);
|
|
20109
20141
|
lastLineWasLocation = true;
|
|
20110
20142
|
} else {
|
|
20111
20143
|
if (currentFeatureNote) {
|
|
@@ -20131,7 +20163,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20131
20163
|
const feat = getCurrentFeature();
|
|
20132
20164
|
feat.type = key;
|
|
20133
20165
|
feat.strand = strand;
|
|
20134
|
-
|
|
20166
|
+
feat.locations = feat.locations.concat(
|
|
20167
|
+
parseFeatureLocation(
|
|
20168
|
+
val2,
|
|
20169
|
+
options.isProtein,
|
|
20170
|
+
inclusive1BasedStart,
|
|
20171
|
+
inclusive1BasedEnd
|
|
20172
|
+
)
|
|
20173
|
+
);
|
|
20135
20174
|
lastLineWasLocation = true;
|
|
20136
20175
|
}
|
|
20137
20176
|
}
|
|
@@ -20154,29 +20193,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20154
20193
|
return qual;
|
|
20155
20194
|
}
|
|
20156
20195
|
__name(isNote, "isNote");
|
|
20157
|
-
function parseFeatureLocation(locStr, options2) {
|
|
20158
|
-
locStr = locStr.trim();
|
|
20159
|
-
const locArr = [];
|
|
20160
|
-
locStr.replace(/(\d+)/g, function(string2, match) {
|
|
20161
|
-
locArr.push(match);
|
|
20162
|
-
});
|
|
20163
|
-
for (let i2 = 0; i2 < locArr.length; i2 += 2) {
|
|
20164
|
-
const start = parseInt(locArr[i2], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
20165
|
-
let end = parseInt(locArr[i2 + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
20166
|
-
if (isNaN(end)) {
|
|
20167
|
-
end = start;
|
|
20168
|
-
}
|
|
20169
|
-
const location = {
|
|
20170
|
-
start,
|
|
20171
|
-
end
|
|
20172
|
-
};
|
|
20173
|
-
const feat = getCurrentFeature();
|
|
20174
|
-
feat.locations.push(
|
|
20175
|
-
options2.isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
20176
|
-
);
|
|
20177
|
-
}
|
|
20178
|
-
}
|
|
20179
|
-
__name(parseFeatureLocation, "parseFeatureLocation");
|
|
20180
20196
|
function parseFeatureNote(line) {
|
|
20181
20197
|
let newLine;
|
|
20182
20198
|
newLine = line.trimLeft();
|
|
@@ -32767,6 +32783,7 @@ ${seq.sequence}
|
|
|
32767
32783
|
exports2.jsonToFasta = jsonToFasta;
|
|
32768
32784
|
exports2.jsonToGenbank = jsonToGenbank;
|
|
32769
32785
|
exports2.jsonToJsonString = jsonToJsonString;
|
|
32786
|
+
exports2.parseFeatureLocation = parseFeatureLocation;
|
|
32770
32787
|
exports2.parseUracilFeatures = parseUracilFeatures;
|
|
32771
32788
|
exports2.sbolXmlToJson = sbolXmlToJson;
|
|
32772
32789
|
exports2.searchWholeObjByName = searchWholeObjByName;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/bio-parsers",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@teselagen/sequence-utils": "0.3.
|
|
5
|
+
"@teselagen/sequence-utils": "0.3.12",
|
|
6
6
|
"@teselagen/range-utils": "0.3.7",
|
|
7
7
|
"@gmod/gff": "^1.2.1",
|
|
8
8
|
"buffer": "^6.0.3",
|
package/src/genbankToJson.js
CHANGED
|
@@ -8,6 +8,40 @@ import splitStringIntoLines from "./utils/splitStringIntoLines.js";
|
|
|
8
8
|
|
|
9
9
|
import createInitialSequence from "./utils/createInitialSequence";
|
|
10
10
|
|
|
11
|
+
export function parseFeatureLocation(
|
|
12
|
+
locStr,
|
|
13
|
+
isProtein,
|
|
14
|
+
inclusive1BasedStart,
|
|
15
|
+
inclusive1BasedEnd
|
|
16
|
+
) {
|
|
17
|
+
locStr = locStr.trim();
|
|
18
|
+
const locArr = [];
|
|
19
|
+
locStr.replace(/(\d+)/g, function (string, match) {
|
|
20
|
+
locArr.push(match);
|
|
21
|
+
});
|
|
22
|
+
const locArray = [];
|
|
23
|
+
for (let i = 0; i < locArr.length; i += 2) {
|
|
24
|
+
const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
25
|
+
let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
26
|
+
if (isNaN(end)) {
|
|
27
|
+
//if no end is supplied, assume that the end should be set to whatever the start is
|
|
28
|
+
//this makes a feature location passed as:
|
|
29
|
+
//147
|
|
30
|
+
//function like:
|
|
31
|
+
//147..147
|
|
32
|
+
end = start;
|
|
33
|
+
}
|
|
34
|
+
const location = {
|
|
35
|
+
start: start,
|
|
36
|
+
end: end
|
|
37
|
+
};
|
|
38
|
+
locArray.push(
|
|
39
|
+
isProtein ? convertAACaretPositionOrRangeToDna(location) : location
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return locArray;
|
|
43
|
+
}
|
|
44
|
+
|
|
11
45
|
function genbankToJson(string, options = {}) {
|
|
12
46
|
const {
|
|
13
47
|
inclusive1BasedStart,
|
|
@@ -428,7 +462,15 @@ function genbankToJson(string, options = {}) {
|
|
|
428
462
|
//the line is a continuation of the above line
|
|
429
463
|
if (lastLineWasLocation) {
|
|
430
464
|
//the last line was a location, so the run-on line is expected to be a feature location as well
|
|
431
|
-
|
|
465
|
+
const feat = getCurrentFeature();
|
|
466
|
+
feat.locations = feat.locations.concat(
|
|
467
|
+
parseFeatureLocation(
|
|
468
|
+
line.trim(),
|
|
469
|
+
options.isProtein,
|
|
470
|
+
inclusive1BasedStart,
|
|
471
|
+
inclusive1BasedEnd
|
|
472
|
+
)
|
|
473
|
+
);
|
|
432
474
|
lastLineWasLocation = true;
|
|
433
475
|
} else {
|
|
434
476
|
//the last line was a note
|
|
@@ -466,8 +508,14 @@ function genbankToJson(string, options = {}) {
|
|
|
466
508
|
const feat = getCurrentFeature();
|
|
467
509
|
feat.type = key;
|
|
468
510
|
feat.strand = strand;
|
|
469
|
-
|
|
470
|
-
|
|
511
|
+
feat.locations = feat.locations.concat(
|
|
512
|
+
parseFeatureLocation(
|
|
513
|
+
val,
|
|
514
|
+
options.isProtein,
|
|
515
|
+
inclusive1BasedStart,
|
|
516
|
+
inclusive1BasedEnd
|
|
517
|
+
)
|
|
518
|
+
);
|
|
471
519
|
lastLineWasLocation = true;
|
|
472
520
|
}
|
|
473
521
|
}
|
|
@@ -495,36 +543,6 @@ function genbankToJson(string, options = {}) {
|
|
|
495
543
|
return qual;
|
|
496
544
|
}
|
|
497
545
|
|
|
498
|
-
function parseFeatureLocation(locStr, options) {
|
|
499
|
-
locStr = locStr.trim();
|
|
500
|
-
const locArr = [];
|
|
501
|
-
locStr.replace(/(\d+)/g, function (string, match) {
|
|
502
|
-
locArr.push(match);
|
|
503
|
-
});
|
|
504
|
-
for (let i = 0; i < locArr.length; i += 2) {
|
|
505
|
-
const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
|
|
506
|
-
let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
|
|
507
|
-
if (isNaN(end)) {
|
|
508
|
-
//if no end is supplied, assume that the end should be set to whatever the start is
|
|
509
|
-
//this makes a feature location passed as:
|
|
510
|
-
//147
|
|
511
|
-
//function like:
|
|
512
|
-
//147..147
|
|
513
|
-
end = start;
|
|
514
|
-
}
|
|
515
|
-
const location = {
|
|
516
|
-
start: start,
|
|
517
|
-
end: end
|
|
518
|
-
};
|
|
519
|
-
const feat = getCurrentFeature();
|
|
520
|
-
feat.locations.push(
|
|
521
|
-
options.isProtein
|
|
522
|
-
? convertAACaretPositionOrRangeToDna(location)
|
|
523
|
-
: location
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
546
|
function parseFeatureNote(line) {
|
|
529
547
|
let newLine;
|
|
530
548
|
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as anyToJson } from "./anyToJson";
|
|
2
2
|
export { default as fastaToJson } from "./fastaToJson";
|
|
3
|
-
export { default as genbankToJson } from "./genbankToJson";
|
|
3
|
+
export { default as genbankToJson, parseFeatureLocation } from "./genbankToJson";
|
|
4
4
|
export { default as sbolXmlToJson } from "./sbolXmlToJson";
|
|
5
5
|
export { default as geneiousXmlToJson } from "./geneiousXmlToJson";
|
|
6
6
|
export { default as jbeiXmlToJson } from "./jbeiXmlToJson";
|