@teselagen/bio-parsers 0.3.7 → 0.3.9

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.
@@ -40,7 +40,7 @@ export default function validateSequence(sequence, options = {}) {
40
40
  "isSingleStrandedDNA",
41
41
  "isDoubleStrandedRNA",
42
42
  "isProtein"
43
- ].forEach((k) => {
43
+ ].forEach(k => {
44
44
  if (options[k] !== undefined && sequence[k] === undefined) {
45
45
  sequence[k] = options[k];
46
46
  }
@@ -110,11 +110,16 @@ export default function validateSequence(sequence, options = {}) {
110
110
  //todo: this logic won't catch every case of RNA, so we should probably handle RNA conversion at another level..
111
111
  const temp = sequence.sequence;
112
112
  if (!sequence.isOligo) {
113
- sequence.sequence = sequence.sequence.replace(/u/gi, (u) =>
113
+ sequence.sequence = sequence.sequence.replace(/u/gi, u =>
114
114
  u === "U" ? "T" : "t"
115
115
  );
116
116
  }
117
- if (temp !== sequence.sequence && !sequence.isDNA && !sequence.isProtein && sequence.isRNA !== false) {
117
+ if (
118
+ temp !== sequence.sequence &&
119
+ !sequence.isDNA &&
120
+ !sequence.isProtein &&
121
+ sequence.isRNA !== false
122
+ ) {
118
123
  sequence.type = "RNA";
119
124
  sequence.sequence = temp;
120
125
  } else {
@@ -294,16 +299,16 @@ export default function validateSequence(sequence, options = {}) {
294
299
  }
295
300
  if (
296
301
  feature.notes.pragma &&
297
- some(feature.notes.pragma, (p) => p === "overlapsSelf")
302
+ some(feature.notes.pragma, p => p === "overlapsSelf")
298
303
  ) {
299
304
  feature.overlapsSelf = true;
300
305
  feature.notes.pragma = filter(
301
306
  feature.notes.pragma,
302
- (p) => p !== "overlapsSelf"
307
+ p => p !== "overlapsSelf"
303
308
  );
304
309
  }
305
310
  feature.notes.note &&
306
- some(feature.notes.note, (n) => {
311
+ some(feature.notes.note, n => {
307
312
  if (
308
313
  n &&
309
314
  typeof n === "string" &&
@@ -312,7 +317,7 @@ export default function validateSequence(sequence, options = {}) {
312
317
  //remove it after we're parsed it out
313
318
  feature.notes.note = filter(
314
319
  feature.notes.note,
315
- (p) => p && !p.toLowerCase().includes("sequence:")
320
+ p => p && !p.toLowerCase().includes("sequence:")
316
321
  );
317
322
  if (feature.notes.note.length === 0) {
318
323
  delete feature.notes.note;
@@ -328,7 +333,7 @@ export default function validateSequence(sequence, options = {}) {
328
333
  });
329
334
 
330
335
  feature.notes.primerBindsOn &&
331
- some(feature.notes.primerBindsOn, (n) => {
336
+ some(feature.notes.primerBindsOn, n => {
332
337
  if (n) {
333
338
  feature.primerBindsOn = n;
334
339
  delete feature.notes.primerBindsOn;
@@ -339,7 +344,7 @@ export default function validateSequence(sequence, options = {}) {
339
344
  if (
340
345
  options[`accept${upperFirst(type)}`] !== false && //acceptParts, acceptWarnings,
341
346
  feature.notes.pragma &&
342
- some(feature.notes.pragma, (p) => p === pragma)
347
+ some(feature.notes.pragma, p => p === pragma)
343
348
  ) {
344
349
  if (!sequence[type]) {
345
350
  sequence[type] = []; //initialize an empty array if necessary
@@ -351,7 +356,7 @@ export default function validateSequence(sequence, options = {}) {
351
356
  }
352
357
  }
353
358
  forEach(feature.notes, (noteArray, key) => {
354
- feature.notes[key] = map(noteArray, (note) => {
359
+ feature.notes[key] = map(noteArray, note => {
355
360
  return unmangleUrls(note);
356
361
  });
357
362
  });
@@ -1,20 +1,20 @@
1
- import validateSequence from './validateSequence.js';
1
+ import validateSequence from "./validateSequence.js";
2
2
 
3
3
  export default function validateSequenceArray(parsingResultArray, options) {
4
- if (parsingResultArray) {
5
- if (!Array.isArray(parsingResultArray)) {
6
- //wrap the parsingResult into an array if it isn't one already
7
- parsingResultArray = [parsingResultArray];
8
- }
9
- //should convert the old data type to the new data type (flattened sequence)
10
- parsingResultArray.forEach(function(parsingResult) {
11
- if (parsingResult.success) {
12
- const res = validateSequence(parsingResult.parsedSequence, options);
13
- //add any validation error messages to the parsed sequence results messages
14
- parsingResult.messages = parsingResult.messages.concat(res.messages);
15
- parsingResult.parsedSequence = res.validatedAndCleanedSequence;
16
- }
17
- });
4
+ if (parsingResultArray) {
5
+ if (!Array.isArray(parsingResultArray)) {
6
+ //wrap the parsingResult into an array if it isn't one already
7
+ parsingResultArray = [parsingResultArray];
18
8
  }
19
- return parsingResultArray;
20
- };
9
+ //should convert the old data type to the new data type (flattened sequence)
10
+ parsingResultArray.forEach(function (parsingResult) {
11
+ if (parsingResult.success) {
12
+ const res = validateSequence(parsingResult.parsedSequence, options);
13
+ //add any validation error messages to the parsed sequence results messages
14
+ parsingResult.messages = parsingResult.messages.concat(res.messages);
15
+ parsingResult.parsedSequence = res.validatedAndCleanedSequence;
16
+ }
17
+ });
18
+ }
19
+ return parsingResultArray;
20
+ }
@@ -1 +1 @@
1
- export default function getArrayBufferFromFile(file: any): ArrayBuffer | Promise<any>;
1
+ export default function getArrayBufferFromFile(file: any): Promise<any> | ArrayBuffer;