-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a loose mode to guessIfSequenceIsDnaAndNotProtein
- Loading branch information
Showing
2 changed files
with
40 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
const chai = require("chai"); | ||
chai.should(); | ||
const guessIfSequenceIsDnaAndNotProtein = require('./guessIfSequenceIsDnaAndNotProtein') | ||
describe('guessIfSequenceIsDnaAndNotProtein', function() { | ||
it('should correctly guess that a DNA seq is DNA', function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacc").should.equal(true) | ||
}) | ||
it('should correctly guess that a DNA seq with some ambiguity is a DNA', function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacctaacn").should.equal(true) | ||
}) | ||
it('should correctly guess that a seq with lots of ambiguity is a protein', function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacybctaacn").should.equal(false) | ||
}) | ||
it('should correctly guess that a DNA with lots of ambiguities is dna when the threshold is lower ', function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacybctaacn", { | ||
threshold: .5 | ||
}).should.equal(true) | ||
}) | ||
it('should correctly guess that a DNA with lots of ambiguity is a dna when the ambiguous letter is included ', function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatanccnnntaacn", {dnaLetters: ["g",'a', 't', 'c', 'n']}).should.equal(true) | ||
}) | ||
}) | ||
const guessIfSequenceIsDnaAndNotProtein = require("./guessIfSequenceIsDnaAndNotProtein"); | ||
describe("guessIfSequenceIsDnaAndNotProtein", function() { | ||
it("should default to DNA for a length 0 sequecne", function() { | ||
guessIfSequenceIsDnaAndNotProtein("").should.equal(true); | ||
}); | ||
it("should correctly guess that a DNA seq is DNA", function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacc").should.equal(true); | ||
}); | ||
it("should correctly guess that a DNA seq with some ambiguity is a DNA", function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacctaacn").should.equal(true); | ||
}); | ||
it("should correctly guess that a seq with lots of ambiguity is a protein when in the default strict mode", function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacybctaacn", { | ||
loose: false | ||
}).should.equal(false); | ||
}); | ||
it("should correctly guess that a seq with lots of ambiguity is dna when in the loose mode", function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacybctaacn", { | ||
loose: true | ||
}).should.equal(true); | ||
}); | ||
it("should correctly guess that a DNA with lots of ambiguities is dna when the threshold is lower ", function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatacybctaacn", { | ||
threshold: 0.5 | ||
}).should.equal(true); | ||
}); | ||
it("should correctly guess that a DNA with lots of ambiguity is a dna when the ambiguous letter is included ", function() { | ||
guessIfSequenceIsDnaAndNotProtein("gtatanccnnntaacn", { | ||
dnaLetters: ["g", "a", "t", "c", "n"] | ||
}).should.equal(true); | ||
}); | ||
}); |