Commit a3ea2dcc authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Smaller tests

parent 5c73888c
......@@ -229,7 +229,7 @@ object Seqstat extends ToolCommand {
var key: Int = pos - phred_correction
if (key > 0) {
// count till the max of baseHistogram.length
for (histokey <- 0 until key) {
for (histokey <- 0 until key + 1) {
baseHistogram(histokey) += quals(pos)
}
}
......@@ -243,7 +243,7 @@ object Seqstat extends ToolCommand {
var key: Int = pos - phred_correction
if (key > 0) {
// count till the max of baseHistogram.length
for (histokey <- 0 until key) {
for (histokey <- 0 until key + 1) {
readHistogram(histokey) += readStats.qual(pos)
}
}
......@@ -290,7 +290,7 @@ object Seqstat extends ToolCommand {
("num_with_n", readStats.withN),
("num_total", readStats.qual.sum),
("len_min", readStats.lengths.takeWhile(_ == 0).length),
("len_max", readStats.lengths.length-1),
("len_max", readStats.lengths.length - 1),
("num_qual_gte", readQualHistoMap.toMap),
("qual_encoding", phred_encoding)
))
......@@ -298,6 +298,6 @@ object Seqstat extends ToolCommand {
)
val json_report: Json = ConfigUtils.mapToJson(report)
print(json_report.spaces2)
println(json_report.spaces2)
}
}
......@@ -43,7 +43,7 @@ class SeqstatTest extends TestNGSuite with MockitoSugar with Matchers {
when(fqMock.iterator) thenReturn recordsOver("1", "2", "3")
}
@Test(dataProvider = "mockReaderProvider", groups = Array("sanger"), singleThreaded = true)
@Test(dataProvider = "mockReaderProvider", groups = Array("read"), singleThreaded = true)
def testSeqCountReads(fqMock: FastqReader) = {
when(fqMock.iterator) thenReturn recordsOver("1", "2", "3", "4", "5")
......@@ -52,20 +52,40 @@ class SeqstatTest extends TestNGSuite with MockitoSugar with Matchers {
numReads shouldBe 5
}
@Test(dataProvider = "mockReaderProvider", groups = Array("sanger"), singleThreaded = true)
@Test(dataProvider = "mockReaderProvider", groups = Array("phredscore"), singleThreaded = true, dependsOnGroups = Array("read"))
def testEncodingDetectionSanger(fqMock: FastqReader) = {
when(fqMock.iterator) thenReturn recordsOver("1")
val seqstat = Seqstat
val numReads = seqstat.seqStat(fqMock)
numReads shouldBe 1
// val numReads = seqstat.seqStat(fqMock)
// numReads shouldBe 1
seqstat.summarize()
// TODO: divide into more testcases, instead of having in 1,
// currently not possible because the Seqstat is a bit state dependent?
seqstat.phred_correction shouldBe 33
seqstat.phred_encoding shouldBe "sanger"
// nucleotideHistoMap.values.sum shouldBe 5
// nucleotideHistoMap('N') shouldBe 1
// nucleotideHistoMap('A') shouldBe 1
}
@Test(dataProvider = "mockReaderProvider", groups = Array("nucleocount"), singleThreaded = true, dependsOnGroups = Array("phredscore"))
def testEncodingNucleotideCount(fqMock: FastqReader) = {
val seqstat = Seqstat
baseHistogram(40) shouldEqual 5
baseHistogram(39) shouldEqual 10
baseHistogram(34) shouldEqual 15
baseHistogram(33) shouldEqual 20
baseHistogram(0) shouldEqual 20
}
@Test(dataProvider = "mockReaderProvider", groups = Array("basehistogram"), singleThreaded = true, dependsOnGroups = Array("nucleocount"))
def testEncodingBaseHistogram(fqMock: FastqReader) = {
val seqstat = Seqstat
baseHistogram(40) shouldEqual 5
baseHistogram(39) shouldEqual 10
baseHistogram(34) shouldEqual 15
baseHistogram(33) shouldEqual 20
baseHistogram(0) shouldEqual 20
}
@Test def testArgsMinimum() = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment