Bugfix for clf version of extract samples. Due to dynamic shell creation and bsubs and whatnot, the OR pipe for grep ("a|b") needs to be super-escaped ("a\\\\\\\\|b").

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4829 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
chartl 2010-12-13 19:06:30 +00:00
parent 17db2e0e24
commit d34c5640d2
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import collection.JavaConversions._
import java.io.FileNotFoundException
import org.broadinstitute.sting.datasources.pipeline._
import org.broadinstitute.sting.queue.extensions.gatk._
import org.broadinstitute.sting.queue.library.ipf.vcf._
import org.broadinstitute.sting.queue.library.clf.vcf._
import org.broadinstitute.sting.queue.pipeline._
import org.broadinstitute.sting.queue.QScript
import org.broadinstitute.sting.utils.yaml.YamlUtils

View File

@ -17,14 +17,14 @@ class VCFExtractSamples(inVCF: File, outVCF: File, samples: List[String]) extend
override def freezeFieldValues = {
this.logger.warn("Note: Using VCFExtractSamples invalidates AC/AF/AN annotations. This is an explicit warning.")
sampleGrep = "\"" + sampleList.foldLeft[String](sampleList.get(0))( (a,b) => a + "|" + b) + "\""
sampleGrep = "\"" + sampleList.reduceLeft(_ + "\\\\\\\\|" + _) + "\""
super.freezeFieldValues
}
def commandLine = {
var first : String = "head -n 500 %s | grep \\\\#\\\\# > %s".format(inputVCF.getAbsolutePath,outputVCF.getAbsolutePath)
var second : String = "head -n 500 %s | grep \\\\#CHR | tr '\\t' '\\n' | awk '{print NF\"\\t\"$1}' ".format(inputVCF)
var second : String = "head -n 500 %s | grep \\\\#CHR | tr '\\t' '\\n' | awk '{print ++count\"\\t\"$1}' ".format(inputVCF.getAbsolutePath)
second += "| egrep %s | awk '{print $1}' | tr '\\n' ',' | xargs -i cut -f1-9,\\{\\} %s | grep -v \\\\#\\\\# >> %s".format(sampleGrep,inputVCF.getAbsolutePath,outputVCF.getAbsolutePath)
first+" ; "+second