Skip to content

Commit

Permalink
Add test for Alignment.revcomped
Browse files Browse the repository at this point in the history
  • Loading branch information
tfenne committed Nov 11, 2021
1 parent 87b6416 commit 8f63f9b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/scala/com/fulcrumgenomics/alignment/AlignmentTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,26 @@ class AlignmentTest extends UnitSpec {
alignment.subByTarget(6, 10).cigar.toString() shouldBe "5D"
alignment.subByTarget(6, 11).cigar.toString() shouldBe "5D1="
}

"Alignment.revcomped" should "reverse complement a simple alignment" in {
val in = Alignment("TTTTT", "TTTTT", 1, 1, Cigar("5M"), 5)
val rc = in.revcomped
rc.query.map(_.toChar).mkString shouldBe "AAAAA"
rc.target.map(_.toChar).mkString shouldBe "AAAAA"
rc.queryStart shouldBe 1
rc.targetStart shouldBe 1
rc.cigar.toString shouldBe "5M"
rc.score shouldBe 5
}

it should "correctly reverse a non-global alignment" in {
val in = Alignment("..GTAACCGGTT".filter(_ != '.'), "ACGTAA.CGGTTCCCCC".filter(_ != '.'), 1, 3, Cigar("5M1I4M"), 10)
val rc = in.revcomped
rc.query.map(_.toChar).mkString shouldBe "AACCGGTTAC"
rc.target.map(_.toChar).mkString shouldBe "GGGGGAACCGTTACGT"
rc.queryStart shouldBe 1
rc.targetStart shouldBe 6
rc.cigar.toString shouldBe "4M1I5M"
rc.score shouldBe 10
}
}

0 comments on commit 8f63f9b

Please sign in to comment.