Skip to content

Commit

Permalink
adding reverseSequenceString fn
Browse files Browse the repository at this point in the history
  • Loading branch information
tnrich committed May 19, 2022
1 parent c0d8de1 commit 3c4660b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ve-sequence-utils",
"version": "5.1.14",
"version": "5.1.15",
"description": "sequence utility functions",
"main": "lib",
"//types": "./index.d.ts",
Expand Down
17 changes: 2 additions & 15 deletions src/getReverseSequenceString.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
const DNAComplementMap = require("./DNAComplementMap");
// const ac = require('ve-api-check');
// ac.throw([ac.string,ac.bool],arguments);
module.exports = function getReverseSequenceString(sequence) {
// ac.throw([ac.string],arguments);
let reverseSequenceString = "";
for (let i = sequence.length - 1; i >= 0; i--) {
let revChar = sequence[i];
if (!revChar) {
revChar = sequence[i];
// throw new Error('trying to get the reverse of an invalid base');
}
reverseSequenceString += revChar;
}
return reverseSequenceString;
module.exports = function getReverseSequenceString(s) {
return [...s].reverse().join("");
};
2 changes: 0 additions & 2 deletions src/getReverseSequenceString.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const chai = require("chai");
chai.should();
const chaiSubset = require("chai-subset");
chai.use(chaiSubset);
const getReverseSequenceString = require("./getReverseSequenceString");
describe("getReverseSequenceAndAnnotations", function() {
it("handles a range option correctly and reverse complements a subset of the sequence across the origin ", function() {
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports.getReverseComplementAminoAcidStringFromSequenceString = require("
module.exports.getReverseComplementAnnotation = require("./getReverseComplementAnnotation");
module.exports.getReverseComplementSequenceAndAnnotations = require("./getReverseComplementSequenceAndAnnotations");
module.exports.getReverseComplementSequenceString = require("./getReverseComplementSequenceString");
module.exports.getReverseSequenceString = require("./getReverseSequenceString");
module.exports.getSequenceDataBetweenRange = require("./getSequenceDataBetweenRange");
module.exports.guessIfSequenceIsDnaAndNotProtein = require("./guessIfSequenceIsDnaAndNotProtein");
module.exports.insertSequenceDataAtPosition = require("./insertSequenceDataAtPosition");
Expand Down

0 comments on commit 3c4660b

Please sign in to comment.