Created
June 11, 2019 05:53
-
-
Save clintval/9c91ad288bc4e8c7f39f3267c4a507de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** Implicit methods for [[Template]] objects. */ | |
| implicit class TemplateUtil(val t: Template) { | |
| private def tagValue[A](records: Iterator[SamRecord], tag: String): Iterator[Option[A]] = records.map(_.get[A](tag)) | |
| def bestEditDistanceToReference(t: Template): Option[Int] = tagValue[Int](t.allReads, SAMTag.NM.name).min | |
| def worstEditDistanceToReference(t: Template): Option[Int] = tagValue[Int](t.allReads, SAMTag.NM.name).max | |
| def bestAlignmentScore(t: Template): Option[Int] = tagValue[Int](t.allReads, SAMTag.AS.name).max | |
| def worstAlignmentScore(t: Template): Option[Int] = tagValue[Int](t.allReads, SAMTag.AS.name).min | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment