Commit ad79e773 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Merge branch 'fix-seqstat-arraysize' into 'develop'

Seqstat: length array was too short for keeping the readlengths.

the array was too short

See merge request !349
parents dbb7f928 6f9b083d
......@@ -130,7 +130,7 @@ object SeqStat extends ToolCommand {
baseStats ++= mutable.ArrayBuffer.fill(record.length - baseStats.length)(BaseStat())
}
if (readStats.lengths.length < record.length) {
if (readStats.lengths.length <= record.length) {
readStats.lengths ++= mutable.ArrayBuffer.fill(record.length - readStats.lengths.length + 1)(0)
}
......
......@@ -109,6 +109,21 @@ class SeqStatTest extends TestNGSuite with MockitoSugar with Matchers {
}
@Test(dataProvider = "mockReaderProvider", groups = Array("check_readstats"), singleThreaded = true, dependsOnGroups = Array("report"))
def testReadStatsObject(fqMock: FastqReader) = {
when(fqMock.getFile) thenReturn new File("/tmp/test.fq")
when(fqMock.iterator) thenReturn recordsOver("1", "2", "3", "4", "5")
val seqstat = SeqStat
// the histogram should store the lenght==0 value also, for example sequence length 5 is size 6.
// please note that we already loaded the dataset twice in seqstat. (seqstat.Seqstat is called 2 times in previous steps)
seqstat.readStats.lengths(5) shouldBe 10
seqstat.readStats.lengths.length shouldBe 6
seqstat.readStats.nucs.sum shouldBe 50
seqstat.readStats.withN shouldBe 10
}
@Test def testArgsMinimum() = {
val args = Array(
"-i", resourcePath("/paired01a.fq"))
......
Markdown is supported
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