Skip to content
Snippets Groups Projects
Commit 4fb0abab authored by bow's avatar bow
Browse files

Unit test updates

parent 7930bcb4
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ class ExtractAlignedFastqUnitTest extends TestNGSuite with Matchers { ...@@ -96,7 +96,7 @@ class ExtractAlignedFastqUnitTest extends TestNGSuite with Matchers {
def testSingleBamDefault(name: String, feat: Feature, inAln: File, def testSingleBamDefault(name: String, feat: Feature, inAln: File,
fastqMap: Map[String, FastqPair], resultMap: Map[String, Boolean]) = { fastqMap: Map[String, FastqPair], resultMap: Map[String, Boolean]) = {
require(resultMap.keySet == fastqMap.keySet) require(resultMap.keySet == fastqMap.keySet)
val memFunc = makeMembershipFunction(Iterable(feat), inAln) val memFunc = makeMembershipFunction(Iterator(feat), inAln)
for ((key, (rec1, rec2)) <- fastqMap) { for ((key, (rec1, rec2)) <- fastqMap) {
withClue(makeClue(name, inAln, key)) { withClue(makeClue(name, inAln, key)) {
memFunc(rec1, rec2) shouldBe resultMap(key) memFunc(rec1, rec2) shouldBe resultMap(key)
...@@ -104,6 +104,33 @@ class ExtractAlignedFastqUnitTest extends TestNGSuite with Matchers { ...@@ -104,6 +104,33 @@ class ExtractAlignedFastqUnitTest extends TestNGSuite with Matchers {
} }
} }
@DataProvider(name = "singleAlnProvider2", parallel = true)
def singleAlnProvider2() = {
val sFastq2 = makeSingleRecords("r01", "r02", "r04", "r07", "r06", "r08")
val sFastq2Default = sFastq2.keys.map(x => (x, false)).toMap
val sBam02 = resourceFile("/single02.bam")
Array(
Array("less than minimum MAPQ",
makeFeature("chrQ", 830, 890), sBam02, 60, sFastq2, sFastq2Default),
Array("greater than minimum MAPQ",
makeFeature("chrQ", 830, 890), sBam02, 20, sFastq2, sFastq2Default.updated("r07", true)),
Array("equal to minimum MAPQ",
makeFeature("chrQ", 260, 320), sBam02, 30, sFastq2, sFastq2Default.updated("r01", true))
)
}
@Test(dataProvider = "singleAlnProvider2")
def testSingleBamMinMapQ(name: String, feat: Feature, inAln: File, minMapQ: Int,
fastqMap: Map[String, FastqPair], resultMap: Map[String, Boolean]) = {
require(resultMap.keySet == fastqMap.keySet)
val memFunc = makeMembershipFunction(Iterator(feat), inAln, minMapQ)
for ((key, (rec1, rec2)) <- fastqMap) {
withClue(makeClue(name, inAln, key)) {
memFunc(rec1, rec2) shouldBe resultMap(key)
}
}
}
@DataProvider(name = "pairAlnProvider1", parallel = true) @DataProvider(name = "pairAlnProvider1", parallel = true)
def pairAlnProvider1() = { def pairAlnProvider1() = {
val pFastq1 = makePairRecords( val pFastq1 = makePairRecords(
...@@ -135,7 +162,7 @@ class ExtractAlignedFastqUnitTest extends TestNGSuite with Matchers { ...@@ -135,7 +162,7 @@ class ExtractAlignedFastqUnitTest extends TestNGSuite with Matchers {
def testPairBamDefault(name: String, feat: Feature, inAln: File, def testPairBamDefault(name: String, feat: Feature, inAln: File,
fastqMap: Map[String, FastqPair], resultMap: Map[String, Boolean]) = { fastqMap: Map[String, FastqPair], resultMap: Map[String, Boolean]) = {
require(resultMap.keySet == fastqMap.keySet) require(resultMap.keySet == fastqMap.keySet)
val memFunc = makeMembershipFunction(Iterable(feat), inAln, commonSuffixLength = 2) val memFunc = makeMembershipFunction(Iterator(feat), inAln, commonSuffixLength = 2)
for ((key, (rec1, rec2)) <- fastqMap) { for ((key, (rec1, rec2)) <- fastqMap) {
withClue(makeClue(name, inAln, key)) { withClue(makeClue(name, inAln, key)) {
memFunc(rec1, rec2) shouldBe resultMap(key) memFunc(rec1, rec2) shouldBe resultMap(key)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment