Commit 54673e3d authored by Sander Bollen's avatar Sander Bollen
Browse files

basty generate fasta test stub

parent 5f0512b5
......@@ -155,7 +155,7 @@ object BastyGenerateFasta extends ToolCommand {
}
}
protected var cmdArgs: Args = _
protected implicit var cmdArgs: Args = _
private val chunkSize = 100000
/**
......@@ -253,7 +253,7 @@ object BastyGenerateFasta extends ToolCommand {
}
}
protected def writeVariantsOnly() {
protected[tools] def writeVariantsOnly() {
val writer = new PrintWriter(cmdArgs.outputVariants)
writer.println(">" + cmdArgs.outputName)
val vcfReader = new VCFFileReader(cmdArgs.inputVcf, false)
......@@ -265,7 +265,10 @@ object BastyGenerateFasta extends ToolCommand {
vcfReader.close()
}
protected def getMaxAllele(vcfRecord: VariantContext): String = {
// TODO: what does this do?
// Seems to me it finds the allele in a sample with the highest AD value
// if this allele is shorter than the largest allele, it will append '-' to the string
protected[tools] def getMaxAllele(vcfRecord: VariantContext)(implicit cmdArgs: Args): String = {
val maxSize = getLongestAllele(vcfRecord).getBases.length
if (cmdArgs.sampleName == null) return fillAllele(vcfRecord.getReference.getBaseString, maxSize)
......
package nl.lumc.sasc.biopet.tools
import java.io.File
import java.nio.file.Paths
import htsjdk.variant.vcf.VCFFileReader
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
import org.scalatest.mock.MockitoSugar
import org.mockito.Mockito._
/**
* Created by ahbbollen on 13-8-15.
*/
class BastyGenerateFastaTest extends TestNGSuite with MockitoSugar with Matchers {
import BastyGenerateFasta._
private def resourcePath(p: String): String = {
Paths.get(getClass.getResource(p).toURI).toString
}
val vepped_path = resourcePath("/VEP_oneline.vcf")
val vepped = new File(vepped_path)
@Test def testGetMaxAllele = {
val reader = new VCFFileReader(vepped, false)
val record = reader.iterator().next()
val child = mock[Args]
when(child.sampleName) thenReturn "Child_7006504"
val father = mock[Args]
when(father.sampleName) thenReturn "Father_7006506"
getMaxAllele(record)(child) shouldBe "C-"
getMaxAllele(record)(father) shouldBe "CA"
}
}
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