Implemented a new argument (-DQS --defaultQualityScore) that allows GATK to deal with BAM files missing quality scores. If a value is specified, all reads are filled with the default quality score. Appropriate exception is thrown if -DQS is not provided and BAM file doesn't have quality scores for every base.
Adding the first version of the techdev pipeline (tdPipeline) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4943 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
cba436fa2f
commit
5e9a8f9cb3
|
|
@ -847,7 +847,8 @@ public class GenomeAnalysisEngine {
|
|||
generateExtendedEvents(),
|
||||
getWalkerBAQApplicationTime() == BAQ.ApplicationTime.ON_INPUT ? argCollection.BAQMode : BAQ.CalculationMode.OFF,
|
||||
getWalkerBAQQualityMode(),
|
||||
refReader);
|
||||
refReader,
|
||||
argCollection.defaultBaseQualities);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class ReadProperties {
|
|||
private BAQ.CalculationMode cmode = BAQ.CalculationMode.OFF;
|
||||
private BAQ.QualityMode qmode = BAQ.QualityMode.DONT_MODIFY;
|
||||
IndexedFastaSequenceFile refReader = null; // read for BAQ, if desired
|
||||
private byte defaultBaseQualities;
|
||||
|
||||
// do we want to generate additional piles of "extended" events (indels)
|
||||
// immediately after the reference base such event is associated with?
|
||||
|
|
@ -135,6 +136,13 @@ public class ReadProperties {
|
|||
return refReader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Default base quality value to fill reads missing base quality information.
|
||||
*/
|
||||
public byte defaultBaseQualities() {
|
||||
return defaultBaseQualities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the command-line arguments having to do with reads input
|
||||
* files and store them in an easy-to-work-with package. Constructor
|
||||
|
|
@ -156,6 +164,7 @@ public class ReadProperties {
|
|||
* @param cmode How should we apply the BAQ calculation to the reads?
|
||||
* @param qmode How should we apply the BAQ calculation to the reads?
|
||||
* @param refReader if applyBAQ is true, must be a valid pointer to a indexed fasta file reads so we can get the ref bases for BAQ calculation
|
||||
* @param defaultBaseQualities if the reads have incomplete quality scores, set them all to defaultBaseQuality.
|
||||
*/
|
||||
public ReadProperties( Collection<SAMReaderID> samFiles,
|
||||
SAMFileHeader header,
|
||||
|
|
@ -169,7 +178,8 @@ public class ReadProperties {
|
|||
boolean generateExtendedEvents,
|
||||
BAQ.CalculationMode cmode,
|
||||
BAQ.QualityMode qmode,
|
||||
IndexedFastaSequenceFile refReader ) {
|
||||
IndexedFastaSequenceFile refReader,
|
||||
byte defaultBaseQualities) {
|
||||
this.readers = samFiles;
|
||||
this.header = header;
|
||||
this.readBufferSize = readBufferSize;
|
||||
|
|
@ -183,5 +193,6 @@ public class ReadProperties {
|
|||
this.cmode = cmode;
|
||||
this.qmode = qmode;
|
||||
this.refReader = refReader;
|
||||
this.defaultBaseQualities = defaultBaseQualities;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ public class GATKArgumentCollection {
|
|||
@Argument(fullName="useOriginalQualities", shortName = "OQ", doc = "If set, use the original base quality scores from the OQ tag when present instead of the standard scores", required=false)
|
||||
public Boolean useOriginalBaseQualities = false;
|
||||
|
||||
@Argument(fullName="defaultBaseQualities", shortName = "DBQ", doc = "If reads are missing some or all base quality scores, this value will be used for all base quality scores", required=false)
|
||||
public byte defaultBaseQualities = -1;
|
||||
|
||||
@Element(required = false)
|
||||
@Argument(fullName = "validation_strictness", shortName = "S", doc = "How strict should we be with validation", required = false)
|
||||
public SAMFileReader.ValidationStringency strictnessLevel = SAMFileReader.ValidationStringency.SILENT;
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
new ValidationExclusion(),
|
||||
new ArrayList<SamRecordFilter>(),
|
||||
false,
|
||||
false
|
||||
);
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,7 +156,7 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
ValidationExclusion exclusionList,
|
||||
Collection<SamRecordFilter> supplementalFilters,
|
||||
boolean includeReadsWithDeletionAtLoci,
|
||||
boolean generateExtendedEvents ) {
|
||||
boolean generateExtendedEvents) {
|
||||
this( samFiles,
|
||||
genomeLocParser,
|
||||
useOriginalBaseQualities,
|
||||
|
|
@ -168,7 +167,10 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
supplementalFilters,
|
||||
includeReadsWithDeletionAtLoci,
|
||||
generateExtendedEvents,
|
||||
BAQ.CalculationMode.OFF, BAQ.QualityMode.DONT_MODIFY, null // no BAQ
|
||||
BAQ.CalculationMode.OFF,
|
||||
BAQ.QualityMode.DONT_MODIFY,
|
||||
null, // no BAQ
|
||||
(byte) -1
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -187,6 +189,7 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
* @param includeReadsWithDeletionAtLoci if 'true', the base pileups sent to the walker's map() method
|
||||
* will explicitly list reads with deletion over the current reference base; otherwise, only observed
|
||||
* bases will be seen in the pileups, and the deletions will be skipped silently.
|
||||
* @param defaultBaseQualities if the reads have incomplete quality scores, set them all to defaultBaseQuality.
|
||||
*/
|
||||
public SAMDataSource(
|
||||
Collection<SAMReaderID> samFiles,
|
||||
|
|
@ -201,8 +204,8 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
boolean generateExtendedEvents,
|
||||
BAQ.CalculationMode cmode,
|
||||
BAQ.QualityMode qmode,
|
||||
IndexedFastaSequenceFile refReader
|
||||
) {
|
||||
IndexedFastaSequenceFile refReader,
|
||||
byte defaultBaseQualities) {
|
||||
this.readMetrics = new ReadMetrics();
|
||||
this.genomeLocParser = genomeLocParser;
|
||||
|
||||
|
|
@ -248,7 +251,10 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
supplementalFilters,
|
||||
includeReadsWithDeletionAtLoci,
|
||||
generateExtendedEvents,
|
||||
cmode, qmode, refReader );
|
||||
cmode,
|
||||
qmode,
|
||||
refReader,
|
||||
defaultBaseQualities);
|
||||
|
||||
// cache the read group id (original) -> read group id (merged)
|
||||
// and read group id (merged) -> read group id (original) mappings.
|
||||
|
|
@ -521,7 +527,10 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
readProperties.getDownsamplingMethod().toFraction,
|
||||
readProperties.getValidationExclusionList().contains(ValidationExclusion.TYPE.NO_READ_ORDER_VERIFICATION),
|
||||
readProperties.getSupplementalFilters(),
|
||||
readProperties.getBAQCalculationMode(), readProperties.getBAQQualityMode(), readProperties.getRefReader());
|
||||
readProperties.getBAQCalculationMode(),
|
||||
readProperties.getBAQQualityMode(),
|
||||
readProperties.getRefReader(),
|
||||
readProperties.defaultBaseQualities());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -545,7 +554,10 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
readProperties.getDownsamplingMethod().toFraction,
|
||||
readProperties.getValidationExclusionList().contains(ValidationExclusion.TYPE.NO_READ_ORDER_VERIFICATION),
|
||||
readProperties.getSupplementalFilters(),
|
||||
readProperties.getBAQCalculationMode(), readProperties.getBAQQualityMode(), readProperties.getRefReader());
|
||||
readProperties.getBAQCalculationMode(),
|
||||
readProperties.getBAQQualityMode(),
|
||||
readProperties.getRefReader(),
|
||||
readProperties.defaultBaseQualities());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -570,6 +582,7 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
* @param downsamplingFraction whether and how much to downsample the reads themselves (not at a locus).
|
||||
* @param noValidationOfReadOrder Another trigger for the verifying iterator? TODO: look into this.
|
||||
* @param supplementalFilters additional filters to apply to the reads.
|
||||
* @param defaultBaseQualities if the reads have incomplete quality scores, set them all to defaultBaseQuality.
|
||||
* @return An iterator wrapped with filters reflecting the passed-in parameters. Will not be null.
|
||||
*/
|
||||
protected StingSAMIterator applyDecoratingIterators(ReadMetrics readMetrics,
|
||||
|
|
@ -579,8 +592,11 @@ public class SAMDataSource implements SimpleDataSource {
|
|||
Double downsamplingFraction,
|
||||
Boolean noValidationOfReadOrder,
|
||||
Collection<SamRecordFilter> supplementalFilters,
|
||||
BAQ.CalculationMode cmode, BAQ.QualityMode qmode, IndexedFastaSequenceFile refReader ) {
|
||||
wrappedIterator = new ReadFormattingIterator(wrappedIterator, useOriginalBaseQualities);
|
||||
BAQ.CalculationMode cmode,
|
||||
BAQ.QualityMode qmode,
|
||||
IndexedFastaSequenceFile refReader,
|
||||
byte defaultBaseQualities) {
|
||||
wrappedIterator = new ReadFormattingIterator(wrappedIterator, useOriginalBaseQualities, defaultBaseQualities);
|
||||
|
||||
// NOTE: this (and other filtering) should be done before on-the-fly sorting
|
||||
// as there is no reason to sort something that we will end of throwing away
|
||||
|
|
|
|||
|
|
@ -32,14 +32,23 @@ public class ReadFormattingIterator implements StingSAMIterator {
|
|||
*/
|
||||
private final boolean useOriginalBaseQualities;
|
||||
|
||||
/**
|
||||
* Positive if there is a default Base Quality value to fill in the reads with.
|
||||
*/
|
||||
private final byte defaultBaseQualities;
|
||||
|
||||
|
||||
/**
|
||||
* Decorate the given iterator inside a ReadWrappingIterator.
|
||||
* @param wrappedIterator iterator
|
||||
* @param useOriginalBaseQualities true if original base qualities should be used
|
||||
* @param defaultBaseQualities if the reads have incomplete quality scores, set them all to defaultBaseQuality.
|
||||
*/
|
||||
public ReadFormattingIterator(StingSAMIterator wrappedIterator, boolean useOriginalBaseQualities) {
|
||||
public ReadFormattingIterator(StingSAMIterator wrappedIterator, boolean useOriginalBaseQualities, byte defaultBaseQualities) {
|
||||
this.wrappedIterator = wrappedIterator;
|
||||
this.useOriginalBaseQualities = useOriginalBaseQualities;
|
||||
this.defaultBaseQualities = defaultBaseQualities;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +83,7 @@ public class ReadFormattingIterator implements StingSAMIterator {
|
|||
* no next exists.
|
||||
*/
|
||||
public SAMRecord next() {
|
||||
return new GATKSAMRecord(wrappedIterator.next(), useOriginalBaseQualities);
|
||||
return new GATKSAMRecord(wrappedIterator.next(), useOriginalBaseQualities, defaultBaseQualities);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class GATKSAMRecord extends SAMRecord {
|
|||
// TODO: this is a temporary hack. If it works, clean it up.
|
||||
private BitSet mBitSet = null;
|
||||
|
||||
public GATKSAMRecord(SAMRecord record, boolean useOriginalBaseQualities) {
|
||||
public GATKSAMRecord(SAMRecord record, boolean useOriginalBaseQualities, byte defaultBaseQualities) {
|
||||
super(null); // it doesn't matter - this isn't used
|
||||
if ( record == null )
|
||||
throw new IllegalArgumentException("The SAMRecord argument cannot be null");
|
||||
|
|
@ -65,6 +65,20 @@ public class GATKSAMRecord extends SAMRecord {
|
|||
for ( SAMTagAndValue attribute : attributes )
|
||||
setAttribute(attribute.tag, attribute.value);
|
||||
|
||||
// if we are using default quals, check if we need them, and add if necessary.
|
||||
// 1. we need if reads are lacking or have incomplete quality scores
|
||||
// 2. we add if defaultBaseQualities has a positive value
|
||||
if (defaultBaseQualities >= 0) {
|
||||
byte reads [] = record.getReadBases();
|
||||
byte quals [] = record.getBaseQualities();
|
||||
if (quals == null || quals.length < reads.length) {
|
||||
byte new_quals [] = new byte [reads.length];
|
||||
for (int i=0; i<reads.length; i++)
|
||||
new_quals[i] = defaultBaseQualities;
|
||||
record.setBaseQualities(new_quals);
|
||||
}
|
||||
}
|
||||
|
||||
// if we are using original quals, set them now if they are present in the record
|
||||
if ( useOriginalBaseQualities ) {
|
||||
byte[] originalQuals = mRecord.getOriginalBaseQualities();
|
||||
|
|
@ -74,7 +88,7 @@ public class GATKSAMRecord extends SAMRecord {
|
|||
|
||||
// sanity check that the lengths of the base and quality strings are equal
|
||||
if ( getBaseQualities().length != getReadLength() )
|
||||
throw new UserException.MalformedBam(this, String.format("Error: the number of base qualities does not match the number of bases in %s (and the GATK does not currently support '*' for the quals)", mRecord.getReadName()));
|
||||
throw new UserException.MalformedBam(this, String.format("Error: the number of base qualities does not match the number of bases in %s. Use -DBQ x to set a default base quality score to all reads so GATK can proceed.", mRecord.getReadName()));
|
||||
}
|
||||
|
||||
public void setGoodBases(GATKSAMRecordFilter filter, boolean abortIfAlreadySet) {
|
||||
|
|
|
|||
|
|
@ -148,7 +148,10 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
new ArrayList<SamRecordFilter>(),
|
||||
false,
|
||||
false,
|
||||
BAQ.CalculationMode.OFF, BAQ.QualityMode.DONT_MODIFY, null // no BAQ
|
||||
BAQ.CalculationMode.OFF,
|
||||
BAQ.QualityMode.DONT_MODIFY,
|
||||
null, // no BAQ
|
||||
(byte) -1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,214 @@
|
|||
import org.broadinstitute.sting.queue.extensions.gatk._
|
||||
import org.broadinstitute.sting.queue.QScript
|
||||
//import org.broadinstitute.sting.queue.extensions.picard.PicardBamJarFunction
|
||||
//import org.broadinstitute.sting.queue.extensions.samtools.SamtoolsIndexFunction
|
||||
//import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
class tdPipeline extends QScript {
|
||||
qscript =>
|
||||
|
||||
@Argument(shortName="gatk", doc="gatk jar file", required=true)
|
||||
var gatkJarFile: File = _
|
||||
|
||||
@Argument(shortName="outputDir", doc="output directory", required=true)
|
||||
var outputDir: String = "./"
|
||||
|
||||
@Argument(shortName="noBAQ", doc="turns off BAQ calculation", required=false)
|
||||
var useBAQ: Boolean = true
|
||||
|
||||
@Argument(shortName="noMask", doc="turns off MASK calculation", required=false)
|
||||
var useMask: Boolean = true
|
||||
|
||||
|
||||
trait UNIVERSAL_GATK_ARGS extends CommandLineGATK { logging_level = "INFO"; jarFile = gatkJarFile; memoryLimit = Some(4);}
|
||||
|
||||
class Target(
|
||||
val baseName: String,
|
||||
val reference: File,
|
||||
val dbsnpFile: String,
|
||||
val hapmapFile: String,
|
||||
val maskFile: String,
|
||||
val bamList: File,
|
||||
val goldStandard_VCF: File,
|
||||
val intervals: String,
|
||||
val titvTarget: Double,
|
||||
val isLowpass: Boolean) {
|
||||
val name = qscript.outputDir + baseName
|
||||
val clusterFile = new File(name + ".clusters")
|
||||
val rawVCF = new File(name + ".raw.vcf")
|
||||
val filteredVCF = new File(name + ".filtered.vcf")
|
||||
val goldStandardName = qscript.outputDir + "goldStandard/" + baseName
|
||||
val goldStandardClusterFile = new File(goldStandardName + ".clusters")
|
||||
}
|
||||
|
||||
val hg18 = new File("/seq/references/Homo_sapiens_assembly18/v0/Homo_sapiens_assembly18.fasta")
|
||||
val b36 = new File("/humgen/1kg/reference/human_b36_both.fasta")
|
||||
val b37 = new File("/humgen/1kg/reference/human_g1k_v37.fasta")
|
||||
|
||||
// Define the target datasets here
|
||||
val lowPass: Boolean = true
|
||||
val HiSeq = new Target("NA12878.HiSeq",
|
||||
hg18,
|
||||
"/humgen/gsa-hpprojects/GATK/data/Comparisons/Validated/dbSNP/dbsnp_129_hg18.rod",
|
||||
"/humgen/gsa-hpprojects/GATK/data/Comparisons/Validated/HapMap/3.3/genotypes_r27_nr.hg18_fwd.vcf",
|
||||
"/humgen/gsa-hpprojects/dev/depristo/oneOffProjects/1000GenomesProcessingPaper/wgs.v13/HiSeq.WGS.cleaned.indels.bed",
|
||||
new File("/humgen/gsa-hpprojects/NA12878Collection/bams/NA12878.HiSeq.WGS.bwa.cleaned.recal.bam"),
|
||||
new File("/home/radon01/depristo/work/oneOffProjects/1000GenomesProcessingPaper/wgs.v13/HiSeq.WGS.cleaned.ug.snpfiltered.indelfiltered.vcf"),
|
||||
"/humgen/1kg/processing/pipeline_test_bams/whole_genome_chunked.hg18.intervals",
|
||||
2.07,
|
||||
!lowPass)
|
||||
|
||||
val LowPassFIN79Nov = new Target("FIN.nov2010",
|
||||
b37,
|
||||
"/humgen/gsa-hpprojects/GATK/data/Comparisons/Validated/dbSNP/dbsnp_132_b37.leftAligned.vcf",
|
||||
"/humgen/gsa-hpprojects/GATK/data/Comparisons/Validated/HapMap/3.3/genotypes_r27_nr.b37_fwd.vcf",
|
||||
"/humgen/1kg/processing/pipeline_test_bams/pilot1.dindel.mask.hg18.bed",
|
||||
new File("/humgen/1kg/processing/pipeline_test_bams/FIN.79sample.Nov2010.chr20.bam"),
|
||||
new File("/humgen/gsa-hpprojects/dev/data/AugChr20Calls_v4_3state/ALL.august.v4.chr20.filtered.vcf"), // ** THIS GOLD STANDARD NEEDS TO BE CORRECTED **
|
||||
"/humgen/1kg/processing/pipeline_test_bams/whole_genome_chunked.chr20.hg19.intervals",
|
||||
2.3,
|
||||
lowPass)
|
||||
|
||||
/*
|
||||
* These sources need to be updated, never used.
|
||||
|
||||
val TGPWExGdA = new Target("1000G.WEx.GdA", b37, "b37",
|
||||
new File("/humgen/1kg/processing/pipeline_test_bams/Barcoded_1000G_WEx_Reduced_Plate_1.cleaned.list"), // BUGBUG: reduce from 60 to 20 people
|
||||
new File("/humgen/gsa-scr1/delangel/NewUG/calls/AugustRelease.filtered_Q50_QD5.0_SB0.0.allSamples.SNPs_hg19.WEx_UG_newUG_MQC.vcf"), // ** THIS GOLD STANDARD NEEDS TO BE CORRECTED **
|
||||
"/seq/references/HybSelOligos/whole_exome_agilent_1.1_refseq_plus_3_boosters/whole_exome_agilent_1.1_refseq_plus_3_boosters.Homo_sapiens_assembly19.targets.interval_list", 2.6, !lowPass)
|
||||
val WEx = new Target("NA12878.WEx", hg18, "hg18",
|
||||
new File("/humgen/gsa-hpprojects/NA12878Collection/bams/NA12878.WEx.cleaned.recal.bam"),
|
||||
new File("/home/radon01/depristo/work/oneOffProjects/1000GenomesProcessingPaper/wgs.v13/GA2.WEx.cleaned.ug.snpfiltered.indelfiltered.vcf"),
|
||||
"/seq/references/HybSelOligos/whole_exome_agilent_1.1_refseq_plus_3_boosters/whole_exome_agilent_1.1_refseq_plus_3_boosters.targets.interval_list", 2.6, !lowPass)
|
||||
val LowPassN60 = new Target("lowpass.N60", b36, "b36", // which reference the data is aligned to
|
||||
new File("/humgen/1kg/analysis/bamsForDataProcessingPapers/lowpass_b36/lowpass.chr20.cleaned.matefixed.bam"), // the bam list to call from
|
||||
new File("/home/radon01/depristo/work/oneOffProjects/VQSRCutByNRS/lowpass.N60.chr20.filtered.vcf"), // the gold standard VCF file to run through the VQSR
|
||||
"/humgen/1kg/processing/pipeline_test_bams/whole_genome_chunked.chr20.b36.intervals", 2.3, lowPass) // chunked interval list to use with Queue's scatter/gather functionality
|
||||
val LowPassAugust = new Target("ALL.august.v4", b37, "b37", // BUGBUG: kill this, it is too large
|
||||
new File("/humgen/1kg/processing/allPopulations_chr20_august_release.cleaned.merged.bams/ALL.cleaned.merged.list"),
|
||||
new File("/humgen/gsa-hpprojects/dev/data/AugChr20Calls_v4_3state/ALL.august.v4.chr20.filtered.vcf"),
|
||||
"/humgen/1kg/processing/pipeline_test_bams/whole_genome_chunked.chr20.hg19.intervals", 2.3, lowPass)
|
||||
val LowPassEUR363Nov = new Target("EUR.nov2010", b37, "b37",
|
||||
new File("/humgen/1kg/processing/pipeline_test_bams/EUR.363sample.Nov2010.chr20.bam"),
|
||||
new File("/humgen/gsa-hpprojects/dev/data/AugChr20Calls_v4_3state/ALL.august.v4.chr20.filtered.vcf"), // ** THIS GOLD STANDARD NEEDS TO BE CORRECTED **
|
||||
"/humgen/1kg/processing/pipeline_test_bams/whole_genome_chunked.chr20.hg19.intervals", 2.3, lowPass)
|
||||
*/
|
||||
val targets = List(HiSeq, LowPassFIN79Nov)
|
||||
|
||||
def script = {
|
||||
val goldStandard = true
|
||||
for (target <- targets) {
|
||||
add(new UnifiedGenotyper(target))
|
||||
add(new VariantFiltration(target))
|
||||
add(new GenerateVariantClusters(target, !goldStandard))
|
||||
add(new VariantRecalibratorTiTv(target, !goldStandard))
|
||||
add(new VariantRecalibratorNRS(target, !goldStandard))
|
||||
add(new VariantEvaluation(target))
|
||||
}
|
||||
}
|
||||
|
||||
val FiltersToIgnore = List("DPFilter", "ABFilter", "ESPStandard", "QualByDepth", "StrandBias", "HomopolymerRun")
|
||||
|
||||
// 1.) Call SNPs with UG
|
||||
class UnifiedGenotyper(t: Target) extends org.broadinstitute.sting.queue.extensions.gatk.UnifiedGenotyper with UNIVERSAL_GATK_ARGS {
|
||||
this.reference_sequence = t.reference
|
||||
if (t.dbsnpFile.endsWith(".rod")) this.DBSNP = new File(t.dbsnpFile)
|
||||
else if (t.dbsnpFile.endsWith(".vcf")) this.rodBind :+= RodBind("dbsnp", "VCF", t.dbsnpFile)
|
||||
this.intervalsString ++= List(t.intervals)
|
||||
this.scatterCount = 63 // the smallest interval list has 63 intervals, one for each Mb on chr20
|
||||
this.jobQueue = "hour"
|
||||
this.dcov = Some( if ( t.isLowpass ) { 50 } else { 250 } )
|
||||
this.input_file :+= t.bamList
|
||||
this.out = t.rawVCF
|
||||
if (useBAQ)
|
||||
this.baq = Some(org.broadinstitute.sting.utils.baq.BAQ.CalculationMode.RECALCULATE)
|
||||
else
|
||||
this.baq = Some(org.broadinstitute.sting.utils.baq.BAQ.CalculationMode.OFF)
|
||||
this.stand_call_conf = Some( if ( t.isLowpass ) { 4.0 } else { 30.0 } )
|
||||
this.stand_emit_conf = Some( if ( t.isLowpass ) { 4.0 } else { 30.0 } )
|
||||
this.analysisName = t.name + "_UG"
|
||||
}
|
||||
|
||||
// 2.) Filter SNPs
|
||||
class VariantFiltration(t: Target) extends org.broadinstitute.sting.queue.extensions.gatk.VariantFiltration with UNIVERSAL_GATK_ARGS {
|
||||
this.reference_sequence = t.reference
|
||||
this.intervalsString ++= List(t.intervals)
|
||||
this.scatterCount = 10
|
||||
this.jobQueue = "hour"
|
||||
this.variantVCF = t.rawVCF
|
||||
this.out = t.filteredVCF
|
||||
if (useMask) {
|
||||
this.rodBind :+= RodBind("mask", "Bed", t.maskFile)
|
||||
this.maskName = "InDel"
|
||||
}
|
||||
this.filterName ++= List("HARD_TO_VALIDATE")
|
||||
this.filterExpression ++= List("\"MQ0 >= 4 && (MQ0 / (1.0 * DP)) > 0.1\"")
|
||||
this.analysisName = t.name + "_VF"
|
||||
}
|
||||
|
||||
// 3.) VQSR part1 Generate Gaussian clusters based on truth sites
|
||||
class GenerateVariantClusters(t: Target, goldStandard: Boolean) extends org.broadinstitute.sting.queue.extensions.gatk.GenerateVariantClusters with UNIVERSAL_GATK_ARGS {
|
||||
val name: String = if ( goldStandard ) { t.goldStandardName } else { t.name }
|
||||
this.reference_sequence = t.reference
|
||||
if (t.dbsnpFile.endsWith(".rod")) this.DBSNP = new File(t.dbsnpFile)
|
||||
else if (t.dbsnpFile.endsWith(".vcf")) this.rodBind :+= RodBind("dbsnp", "VCF", t.dbsnpFile)
|
||||
this.rodBind :+= RodBind("hapmap", "VCF", t.hapmapFile)
|
||||
this.rodBind :+= RodBind("input", "VCF", if ( goldStandard ) { t.goldStandard_VCF } else { t.filteredVCF } )
|
||||
this.clusterFile = if ( goldStandard ) { t.goldStandardClusterFile } else { t.clusterFile }
|
||||
this.use_annotation ++= List("QD", "SB", "HaplotypeScore", "HRun")
|
||||
this.analysisName = name + "_GVC"
|
||||
this.intervalsString ++= List(t.intervals)
|
||||
this.qual = Some(300) // clustering parameters to be updated soon pending new experimentation results
|
||||
this.std = Some(3.5)
|
||||
this.mG = Some(16)
|
||||
this.ignoreFilter ++= FiltersToIgnore
|
||||
}
|
||||
|
||||
// 4.) VQSR part2 Calculate new LOD for all input SNPs by evaluating the Gaussian clusters
|
||||
class VariantRecalibratorBase(t: Target, goldStandard: Boolean) extends org.broadinstitute.sting.queue.extensions.gatk.VariantRecalibrator with UNIVERSAL_GATK_ARGS {
|
||||
val name: String = if ( goldStandard ) { t.goldStandardName } else { t.name }
|
||||
this.reference_sequence = t.reference
|
||||
if (t.dbsnpFile.endsWith(".rod")) this.DBSNP = new File(t.dbsnpFile)
|
||||
else if (t.dbsnpFile.endsWith(".vcf")) this.rodBind :+= RodBind("dbsnp", "VCF", t.dbsnpFile)
|
||||
this.rodBind :+= RodBind("hapmap", "VCF", t.hapmapFile)
|
||||
this.rodBind :+= RodBind("truth", "VCF", t.hapmapFile)
|
||||
this.rodBind :+= RodBind("input", "VCF", if ( goldStandard ) { t.goldStandard_VCF } else { t.filteredVCF } )
|
||||
this.clusterFile = if ( goldStandard ) { t.goldStandardClusterFile } else { t.clusterFile }
|
||||
this.analysisName = name + "_VR"
|
||||
this.intervalsString ++= List(t.intervals)
|
||||
this.ignoreFilter ++= FiltersToIgnore
|
||||
this.ignoreFilter ++= List("HARD_TO_VALIDATE")
|
||||
this.priorDBSNP = Some(2.0)
|
||||
this.priorHapMap = Some(2.0)
|
||||
this.target_titv = t.titvTarget
|
||||
}
|
||||
|
||||
// 4a.) Choose VQSR tranches based on novel ti/tv
|
||||
class VariantRecalibratorTiTv(t: Target, goldStandard: Boolean) extends VariantRecalibratorBase(t, goldStandard) {
|
||||
this.tranche ++= List("0.1", "1.0", "10.0", "100.0")
|
||||
this.out = new File(this.name + ".titv.recalibrated.vcf")
|
||||
this.tranchesFile = new File(this.name + ".titv.tranches")
|
||||
}
|
||||
|
||||
// 4b.) Choose VQSR tranches based on sensitivity to truth set
|
||||
class VariantRecalibratorNRS(t: Target, goldStandard: Boolean) extends VariantRecalibratorBase(t, goldStandard) {
|
||||
this.sm = Some(org.broadinstitute.sting.gatk.walkers.variantrecalibration.VariantRecalibrator.SelectionMetricType.TRUTH_SENSITIVITY)
|
||||
this.tranche ++= List("0.1", "1.0", "10.0", "100.0")
|
||||
this.out = new File(this.name + ".ts.recalibrated.vcf")
|
||||
this.tranchesFile = new File(this.name + ".ts.tranches")
|
||||
}
|
||||
|
||||
// 5.) Variant Evaluation generates the csv files for Genome Concordance analysis
|
||||
class VariantEvaluation(t: Target) extends org.broadinstitute.sting.queue.extensions.gatk.VariantEval with UNIVERSAL_GATK_ARGS {
|
||||
val name: String = t.name
|
||||
this.reference_sequence = t.reference
|
||||
if (t.dbsnpFile.endsWith(".rod")) this.DBSNP = new File(t.dbsnpFile)
|
||||
else if (t.dbsnpFile.endsWith(".vcf")) this.rodBind :+= RodBind("dbsnp", "VCF", t.dbsnpFile)
|
||||
this.rodBind :+= RodBind("hapmap", "VCF", t.hapmapFile)
|
||||
this.rodBind :+= RodBind("input", "VCF", t.filteredVCF)
|
||||
this.analysisName = name + "_VR"
|
||||
this.intervalsString ++= List(t.intervals)
|
||||
this.reportType = Some(org.broadinstitute.sting.utils.report.VE2ReportFactory.VE2TemplateType.R)
|
||||
this.reportLocation = new File(t.name + ".eval")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue