Skip to content

Commit

Permalink
Merge pull request #9 from TeselaGen/aligningshortseqreads
Browse files Browse the repository at this point in the history
Aligningshortseqreads
  • Loading branch information
tiffanydai authored May 3, 2018
2 parents ad9b8b8 + 9bd81e3 commit 7d7cd26
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 17 deletions.
359 changes: 359 additions & 0 deletions src/addGapsToSeqReads.js

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions src/addGapsToSeqReads.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions src/deleteSequenceDataAtRange.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// tap.mochaGlobals();
const chai = require("chai");
const { getRangeLength } = require("ve-range-utils");
const {cloneDeep} = require('lodash');
const { cloneDeep } = require("lodash");

chai.should();
const chaiSubset = require("chai-subset");
Expand All @@ -27,14 +27,16 @@ describe("deleteSequenceDataAtRange", function() {
sequence: "atagatag",
features: {
"1": {
start: 7, end:7}
start: 7,
end: 7
}
}
};
const clonedExistingSeq = cloneDeep(existingSequence)
const clonedExistingSeq = cloneDeep(existingSequence);
let range = { start: 3, end: 5 };
let postDeleteSeqData = deleteSequenceDataAtRange(existingSequence, range);
existingSequence.should.deep.equal(clonedExistingSeq)
console.log('existingSequence:',existingSequence)
existingSequence.should.deep.equal(clonedExistingSeq);
// console.log('existingSequence:',existingSequence)
postDeleteSeqData.sequence.length.should.equal(
existingSequence.sequence.length - getRangeLength(range)
);
Expand All @@ -61,7 +63,7 @@ describe("deleteSequenceDataAtRange", function() {
start: 3,
end: 7
});
console.log("post:", postDeleteSeqData);
// console.log("post:", postDeleteSeqData);
postDeleteSeqData.should.containSubset({
sequence: "atgga",
features: [{ start: 0, end: 4 }]
Expand All @@ -77,7 +79,7 @@ describe("deleteSequenceDataAtRange", function() {
start: 3,
end: 3
});
console.log("post:", postDeleteSeqData);
// console.log("post:", postDeleteSeqData);
postDeleteSeqData.should.containSubset({
sequence: "atggagaga",
parts: [{ start: 4, end: 8 }]
Expand Down
28 changes: 18 additions & 10 deletions src/findSequenceMatches.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ describe("findSequenceMatches", function() {
]);
});
it("non-ambiguous, dna searches for nothing results in empty array", function() {
const matches = findSequenceMatches("atg", "*", { });
const matches = findSequenceMatches("atg", "*", {});
expect(matches).toEqual([]);
});
it("ambiguous, protein searches for nothing results in empty array", function() {
const matches = findSequenceMatches("atg", "*", { isProteinSearch: true, isAmbiguous: true });
const matches = findSequenceMatches("atg", "*", {
isProteinSearch: true,
isAmbiguous: true
});
expect(matches).toEqual([]);
});
it("ambiguous, dna searches for nothing results in empty array", function() {
Expand All @@ -69,12 +72,14 @@ describe("findSequenceMatches", function() {
it(" AA with * as stop codon", function() {
expect(
findSequenceMatches("atgtaaccc", "M**", { isProteinSearch: true })
).toEqual([
]);
).toEqual([]);
});
it("works with ambiguous AA", function() {
expect(
findSequenceMatches("atgatg", "MX", { isProteinSearch: true, isAmbiguous: true })
findSequenceMatches("atgatg", "MX", {
isProteinSearch: true,
isAmbiguous: true
})
).toEqual([
{
start: 0,
Expand All @@ -84,7 +89,10 @@ describe("findSequenceMatches", function() {
});
it("works with ambiguous AA with * in search string", function() {
expect(
findSequenceMatches("atgtaa", "M*", { isProteinSearch: true, isAmbiguous: true })
findSequenceMatches("atgtaa", "M*", {
isProteinSearch: true,
isAmbiguous: true
})
).toEqual([
{
start: 0,
Expand Down Expand Up @@ -173,10 +181,10 @@ describe("findSequenceMatches", function() {
{ bottomStrand: true, end: 2, start: 2 },
{ bottomStrand: true, end: 1, start: 1 }
]);
console.log(
'findSequenceMatches("atg", "n", { isAmbiguous: true }):',
findSequenceMatches("atg", "n", { isAmbiguous: true })
);
// console.log(
// 'findSequenceMatches("atg", "n", { isAmbiguous: true }):',
// findSequenceMatches("atg", "n", { isAmbiguous: true })
// );
expect(
findSequenceMatches("atg", "n", {
isAmbiguous: true,
Expand Down
Loading

0 comments on commit 7d7cd26

Please sign in to comment.