2009-03-16 06:42:24 +08:00
|
|
|
package org.broadinstitute.sting.gatk.walkers;
|
|
|
|
|
|
2010-07-20 03:10:29 +08:00
|
|
|
import org.broadinstitute.sting.gatk.filters.*;
|
2009-04-04 03:54:54 +08:00
|
|
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
2009-08-05 05:01:37 +08:00
|
|
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|
|
|
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
2010-05-27 06:12:25 +08:00
|
|
|
import org.broadinstitute.sting.gatk.traversals.TraversalStatistics;
|
2010-05-31 02:00:12 +08:00
|
|
|
import org.broadinstitute.sting.gatk.iterators.LocusIteratorByState;
|
2010-06-03 06:26:32 +08:00
|
|
|
import org.broadinstitute.sting.gatk.iterators.LocusIteratorFilter;
|
2010-05-27 06:12:25 +08:00
|
|
|
import net.sf.picard.filter.SamRecordFilter;
|
|
|
|
|
import net.sf.samtools.SAMRecord;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Arrays;
|
2010-05-31 02:00:12 +08:00
|
|
|
import java.util.EnumSet;
|
2009-03-16 06:42:24 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by IntelliJ IDEA.
|
|
|
|
|
* User: mdepristo
|
|
|
|
|
* Date: Feb 22, 2009
|
|
|
|
|
* Time: 2:52:28 PM
|
|
|
|
|
* To change this template use File | Settings | File Templates.
|
|
|
|
|
*/
|
2009-05-16 05:02:12 +08:00
|
|
|
@By(DataSource.READS)
|
2009-06-19 05:03:57 +08:00
|
|
|
@Requires({DataSource.READS,DataSource.REFERENCE, DataSource.REFERENCE_BASES})
|
2009-03-27 23:40:45 +08:00
|
|
|
public abstract class LocusWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
|
2009-03-16 06:42:24 +08:00
|
|
|
// Do we actually want to operate on the context?
|
2009-08-05 05:01:37 +08:00
|
|
|
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
2009-03-27 00:22:35 +08:00
|
|
|
return true; // We are keeping all the reads
|
|
|
|
|
}
|
2009-03-16 06:42:24 +08:00
|
|
|
|
2009-08-05 05:01:37 +08:00
|
|
|
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
|
|
|
|
|
public abstract MapType map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context);
|
2010-05-27 06:12:25 +08:00
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// mandatory read filters
|
|
|
|
|
//
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
public List<SamRecordFilter> getMandatoryReadFilters() {
|
|
|
|
|
// if ( false ) {
|
|
|
|
|
// SamRecordFilter filter = new LocusStreamFilterFunc();
|
|
|
|
|
// return Arrays.asList(filter);
|
|
|
|
|
// } else {
|
|
|
|
|
SamRecordFilter filter1 = new UnmappedReadFilter();
|
|
|
|
|
SamRecordFilter filter2 = new NotPrimaryAlignmentReadFilter();
|
|
|
|
|
SamRecordFilter filter3 = new DuplicateReadFilter();
|
2010-07-20 03:10:29 +08:00
|
|
|
SamRecordFilter filter4 = new FailsVendorQualityCheckReadFilter();
|
2010-07-20 03:14:39 +08:00
|
|
|
|
2010-05-27 06:12:25 +08:00
|
|
|
List<SamRecordFilter> x = super.getMandatoryReadFilters();
|
2010-07-20 03:10:29 +08:00
|
|
|
x.addAll(Arrays.asList(filter4, filter3, filter2, filter1));
|
2010-05-27 06:12:25 +08:00
|
|
|
// }
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2010-05-31 02:00:12 +08:00
|
|
|
* Returns the set of locus iterator discards that this walker wants the engine to discard automatically
|
|
|
|
|
*
|
|
|
|
|
* By default, locus walkers ignore adaptor bases but still see the both bases in the overlapping but non-adaptor
|
|
|
|
|
* parts of the reads.
|
|
|
|
|
* @return
|
2010-05-27 06:12:25 +08:00
|
|
|
*/
|
2010-06-03 06:26:32 +08:00
|
|
|
public List<LocusIteratorFilter> getDiscards() {
|
|
|
|
|
LocusIteratorFilter filter = new InAdaptorFilter();
|
|
|
|
|
return Arrays.asList(filter);
|
2010-05-27 06:12:25 +08:00
|
|
|
}
|
2009-03-16 06:42:24 +08:00
|
|
|
}
|