2009-05-16 05:02:12 +08:00
|
|
|
package org.broadinstitute.sting.gatk;
|
|
|
|
|
|
2009-09-01 12:21:58 +08:00
|
|
|
import net.sf.picard.filter.SamRecordFilter;
|
2010-12-05 04:23:06 +08:00
|
|
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
2010-09-25 10:49:30 +08:00
|
|
|
import net.sf.samtools.SAMFileHeader;
|
2009-09-01 12:21:58 +08:00
|
|
|
import net.sf.samtools.SAMFileReader;
|
2010-01-15 08:14:35 +08:00
|
|
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
2010-08-25 11:47:57 +08:00
|
|
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID;
|
2010-12-05 04:23:06 +08:00
|
|
|
import org.broadinstitute.sting.utils.BAQ;
|
2009-09-01 12:21:58 +08:00
|
|
|
|
|
|
|
|
import java.util.List;
|
2009-11-11 07:36:17 +08:00
|
|
|
import java.util.Collection;
|
2009-05-16 05:02:12 +08:00
|
|
|
/**
|
|
|
|
|
* User: hanna
|
|
|
|
|
* Date: May 14, 2009
|
|
|
|
|
* Time: 4:06:26 PM
|
|
|
|
|
* BROAD INSTITUTE SOFTWARE COPYRIGHT NOTICE AND AGREEMENT
|
|
|
|
|
* Software and documentation are copyright 2005 by the Broad Institute.
|
|
|
|
|
* All rights are reserved.
|
|
|
|
|
*
|
|
|
|
|
* Users acknowledge that this software is supplied without any warranty or support.
|
|
|
|
|
* The Broad Institute is not responsible for its use, misuse, or
|
|
|
|
|
* functionality.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A data structure containing information about the reads data sources as well as
|
|
|
|
|
* information about how they should be downsampled, sorted, and filtered.
|
|
|
|
|
*/
|
2010-08-12 04:17:11 +08:00
|
|
|
public class ReadProperties {
|
2010-08-25 11:47:57 +08:00
|
|
|
private List<SAMReaderID> readers = null;
|
2010-09-25 10:49:30 +08:00
|
|
|
private SAMFileHeader header = null;
|
2009-06-10 21:39:32 +08:00
|
|
|
private SAMFileReader.ValidationStringency validationStringency = SAMFileReader.ValidationStringency.STRICT;
|
2010-07-02 06:28:55 +08:00
|
|
|
private Integer readBufferSize = null;
|
2010-05-19 13:40:05 +08:00
|
|
|
private DownsamplingMethod downsamplingMethod = null;
|
2010-01-15 08:14:35 +08:00
|
|
|
private ValidationExclusion exclusionList = null;
|
2009-11-11 07:36:17 +08:00
|
|
|
private Collection<SamRecordFilter> supplementalFilters = null;
|
2009-09-09 23:36:12 +08:00
|
|
|
private boolean includeReadsWithDeletionAtLoci = false;
|
2010-09-25 10:49:30 +08:00
|
|
|
private boolean useOriginalBaseQualities = false;
|
2010-12-05 04:23:06 +08:00
|
|
|
private boolean generateExtendedEvents = false;
|
|
|
|
|
private BAQ.Mode mode = BAQ.Mode.NONE;
|
|
|
|
|
IndexedFastaSequenceFile refReader = null; // read for BAQ, if desired
|
|
|
|
|
|
|
|
|
|
// do we want to generate additional piles of "extended" events (indels)
|
2010-01-15 08:14:35 +08:00
|
|
|
// immediately after the reference base such event is associated with?
|
2009-09-09 23:36:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return true if the walker wants to see reads that contain deletions when looking at locus pileups
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean includeReadsWithDeletionAtLoci() {
|
|
|
|
|
return includeReadsWithDeletionAtLoci;
|
|
|
|
|
}
|
2009-05-16 05:02:12 +08:00
|
|
|
|
2009-12-29 03:52:44 +08:00
|
|
|
/**
|
|
|
|
|
* Return true if the walker wants to see additional piles of "extended" events (indels). An indel is associated,
|
|
|
|
|
* by convention, with the reference base immediately preceding the insertion/deletion, and if this flag is set
|
|
|
|
|
* to 'true', any locus with an indel associated with it will cause exactly two subsequent calls to walker's map(): first call
|
|
|
|
|
* will be made with a "conventional" base pileup, the next call will be made with a pileup of extended (indel/noevent)
|
|
|
|
|
* events.
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean generateExtendedEvents() {
|
|
|
|
|
return generateExtendedEvents;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-16 05:02:12 +08:00
|
|
|
/**
|
|
|
|
|
* Gets a list of the files acting as sources of reads.
|
|
|
|
|
* @return A list of files storing reads data.
|
|
|
|
|
*/
|
2010-08-25 11:47:57 +08:00
|
|
|
public List<SAMReaderID> getSAMReaderIDs() {
|
|
|
|
|
return readers;
|
2009-05-16 05:02:12 +08:00
|
|
|
}
|
|
|
|
|
|
2010-09-25 10:49:30 +08:00
|
|
|
/**
|
|
|
|
|
* Gets the sam file header
|
|
|
|
|
* @return the sam file header
|
|
|
|
|
*/
|
|
|
|
|
public SAMFileHeader getHeader() {
|
|
|
|
|
return header;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-10 21:39:32 +08:00
|
|
|
/**
|
|
|
|
|
* How strict should validation be?
|
|
|
|
|
* @return Stringency of validation.
|
|
|
|
|
*/
|
|
|
|
|
public SAMFileReader.ValidationStringency getValidationStringency() {
|
|
|
|
|
return validationStringency;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-02 06:28:55 +08:00
|
|
|
/**
|
|
|
|
|
* Gets a list of the total number of reads that the sharding system should buffer per BAM file.
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Integer getReadBufferSize() {
|
|
|
|
|
return readBufferSize;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-16 05:02:12 +08:00
|
|
|
/**
|
2010-05-19 13:40:05 +08:00
|
|
|
* Gets the method and parameters used when downsampling reads.
|
2009-05-16 05:02:12 +08:00
|
|
|
* @return Downsample fraction.
|
|
|
|
|
*/
|
2010-05-19 13:40:05 +08:00
|
|
|
public DownsamplingMethod getDownsamplingMethod() {
|
|
|
|
|
return downsamplingMethod;
|
2009-05-16 05:02:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return whether to 'verify' the reads as we pass through them.
|
|
|
|
|
* @return Whether to verify the reads.
|
|
|
|
|
*/
|
2010-01-15 08:14:35 +08:00
|
|
|
public ValidationExclusion getValidationExclusionList() {
|
|
|
|
|
return exclusionList;
|
2009-05-16 05:02:12 +08:00
|
|
|
}
|
|
|
|
|
|
2009-11-11 07:36:17 +08:00
|
|
|
public Collection<SamRecordFilter> getSupplementalFilters() {
|
2009-07-10 07:59:53 +08:00
|
|
|
return supplementalFilters;
|
2009-05-29 22:51:08 +08:00
|
|
|
}
|
|
|
|
|
|
2009-05-16 05:02:12 +08:00
|
|
|
/**
|
2010-09-25 10:49:30 +08:00
|
|
|
* Return whether to use original base qualities.
|
|
|
|
|
* @return Whether to use original base qualities.
|
2009-05-16 05:02:12 +08:00
|
|
|
*/
|
2010-09-25 10:49:30 +08:00
|
|
|
public boolean useOriginalBaseQualities() {
|
|
|
|
|
return useOriginalBaseQualities;
|
2009-05-16 05:02:12 +08:00
|
|
|
}
|
|
|
|
|
|
2010-12-05 04:23:06 +08:00
|
|
|
|
|
|
|
|
public BAQ.Mode getBAQMode() {
|
|
|
|
|
return mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IndexedFastaSequenceFile getRefReader() {
|
|
|
|
|
return refReader;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-16 05:02:12 +08:00
|
|
|
/**
|
|
|
|
|
* Extract the command-line arguments having to do with reads input
|
|
|
|
|
* files and store them in an easy-to-work-with package. Constructor
|
|
|
|
|
* is package protected.
|
2009-06-10 21:39:32 +08:00
|
|
|
* @param samFiles list of reads files.
|
2010-09-25 10:49:30 +08:00
|
|
|
* @param header sam file header.
|
|
|
|
|
* @param useOriginalBaseQualities True if original base qualities should be used.
|
2009-06-10 21:39:32 +08:00
|
|
|
* @param strictness Stringency of reads file parsing.
|
2010-07-02 06:28:55 +08:00
|
|
|
* @param readBufferSize Number of reads to hold in memory per BAM.
|
2010-09-24 07:28:55 +08:00
|
|
|
* @param downsamplingMethod Method for downsampling reads at a given locus.
|
2010-01-15 08:14:35 +08:00
|
|
|
* @param exclusionList what safety checks we're willing to let slide
|
2009-07-10 07:59:53 +08:00
|
|
|
* @param supplementalFilters additional filters to dynamically apply.
|
2009-12-29 03:52:44 +08:00
|
|
|
* @param generateExtendedEvents if true, the engine will issue an extra call to walker's map() with
|
|
|
|
|
* a pile of indel/noevent extended events at every locus with at least one indel associated with it
|
|
|
|
|
* (in addition to a "regular" call to map() at this locus performed with base pileup)
|
|
|
|
|
* @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.
|
2010-12-05 04:23:06 +08:00
|
|
|
* @param mode 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
|
2009-05-16 05:02:12 +08:00
|
|
|
*/
|
2010-09-24 07:28:55 +08:00
|
|
|
public ReadProperties( List<SAMReaderID> samFiles,
|
2010-09-25 10:49:30 +08:00
|
|
|
SAMFileHeader header,
|
|
|
|
|
boolean useOriginalBaseQualities,
|
2009-06-10 21:39:32 +08:00
|
|
|
SAMFileReader.ValidationStringency strictness,
|
2010-07-02 06:28:55 +08:00
|
|
|
Integer readBufferSize,
|
2010-05-19 13:40:05 +08:00
|
|
|
DownsamplingMethod downsamplingMethod,
|
2010-01-15 08:14:35 +08:00
|
|
|
ValidationExclusion exclusionList,
|
2009-11-11 07:36:17 +08:00
|
|
|
Collection<SamRecordFilter> supplementalFilters,
|
2009-12-29 03:52:44 +08:00
|
|
|
boolean includeReadsWithDeletionAtLoci,
|
2010-12-05 04:23:06 +08:00
|
|
|
boolean generateExtendedEvents,
|
|
|
|
|
BAQ.Mode mode,
|
|
|
|
|
IndexedFastaSequenceFile refReader ) {
|
2010-08-25 11:47:57 +08:00
|
|
|
this.readers = samFiles;
|
2010-09-25 10:49:30 +08:00
|
|
|
this.header = header;
|
2010-07-02 06:28:55 +08:00
|
|
|
this.readBufferSize = readBufferSize;
|
2009-06-10 21:39:32 +08:00
|
|
|
this.validationStringency = strictness;
|
2010-09-25 10:49:30 +08:00
|
|
|
this.downsamplingMethod = downsamplingMethod == null ? DownsamplingMethod.NONE : downsamplingMethod;
|
2010-01-15 08:14:35 +08:00
|
|
|
this.exclusionList = exclusionList == null ? new ValidationExclusion() : exclusionList;
|
2009-07-10 07:59:53 +08:00
|
|
|
this.supplementalFilters = supplementalFilters;
|
2009-09-09 23:36:12 +08:00
|
|
|
this.includeReadsWithDeletionAtLoci = includeReadsWithDeletionAtLoci;
|
2009-12-29 03:52:44 +08:00
|
|
|
this.generateExtendedEvents = generateExtendedEvents;
|
2010-09-25 10:49:30 +08:00
|
|
|
this.useOriginalBaseQualities = useOriginalBaseQualities;
|
2010-12-05 04:23:06 +08:00
|
|
|
this.mode = mode;
|
|
|
|
|
this.refReader = refReader;
|
2009-05-16 05:02:12 +08:00
|
|
|
}
|
|
|
|
|
}
|