Skip to content
Snippets Groups Projects
Commit 53855f50 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added fillAllele function

parent 20c25a0b
No related branches found
No related tags found
No related merge requests found
......@@ -9,11 +9,15 @@ object VcfUtils {
* Return longest allele of VariantContext.
*
* @param vcfRecord record to check
* @return allele with most nucleotides
* @return allele with most nucleotides
*/
def getLongestAllele(vcfRecord: VariantContext) = {
val alleles = vcfRecord.getAlleles
val longestAlleleId = alleles.map(_.getBases.length).zipWithIndex.maxBy(_._1)._2
alleles(longestAlleleId)
}
def fillAllele(bases: String, newSize: Int, fillWith: Char = 'N'): String = {
bases + (Array.fill[Char](newSize - bases.size)(fillWith)).mkString
}
}
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