We've moved!
This site is now read-only. You can find our new documentation site and support forum for posting questions here.
Be sure to read our welcome blog!

help with Variant Recalibrator in scala script

estif74estif74 Saint Paul, MN, USAMember

Hi there,

I'm trying to write a simple scala script to run Variant Recalibrator. However, I'm having trouble setting the Variant Recalibrator "mode" properly in scala. The relevant portion of my script is:

def script() { 
    val VR = new VariantRecalibrator with CommonArguments
            VR.resource = qscript.resourceSNPFile
    VR.input :+= qscript.vcfFile
    VR.use_annotation :+= "DP"
    VR.use_annotation :+= "QD"
    VR.use_annotation :+= "FS"
    VR.use_annotation :+= "MQRankSum"
    VR.use_annotation :+= "ReadPosRankSum"
    VR.mode = "SNP"
    VR.nt = 4
    VR.TStranche :+= "100.0"
    VR.TStranche :+= "99.9"
    VR.TStranche :+= "99.0"
    VR.TStranche :+= "90.0"
    VR.recalFile = qscript.snpRecal
    VR.tranchesFile = qscript.snpTranches
    VR.rscriptFile = qscript.snpPlots

The problem is with the VR.mode line. If I say VR.mode = "SNP" I get a "type mismatch" error; if I say VR.mode = SNP (i.e. without the quotes) I get an error that says "not found: value SNP". How do I code this correctly so that scala can interpret that I'm running VariantRecalibrator in SNP mode. I've also tried VR.mode :+= "SNP" and VR.mode :+= SNP, but get error messages with this as well.

Thank you for any help!

Best Answers


  • estif74estif74 Saint Paul, MN, USAMember

    That's perfect! Mode.SNP worked like a charm. Thank you a ton!

  • estif74estif74 Saint Paul, MN, USAMember

    I actually had one other question that just arose when I took this scala script out of test mode. It relates to the VR.resource section of my script. It was running fine in test mode, but when I add the -run flag, it turns out that VR.resource will not pass the "options" associated with the resource file, i.e. the stuff after the colon below


    Any scala gurus know how to get this to work?

  • estif74estif74 Saint Paul, MN, USAMember

    Perfect that worked great. Thank you for your quick response!!

Sign In or Register to comment.