Cleaned division of responsibilities between arguments to map function. Reference has been changed

from an array of bases to an object (ReferenceContext), and LocusContext has been renamed to reflect
the fact that it contains contextual information only about the alignments, not the locus in general.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1376 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-08-04 21:01:37 +00:00
parent a5a7d7dab8
commit 21d1eba502
101 changed files with 488 additions and 492 deletions

View File

@ -1,4 +1,29 @@
package org.broadinstitute.sting.gatk;
/*
* Copyright (c) 2009 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.gatk.contexts;
import net.sf.picard.reference.ReferenceSequence;
import net.sf.samtools.SAMRecord;
@ -15,20 +40,19 @@ import java.util.*;
* Time: 3:01:34 PM
* To change this template use File | Settings | File Templates.
*/
public class LocusContext {
public class AlignmentContext {
private GenomeLoc loc = null;
private List<SAMRecord> reads = null;
private List<Integer> offsets = null;
private ReferenceSequence refContig = null;
/**
* Create a new LocusContext object
* Create a new AlignmentContext object
*
* @param loc
* @param reads
* @param offsets
*/
public LocusContext(GenomeLoc loc, List<SAMRecord> reads, List<Integer> offsets) {
public AlignmentContext(GenomeLoc loc, List<SAMRecord> reads, List<Integer> offsets) {
//assert loc != null;
//assert loc.getContig() != null;
//assert reads != null;
@ -79,30 +103,6 @@ public class LocusContext {
public void setLocation(GenomeLoc loc) {
this.loc = loc.clone();
}
/**
* Returns the entire reference sequence contig associated with these reads
*
* @return ReferenceSequence object, or null if unavailable
*/
public ReferenceSequence getReferenceContig() {
return refContig;
}
/**
* @return True if reference sequence contig is available
*/
public boolean hasReferenceContig() {
return refContig != null;
}
/**
* Sets the reference sequence for this locus to contig
*
* @param contig
*/
public void setReferenceContig(final ReferenceSequence contig) {
refContig = contig;
}
public void downsampleToCoverage(int coverage) {
if ( numReads() <= coverage )

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2009 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.gatk.contexts;
/**
* The section of the reference that overlaps with the given
* read / locus.
*
* @author hanna
* @version 0.1
*/
public class ReferenceContext {
private char base;
public ReferenceContext( char base ) {
this.base = base;
}
/**
* Get the base at the given locus.
* @return The base at the given locus from the reference.§
*/
public char getBase() {
return base;
}
}

View File

@ -4,7 +4,7 @@ import java.util.NoSuchElementException;
import java.util.ArrayList;
import org.broadinstitute.sting.gatk.iterators.GenomeLocusIterator;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import net.sf.samtools.SAMRecord;
/**
@ -36,7 +36,7 @@ public class AllLocusView extends LocusView {
* What's the context for the last locus accessed?
* @param provider
*/
private LocusContext nextLocusContext = null;
private AlignmentContext nextLocus = null;
/**
* Create a new queue of locus contexts.
@ -48,7 +48,7 @@ public class AllLocusView extends LocusView {
locusIterator = new GenomeLocusIterator( provider.getShard().getGenomeLoc() );
if( locusIterator.hasNext() ) {
nextPosition = locusIterator.next();
nextLocusContext = hasNextLocusContext() ? nextLocusContext() : createEmptyLocusContext(nextPosition);
nextLocus = hasNextLocus() ? nextLocus() : createEmptyLocus(nextPosition);
}
}
@ -56,7 +56,7 @@ public class AllLocusView extends LocusView {
return nextPosition != null;
}
public LocusContext next() {
public AlignmentContext next() {
GenomeLoc currentPosition = nextPosition;
if( currentPosition == null )
throw new NoSuchElementException("No next is available in the all locus view");
@ -65,14 +65,14 @@ public class AllLocusView extends LocusView {
nextPosition = locusIterator.hasNext() ? locusIterator.next() : null;
// Crank the iterator to (if possible) or past the next context.
while( nextLocusContext != null && nextLocusContext.getLocation().isBefore(currentPosition) && hasNextLocusContext() )
nextLocusContext = nextLocusContext();
while( nextLocus != null && nextLocus.getLocation().isBefore(currentPosition) && hasNextLocus() )
nextLocus = nextLocus();
// If actual data is present, return it. Otherwise, return empty data.
if( nextLocusContext != null && nextLocusContext.getLocation().equals(currentPosition) )
return nextLocusContext;
if( nextLocus != null && nextLocus.getLocation().equals(currentPosition) )
return nextLocus;
else
return createEmptyLocusContext( currentPosition );
return createEmptyLocus( currentPosition );
}
/**
@ -80,7 +80,7 @@ public class AllLocusView extends LocusView {
* @param site Site at which to create the blank locus context.
* @return empty context.
*/
private LocusContext createEmptyLocusContext( GenomeLoc site ) {
return new LocusContext(site, new ArrayList<SAMRecord>(), new ArrayList<Integer>());
private AlignmentContext createEmptyLocus( GenomeLoc site ) {
return new AlignmentContext(site, new ArrayList<SAMRecord>(), new ArrayList<Integer>());
}
}

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.apache.log4j.Logger;
/**
@ -31,7 +31,7 @@ public class CoveredLocusView extends LocusView {
* What's the context for the last locus accessed?
* @param provider
*/
private LocusContext nextLocusContext = null;
private AlignmentContext nextLocusContext = null;
private static Logger logger = Logger.getLogger(CoveredLocusView.class);
@ -44,10 +44,10 @@ public class CoveredLocusView extends LocusView {
}
public boolean hasNext() {
return hasNextLocusContext();
return hasNextLocus();
}
public LocusContext next() {
return nextLocusContext();
public AlignmentContext next() {
return nextLocus();
}
}

View File

@ -1,10 +1,10 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.Reads;
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
import org.broadinstitute.sting.gatk.iterators.LocusContextIteratorByHanger;
import org.broadinstitute.sting.gatk.iterators.LocusContextIterator;
import org.broadinstitute.sting.gatk.iterators.LocusIteratorByHanger;
import org.broadinstitute.sting.gatk.iterators.LocusIterator;
import org.broadinstitute.sting.gatk.traversals.TraversalStatistics;
import net.sf.samtools.SAMRecord;
@ -32,7 +32,7 @@ import net.sf.picard.filter.SamRecordFilter;
* A queue of locus context entries.
*/
public abstract class LocusView extends LocusContextIterator implements View {
public abstract class LocusView extends LocusIterator implements View {
/**
* The shard bounding this view.
*/
@ -46,13 +46,13 @@ public abstract class LocusView extends LocusContextIterator implements View {
/**
* The actual locus context iterator.
*/
private LocusContextIterator loci;
private LocusIterator loci;
/**
* The next locus context from the iterator. This value must always be within
* the shard; if its null, there's nothing for the consumer to look at.
*/
private LocusContext nextLocusContext = null;
private AlignmentContext nextLocus = null;
public LocusView(ShardDataProvider provider) {
this.shard = provider.getShard();
@ -60,8 +60,8 @@ public abstract class LocusView extends LocusContextIterator implements View {
Iterator<SAMRecord> reads = new FilteringIterator(provider.getReadIterator(), new LocusStreamFilterFunc());
this.sourceInfo = provider.getReadIterator().getSourceInfo();
this.loci = new LocusContextIteratorByHanger(reads);
seedNextLocusContext();
this.loci = new LocusIteratorByHanger(reads);
seedNextLocus();
provider.register(this);
}
@ -97,7 +97,7 @@ public abstract class LocusView extends LocusContextIterator implements View {
* @return Next covered locus context in the shard.
* @throw NoSuchElementException if no such element exists.
*/
public abstract LocusContext next();
public abstract AlignmentContext next();
/**
* Unsupported.
@ -111,8 +111,8 @@ public abstract class LocusView extends LocusContextIterator implements View {
* Is there another locus context bounded by this shard.
* @return True if another locus context is bounded by this shard.
*/
protected boolean hasNextLocusContext() {
return nextLocusContext != null && !nextLocusContext.getLocation().isPast(shard.getGenomeLoc());
protected boolean hasNextLocus() {
return nextLocus != null && !nextLocus.getLocation().isPast(shard.getGenomeLoc());
}
/**
@ -120,41 +120,41 @@ public abstract class LocusView extends LocusContextIterator implements View {
* @return Next locus context bounded by this shard.
* @throw NoSuchElementException if the next element is missing.
*/
protected LocusContext nextLocusContext() {
if( nextLocusContext == null || nextLocusContext.getLocation().isPast(shard.getGenomeLoc()) )
protected AlignmentContext nextLocus() {
if( nextLocus == null || nextLocus.getLocation().isPast(shard.getGenomeLoc()) )
throw new NoSuchElementException("No more elements remain in locus context queue.");
// Cache the current and apply filtering.
LocusContext current = nextLocusContext;
AlignmentContext current = nextLocus;
// Find the next.
if( loci.hasNext() ) {
nextLocusContext = loci.next();
nextLocus = loci.next();
if( sourceInfo.getDownsampleToCoverage() != null )
current.downsampleToCoverage( sourceInfo.getDownsampleToCoverage() );
if( nextLocusContext.getLocation().isPast(shard.getGenomeLoc()) )
nextLocusContext = null;
if( nextLocus.getLocation().isPast(shard.getGenomeLoc()) )
nextLocus = null;
}
else
nextLocusContext = null;
nextLocus = null;
return current;
}
/**
* Seed the nextLocusContext variable with the contents of the next locus context (if one exists).
* Seed the nextLocus variable with the contents of the next locus (if one exists).
*/
private void seedNextLocusContext() {
private void seedNextLocus() {
if( loci.hasNext() )
nextLocusContext = loci.next();
nextLocus = loci.next();
// Iterate past cruft at the beginning to the first locus in the shard.
while( nextLocusContext != null && nextLocusContext.getLocation().isBefore(shard.getGenomeLoc()) && loci.hasNext() )
nextLocusContext = loci.next();
while( nextLocus != null && nextLocus.getLocation().isBefore(shard.getGenomeLoc()) && loci.hasNext() )
nextLocus = loci.next();
// If nothing in the shard was found, indicate that by setting nextLocusContext to null.
if( nextLocusContext != null && nextLocusContext.getLocation().isBefore(shard.getGenomeLoc()) )
nextLocusContext = null;
// If nothing in the shard was found, indicate that by setting nextAlignmentContext to null.
if( nextLocus != null && nextLocus.getLocation().isBefore(shard.getGenomeLoc()) )
nextLocus = null;
}
/**

View File

@ -22,7 +22,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
/**
@ -35,12 +36,12 @@ public class HelloWalker extends LocusWalker<Integer,Long> {
* which they fall, and the base from the reference that overlaps.
* @param tracker The accessor for reference metadata.
* @param ref The reference base that lines up with this locus.
* @param context Information about reads overlapping this locus.
* @param locus Information about reads overlapping this locus.
* @return In this case, returns a count of how many loci were seen at this site (1).
*/
@Override
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
out.printf("Hello locus %s; your ref base is %c and you have %d reads%n", context.getLocation(), ref, context.getReads().size() );
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
out.printf("Hello locus %s; your ref base is %c and you have %d reads%n", context.getLocation(), ref.getBase(), context.getReads().size() );
return 1;
}

View File

@ -4,6 +4,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import java.util.NoSuchElementException;
import java.util.Iterator;
/**
* User: hanna
* Date: May 12, 2009
@ -20,7 +21,7 @@ import java.util.NoSuchElementException;
/**
* Iterates through all of the loci provided in the reference.
*/
public class GenomeLocusIterator implements LocusIterator {
public class GenomeLocusIterator implements Iterator<GenomeLoc> {
/**
* The entire region over which we're iterating.
*/

View File

@ -1,32 +0,0 @@
package org.broadinstitute.sting.gatk.iterators;
import net.sf.samtools.util.CloseableIterator;
import java.util.Iterator;
import org.broadinstitute.sting.gatk.LocusContext;
/**
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
*/
public abstract class LocusContextIterator implements Iterable<LocusContext>, CloseableIterator<LocusContext> {
// -----------------------------------------------------------------------------------------------------------------
//
// constructors and other basic operations
//
// -----------------------------------------------------------------------------------------------------------------
public Iterator<LocusContext> iterator() {
return this;
}
public void close() {
//this.it.close();
}
public abstract boolean hasNext();
public abstract LocusContext next();
public void remove() {
throw new UnsupportedOperationException("Can not remove records from a SAM file via an iterator!");
}
}

View File

@ -1,24 +1,32 @@
package org.broadinstitute.sting.gatk.iterators;
import org.broadinstitute.sting.utils.GenomeLoc;
import net.sf.samtools.util.CloseableIterator;
import java.util.Iterator;
/**
* User: hanna
* Date: May 12, 2009
* Time: 10:48:56 AM
* 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.
*/
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
/**
* An iterator for iterating through loci on a genome.
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
*/
public abstract class LocusIterator implements Iterable<AlignmentContext>, CloseableIterator<AlignmentContext> {
// -----------------------------------------------------------------------------------------------------------------
//
// constructors and other basic operations
//
// -----------------------------------------------------------------------------------------------------------------
public Iterator<AlignmentContext> iterator() {
return this;
}
public interface LocusIterator extends Iterator<GenomeLoc> {
public void close() {
//this.it.close();
}
public abstract boolean hasNext();
public abstract AlignmentContext next();
public void remove() {
throw new UnsupportedOperationException("Can not remove records from a SAM file via an iterator!");
}
}

View File

@ -1,9 +1,34 @@
/*
* Copyright (c) 2009 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.gatk.iterators;
import net.sf.samtools.AlignmentBlock;
import net.sf.samtools.SAMRecord;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.RefHanger;
@ -14,12 +39,12 @@ import java.util.Iterator;
/**
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
*/
public class LocusContextIteratorByHanger extends LocusContextIterator {
public class LocusIteratorByHanger extends LocusIterator {
/**
* our log, which we want to capture anything from this class
*/
private static Logger logger = Logger.getLogger(LocusContextIteratorByHanger.class);
private static Logger logger = Logger.getLogger(LocusIteratorByHanger.class);
// -----------------------------------------------------------------------------------------------------------------
//
@ -39,11 +64,11 @@ public class LocusContextIteratorByHanger extends LocusContextIterator {
// constructors and other basic operations
//
// -----------------------------------------------------------------------------------------------------------------
public LocusContextIteratorByHanger(final Iterator<SAMRecord> samIterator) {
public LocusIteratorByHanger(final Iterator<SAMRecord> samIterator) {
this.it = new PushbackIterator<SAMRecord>(samIterator);
}
public Iterator<LocusContext> iterator() {
public Iterator<AlignmentContext> iterator() {
return this;
}
@ -80,7 +105,7 @@ public class LocusContextIteratorByHanger extends LocusContextIterator {
// next() routine and associated collection operations
//
// -----------------------------------------------------------------------------------------------------------------
public LocusContext next() {
public AlignmentContext next() {
if ( ! currentPositionIsFullyCovered() )
expandWindow(INCREMENT_SIZE);
@ -99,7 +124,7 @@ public class LocusContextIteratorByHanger extends LocusContextIterator {
//System.out.printf("***** skipping reads%n");
return next();
} else {
return new LocusContext(rhanger.loc, rhanger.data, ohanger.data);
return new AlignmentContext(rhanger.loc, rhanger.data, ohanger.data);
}
}
@ -186,4 +211,4 @@ public class LocusContextIteratorByHanger extends LocusContextIterator {
public void remove() {
throw new UnsupportedOperationException("Can not remove records from a SAM file via an iterator!");
}
}
}

View File

@ -29,7 +29,7 @@ import net.sf.picard.filter.FilteringIterator;
import net.sf.picard.filter.SamRecordFilter;
import net.sf.samtools.SAMRecord;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.datasources.providers.ReadView;
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
import org.broadinstitute.sting.gatk.datasources.shards.ReadShard;
@ -177,13 +177,13 @@ public class TraverseDuplicates extends TraversalEngine {
reads.size(), site.toString(), uniqueReads.size(), duplicateReads.size()));
// Jump forward in the reference to this locus location
LocusContext locus = new LocusContext(site, duplicateReads, Arrays.asList(0));
AlignmentContext locus = new AlignmentContext(site, duplicateReads, Arrays.asList(0));
// update the number of duplicate sets we've seen
TraversalStatistics.nRecords++;
// we still have to fix the locus context provider to take care of this problem with > 1 length contexts
// LocusContext locus = locusProvider.getLocusContext(site);
// AlignmentContext locus = locusProvider.getLocusContext(site);
byte[] refBases = new byte[0];
@ -245,7 +245,7 @@ public class TraverseDuplicates extends TraversalEngine {
List<SAMRecord> duplicateReads,
GenomeLoc site,
byte[] refBases,
LocusContext locus,
AlignmentContext locus,
T sum) {
final boolean keepMeP = dupWalker.filter(site, refBases, locus, uniqueReads, duplicateReads);
if (keepMeP) {

View File

@ -1,8 +1,9 @@
package org.broadinstitute.sting.gatk.traversals;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.WalkerManager;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.datasources.providers.*;
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@ -49,18 +50,18 @@ public class TraverseLoci extends TraversalEngine {
// We keep processing while the next reference location is within the interval
while( locusView.hasNext() ) {
LocusContext locus = locusView.next();
AlignmentContext locus = locusView.next();
TraversalStatistics.nRecords++;
// Iterate forward to get all reference ordered data covering this locus
final RefMetaDataTracker tracker = referenceOrderedDataView.getReferenceOrderedDataAtLocus(locus.getLocation());
char refBase = referenceView.getReferenceBase(locus.getLocation());
ReferenceContext refContext = new ReferenceContext( referenceView.getReferenceBase(locus.getLocation()) );
final boolean keepMeP = locusWalker.filter(tracker, refBase, locus);
final boolean keepMeP = locusWalker.filter(tracker, refContext, locus);
if (keepMeP) {
M x = locusWalker.map(tracker, refBase, locus);
M x = locusWalker.map(tracker, refContext, locus);
sum = locusWalker.reduce(x, sum);
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.traversals;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.datasources.providers.LocusReferenceView;
import org.broadinstitute.sting.gatk.datasources.providers.ReadView;
import org.broadinstitute.sting.gatk.datasources.providers.ReferenceOrderedView;
@ -41,7 +41,7 @@ public class TraverseLocusWindows extends TraversalEngine {
LocusReferenceView referenceView = new LocusReferenceView( dataProvider );
ReferenceOrderedView referenceOrderedDataView = new ReferenceOrderedView( dataProvider );
LocusContext locus = getLocusContext(readView.iterator(), interval);
AlignmentContext locus = getLocusContext(readView.iterator(), interval);
// The TraverseByLocusWindow expands intervals to cover all reads in a non-standard way.
// TODO: Convert this approach to the standard.
@ -66,7 +66,7 @@ public class TraverseLocusWindows extends TraversalEngine {
return sum;
}
private LocusContext getLocusContext(StingSAMIterator readIter, GenomeLoc interval) {
private AlignmentContext getLocusContext(StingSAMIterator readIter, GenomeLoc interval) {
ArrayList<SAMRecord> reads = new ArrayList<SAMRecord>();
boolean done = false;
long leftmostIndex = interval.getStart(),
@ -87,7 +87,7 @@ public class TraverseLocusWindows extends TraversalEngine {
}
GenomeLoc window = GenomeLocParser.createGenomeLoc(interval.getContig(), leftmostIndex, rightmostIndex);
LocusContext locus = new LocusContext(window, reads, null);
AlignmentContext locus = new AlignmentContext(window, reads, null);
if ( readIter.getSourceInfo().getDownsampleToCoverage() != null )
locus.downsampleToCoverage(readIter.getSourceInfo().getDownsampleToCoverage());

View File

@ -2,7 +2,7 @@ package org.broadinstitute.sting.gatk.traversals;
import net.sf.samtools.SAMRecord;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.WalkerManager;
import org.broadinstitute.sting.gatk.datasources.providers.ReadReferenceView;
import org.broadinstitute.sting.gatk.datasources.providers.ReadView;
@ -98,7 +98,7 @@ public class TraverseReads extends TraversalEngine {
for (SAMRecord read : reads) {
// our locus context
LocusContext locus = null;
AlignmentContext locus = null;
// an array of characters that represent the reference
char[] refSeq = null;
@ -108,7 +108,7 @@ public class TraverseReads extends TraversalEngine {
GenomeLoc site = GenomeLocParser.createGenomeLoc(read);
// Jump forward in the reference to this locus location
locus = new LocusContext(site, Arrays.asList(read), Arrays.asList(0));
locus = new AlignmentContext(site, Arrays.asList(read), Arrays.asList(0));
// get the array of characters for the reference sequence, since we're a mapped read
if( dataProvider.hasReference() )

View File

@ -1,11 +1,9 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: mdepristo
@ -14,7 +12,7 @@ import java.util.List;
* To change this template use File | Settings | File Templates.
*/
public class CountLociWalker extends LocusWalker<Integer, Long> implements TreeReducible<Long> {
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
return 1;
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@Requires({DataSource.READS, DataSource.REFERENCE})
public class CountReadsWalker extends ReadWalker<Integer, Integer> {

View File

@ -24,7 +24,8 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.Pair;
@ -36,7 +37,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Integer, Pair<Long, Long>
@Argument(fullName="suppressLocusPrinting",doc="Suppress printing",required=false)
public boolean suppressPrinting = false;
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
if ( !suppressPrinting )
out.printf("%s: %d%n", context.getLocation(), context.getReads().size() );
return context.getReads().size();

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.util.List;
@ -17,7 +17,7 @@ import net.sf.samtools.SAMRecord;
@Requires({DataSource.READS,DataSource.REFERENCE})
public abstract class DuplicateWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
// Do we actually want to operate on the context?
public boolean filter(GenomeLoc loc, byte[] refBases, LocusContext context,
public boolean filter(GenomeLoc loc, byte[] refBases, AlignmentContext context,
List<SAMRecord> uniqueReads,
List<SAMRecord> duplicateReads) {
return true; // We are keeping all the reads
@ -31,7 +31,7 @@ public abstract class DuplicateWalker<MapType, ReduceType> extends Walker<MapTyp
*/
public boolean mapUniqueReadsTooP() { return false; }
public abstract MapType map(GenomeLoc loc, byte[] refBases, LocusContext context,
public abstract MapType map(GenomeLoc loc, byte[] refBases, AlignmentContext context,
List<SAMRecord> uniqueReads,
List<SAMRecord> duplicateReads);

View File

@ -1,7 +1,8 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
/**
* Created by IntelliJ IDEA.
@ -14,10 +15,10 @@ import org.broadinstitute.sting.gatk.LocusContext;
@Requires({DataSource.READS,DataSource.REFERENCE, DataSource.REFERENCE_BASES})
public abstract class LocusWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
return true; // We are keeping all the reads
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
public abstract MapType map(RefMetaDataTracker tracker, char ref, LocusContext context);
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
public abstract MapType map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context);
}

View File

@ -1,9 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
/**
* Created by IntelliJ IDEA.
@ -15,12 +13,12 @@ import net.sf.samtools.SAMRecord;
@Requires({DataSource.READS,DataSource.REFERENCE, DataSource.REFERENCE_BASES})
public abstract class LocusWindowWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, String ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, String ref, AlignmentContext context) {
return true; // We are keeping all the intervals
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
public abstract MapType map(RefMetaDataTracker tracker, String ref, LocusContext context);
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
public abstract MapType map(RefMetaDataTracker tracker, String ref, AlignmentContext context);
// Given result of map function
public abstract ReduceType reduceInit();

View File

@ -1,12 +1,10 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import java.util.List;
// Null traversal. For ATK performance measuring.
// j.maguire 3-7-2009
@ -15,12 +13,12 @@ public class NullWalker extends LocusWalker<Integer, Integer> {
}
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
return true; // We are keeping all the reads
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context)
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
return 1;
}

View File

@ -24,7 +24,8 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@ -67,8 +68,8 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
public void initialize() {
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref.getBase(), context);
String bases = pileup.getBases();
if ( bases.equals("") && !IGNORE_UNCOVERED_BASES ) {

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@ -11,7 +12,6 @@ import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.fasta.IndexedFastaSequenceFile;
import net.sf.picard.reference.ReferenceSequence;
import java.util.List;
import java.io.File;
import java.io.IOException;
@ -45,8 +45,8 @@ public class PileupWithContextWalker extends LocusWalker<Integer, Integer> imple
}
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref.getBase(), context);
String bases = pileup.getBasesWithStrand();
if ( bases.equals("") && FLAG_UNCOVERED_BASES ) {

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import java.util.List;
@ -15,8 +16,8 @@ import net.sf.samtools.SAMRecord;
* Time: 11:23:14 AM
* To change this template use File | Settings | File Templates.
*/
public class PrintLocusContextWalker extends LocusWalker<LocusContext, Integer> implements TreeReducible<Integer> {
public LocusContext map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public class PrintLocusContextWalker extends LocusWalker<AlignmentContext, Integer> implements TreeReducible<Integer> {
public AlignmentContext map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
out.printf( "In map: ref = %s, loc = %s, reads = %s%n", ref,
context.getLocation(),
Arrays.deepToString( getReadNames(context.getReads()) ) );
@ -25,7 +26,7 @@ public class PrintLocusContextWalker extends LocusWalker<LocusContext, Integer>
public Integer reduceInit() { return 0; }
public Integer reduce(LocusContext context, Integer sum) {
public Integer reduce(AlignmentContext context, Integer sum) {
return sum + 1;
}

View File

@ -22,6 +22,6 @@ public abstract class ReadWalker<MapType, ReduceType> extends Walker<MapType, Re
return true;
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
public abstract MapType map(char[] ref, SAMRecord read);
}

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.rodSAMPileup;
import org.broadinstitute.sting.utils.cmdLine.Argument;
@ -22,8 +23,8 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
@Argument(fullName="continue_after_error",doc="Continue after an error",required=false)
public boolean CONTINUE_AFTER_AN_ERROR = false;
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
Pileup pileup = new ReadBackedPileup(ref, context);
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
Pileup pileup = new ReadBackedPileup(ref.getBase(), context);
Pileup truePileup = getTruePileup( tracker );
if ( truePileup == null ) {

View File

@ -1,7 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.ReadFilters;
@ -74,7 +75,7 @@ public class SingleSampleGenotyper extends LocusWalker<SSGGenotypeCall, Genotype
*
* @return true if we should look at this locus, false otherwise
*/
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, char ref, AlignmentContext context) {
return (BaseUtils.simpleBaseToBaseIndex(ref) != -1 && context.getReads().size() != 0);
}
@ -110,10 +111,10 @@ public class SingleSampleGenotyper extends LocusWalker<SSGGenotypeCall, Genotype
* @param ref the reference base
* @param context contextual information around the locus
*/
public SSGGenotypeCall map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public SSGGenotypeCall map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
if ( TESTING_NEW ) {
SSGGenotypeCall oldAndBusted = mapOldAndBusted(tracker, ref, context);
SSGGenotypeCall newHotness = mapNewHotness(tracker, ref, context);
SSGGenotypeCall oldAndBusted = mapOldAndBusted(tracker, ref.getBase(), context);
SSGGenotypeCall newHotness = mapNewHotness(tracker, ref.getBase(), context);
if ( ! oldAndBusted.equals(newHotness) ) {
System.out.printf("Calls not equal:%nold: %s%nnew: %s%n", oldAndBusted, newHotness);
@ -122,14 +123,14 @@ public class SingleSampleGenotyper extends LocusWalker<SSGGenotypeCall, Genotype
return caller == Caller.OLD_AND_BUSTED ? oldAndBusted : newHotness;
} else {
switch ( caller ) {
case OLD_AND_BUSTED: return mapOldAndBusted(tracker, ref, context);
case NEW_HOTNESS: return mapNewHotness(tracker, ref, context);
case OLD_AND_BUSTED: return mapOldAndBusted(tracker, ref.getBase(), context);
case NEW_HOTNESS: return mapNewHotness(tracker, ref.getBase(), context);
default: return null;
}
}
}
private SSGGenotypeCall mapNewHotness(RefMetaDataTracker tracker, char ref, LocusContext context) {
private SSGGenotypeCall mapNewHotness(RefMetaDataTracker tracker, char ref, AlignmentContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
NewHotnessGenotypeLikelihoods G = makeNewHotnessGenotypeLikelihoods(tracker);
G.setDiscovery(GENOTYPE); // set it to discovery mode or variant detection mode
@ -258,7 +259,7 @@ public class SingleSampleGenotyper extends LocusWalker<SSGGenotypeCall, Genotype
//
// TODO -- delete the old and busted routines
//
private SSGGenotypeCall mapOldAndBusted(RefMetaDataTracker tracker, char ref, LocusContext context) {
private SSGGenotypeCall mapOldAndBusted(RefMetaDataTracker tracker, char ref, AlignmentContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
OldAndBustedGenotypeLikelihoods G = makeOldAndBustedGenotypeLikelihoods(tracker);
G.setDiscovery(GENOTYPE); // set it to discovery mode or variant detection mode

View File

@ -5,7 +5,7 @@ import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.LocusWindowWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
import org.broadinstitute.sting.gatk.walkers.ReadFilters;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.filters.Platform454Filter;
import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
import org.broadinstitute.sting.utils.cmdLine.Argument;
@ -98,7 +98,7 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
}
}
public Integer map(RefMetaDataTracker tracker, String ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, String ref, AlignmentContext context) {
List<SAMRecord> reads = context.getReads();
ArrayList<SAMRecord> goodReads = new ArrayList<SAMRecord>();
for ( SAMRecord read : reads ) {

View File

@ -4,7 +4,8 @@ package org.broadinstitute.sting.gatk.walkers.indels;
import net.sf.samtools.*;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.filters.Platform454Filter;
import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
import org.broadinstitute.sting.utils.*;
@ -31,8 +32,8 @@ public class MismatchIntervalWalker extends LocusWalker<Pair<GenomeLoc, Boolean>
throw new RuntimeException("Window Size must be a positive integer");
}
public Pair<GenomeLoc, Boolean> map(RefMetaDataTracker tracker, char ref, LocusContext context) {
char upperRef = Character.toUpperCase(ref);
public Pair<GenomeLoc, Boolean> map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
char upperRef = Character.toUpperCase(ref.getBase());
List<SAMRecord> reads = context.getReads();
List<Integer> offsets = context.getOffsets();
int goodReads = 0, mismatchQualities = 0, totalQualities = 0;

View File

@ -2,7 +2,8 @@
package org.broadinstitute.sting.gatk.walkers.indels;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.cmdLine.Argument;
@ -20,7 +21,7 @@ public class SNPClusterWalker extends RefWalker<GenomeLoc, GenomeLoc> {
throw new RuntimeException("Window Size must be a positive integer");
}
public GenomeLoc map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public GenomeLoc map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
AllelicVariant eval = (AllelicVariant)tracker.lookup("eval", null);
if ( eval instanceof SNPCallFromGenotypes )
return context.getLocation();

View File

@ -2,7 +2,8 @@ package org.broadinstitute.sting.gatk.walkers.recalibration;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMReadGroupRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
@ -77,7 +78,7 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
* @param context
* @return
*/
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
rodDbSNP dbsnp = (rodDbSNP)tracker.lookup("dbSNP", null);
if ( dbsnp == null || !dbsnp.isSNP() ) {
// We aren't at a dbSNP position that's a SNP, so update the read
@ -101,7 +102,7 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
if ((read.getMappingQuality() >= MIN_MAPPING_QUALITY && isSupportedReadGroup(readGroup) )) {
int offset = offsets.get(i);
if ( offset > 0 && offset < (read.getReadLength() - 1) ) { // skip first and last bases because they suck and they don't have a dinuc count
counted_bases += covariateCounter.updateDataFromRead(readGroupString, read, offset, ref);
counted_bases += covariateCounter.updateDataFromRead(readGroupString, read, offset, ref.getBase());
}
}
}

View File

@ -3,7 +3,6 @@ package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
import org.broadinstitute.sting.gatk.LocusContext;
/**
* Created by IntelliJ IDEA.
@ -28,7 +27,6 @@ public class AlignedReadsHistoWalker extends ReadWalker<Integer, Integer> {
return !read.getReadUnmappedFlag();
}
// Map over the org.broadinstitute.sting.atk.LocusContext
public Integer map(char[] ref, SAMRecord read) {
//System.out.println(read.getAttribute("NM"));
int editDist = Integer.parseInt(read.getAttribute("NM").toString());

View File

@ -1,7 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;

View File

@ -3,7 +3,6 @@ package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
import org.broadinstitute.sting.gatk.LocusContext;
/**
* Created by IntelliJ IDEA.
@ -27,7 +26,6 @@ public class BaseQualityHistoWalker extends ReadWalker<Integer, Integer> {
return true; // We are keeping all the reads
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
public Integer map(char[] ref, SAMRecord read) {
for ( byte qual : read.getBaseQualities() ) {
if ( qual < 0 || qual > 100 ) {

View File

@ -5,7 +5,8 @@ import net.sf.samtools.*;
import org.broadinstitute.sting.gatk.*;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.BaseUtils;
@ -37,11 +38,11 @@ public class CoverageBySample extends LocusWalker<String, String>
}
}
public String map(RefMetaDataTracker tracker, char ref, LocusContext context)
public String map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
String line = context.getLocation().getContig() + " " + context.getLocation().getStart() + " " ;
LocusContext[] contexts = filterLocusContext(context, sample_names, 0);
AlignmentContext[] contexts = filterAlignmentContext(context, sample_names, 0);
HashMap<String,Integer> counts = countReadsBySample(context);
for (int i = 0; i < contexts.length; i++)
@ -84,7 +85,7 @@ public class CoverageBySample extends LocusWalker<String, String>
return "";
}
private HashMap<String,Integer> countReadsBySample(LocusContext context)
private HashMap<String,Integer> countReadsBySample(AlignmentContext context)
{
HashMap<String,Integer> counts = new HashMap<String,Integer>();
for (int i = 0; i < sample_names.size(); i++)
@ -101,7 +102,7 @@ public class CoverageBySample extends LocusWalker<String, String>
return counts;
}
private LocusContext[] filterLocusContext(LocusContext context, List<String> sample_names, int downsample)
private AlignmentContext[] filterAlignmentContext(AlignmentContext context, List<String> sample_names, int downsample)
{
HashMap<String,Integer> index = new HashMap<String,Integer>();
for (int i = 0; i < sample_names.size(); i++)
@ -109,7 +110,7 @@ public class CoverageBySample extends LocusWalker<String, String>
index.put(sample_names.get(i), i);
}
LocusContext[] contexts = new LocusContext[sample_names.size()];
AlignmentContext[] contexts = new AlignmentContext[sample_names.size()];
ArrayList<SAMRecord>[] reads = new ArrayList[sample_names.size()];
ArrayList<Integer>[] offsets = new ArrayList[sample_names.size()];
@ -153,14 +154,14 @@ public class CoverageBySample extends LocusWalker<String, String>
reads[j] = downsampled_reads;
offsets[j] = downsampled_offsets;
contexts[j] = new LocusContext(context.getLocation(), reads[j], offsets[j]);
contexts[j] = new AlignmentContext(context.getLocation(), reads[j], offsets[j]);
}
}
else
{
for (int j = 0; j < reads.length; j++)
{
contexts[j] = new LocusContext(context.getLocation(), reads[j], offsets[j]);
contexts[j] = new AlignmentContext(context.getLocation(), reads[j], offsets[j]);
}
}

View File

@ -1,7 +1,8 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.rodGFF;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
@ -42,11 +43,11 @@ public class CoverageEvalWalker extends LocusWalker<List<String>, String> {
out.println("DownsampledCoverage\tAvailableCoverage\tHapmapChipGenotype\tGenotypeCallType\t"+header.substring(1));
}
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
return (BaseUtils.simpleBaseToBaseIndex(ref) != -1 && context.getReads().size() != 0);
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
return (BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 && context.getReads().size() != 0);
}
public List<String> map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public List<String> map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
rodGFF hapmap_chip = (rodGFF)tracker.lookup("hapmap-chip", null);
String hc_genotype;
@ -75,7 +76,7 @@ public class CoverageEvalWalker extends LocusWalker<List<String>, String> {
List<SAMRecord> sub_reads = ListUtils.sliceListByIndices(subset_indices, reads);
List<Integer> sub_offsets = ListUtils.sliceListByIndices(subset_indices, offsets);
LocusContext subContext = new LocusContext(context.getLocation(), sub_reads, sub_offsets);
AlignmentContext subContext = new AlignmentContext(context.getLocation(), sub_reads, sub_offsets);
GenotypeCall call = SSG.map(tracker, ref, subContext);
String callType = (call.isVariation()) ? ((call.isHom()) ? "HomozygousSNP" : "HeterozygousSNP") : "HomozygousReference";

View File

@ -1,15 +1,14 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.walkers.By;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import java.util.*;
import java.util.zip.*;
import java.io.*;
// Plot a histogram of depth of coverage
// j.maguire 6-11-2009
@ -38,9 +37,9 @@ public class CoverageHistogram extends LocusWalker<Integer,Integer>
num_sites = 0;
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context)
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
if (ref == 'N') { return null; }
if (ref.getBase() == 'N') { return null; }
int depth = context.getReads().size();
coverage_hist[depth] += 1;
if (depth > max_depth) { max_depth = depth; }

View File

@ -1,7 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.utils.QualityUtils;
import net.sf.samtools.SAMRecord;

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RefWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
@ -13,8 +14,8 @@ import org.broadinstitute.sting.utils.Pair;
@WalkerName("FastaReferenceMaker")
public class FastaReferenceWalker extends RefWalker<Pair<GenomeLoc, Character>, Pair<GenomeLoc, String>> {
public Pair<GenomeLoc, Character> map(RefMetaDataTracker rodData, char ref, LocusContext context) {
return new Pair<GenomeLoc, Character>(context.getLocation(), ref);
public Pair<GenomeLoc, Character> map(RefMetaDataTracker rodData, ReferenceContext ref, AlignmentContext context) {
return new Pair<GenomeLoc, Character>(context.getLocation(), ref.getBase());
}
public Pair<GenomeLoc, String> reduceInit() {

View File

@ -5,7 +5,8 @@
package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.Pair;
@ -77,8 +78,8 @@ public class CallHLAWalker extends LocusWalker<Integer, Pair<Long, Long>>{
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
ReadBackedPileup pileup = new ReadBackedPileup(ref.getBase(), context);
String bases = pileup.getBases();
long loc = context.getPosition();
if ( !suppressPrinting )
@ -104,7 +105,7 @@ public class CallHLAWalker extends LocusWalker<Integer, Pair<Long, Long>>{
out.printf("%sAs\t%sCs\t%sTs\t%sGs\t",numAs,numCs,numTs,numGs);
OldAndBustedGenotypeLikelihoods G = new OldAndBustedGenotypeLikelihoods(OldAndBustedGenotypeLikelihoods.HUMAN_HETEROZYGOSITY);
SSGGenotypeCall geno = G.callGenotypes(tracker, ref, pileup);
SSGGenotypeCall geno = G.callGenotypes(tracker, ref.getBase(), pileup);
double mLikelihoods[] = geno.getLikelihoods();

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.walkers.By;
import org.broadinstitute.sting.gatk.walkers.DataSource;
@ -52,7 +53,7 @@ public class HybSelPerformanceWalker extends LocusWalker<Integer, HybSelPerforma
// @Argument(fullName="suppressLocusPrinting",required=false,defaultValue="false")
// public boolean suppressPrinting;
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
List<SAMRecord> reads = context.getReads();
int depth = 0;

View File

@ -1,18 +1,13 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.Utils;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMFileWriter;
import net.sf.samtools.SAMFileHeader;
import net.sf.picard.reference.ReferenceSequence;
import java.util.ArrayList;
import java.util.Random;
import java.io.File;
/**
* ReadErrorRateWalker assesses the error rate per read position ('cycle') by comparing the

View File

@ -5,7 +5,8 @@ import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
@ -26,7 +27,7 @@ public class ListSampleIds extends LocusWalker<Boolean, Boolean>
}
}
public Boolean map(RefMetaDataTracker tracker, char ref, LocusContext context)
public Boolean map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
List<SAMRecord> reads = context.getReads();
StringBuilder readNames = new StringBuilder();

View File

@ -1,27 +1,18 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import java.util.Arrays;
import java.util.List;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.refdata.GenotypeList;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.BasicReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.rodSAMPileup;
import org.broadinstitute.sting.gatk.refdata.Genotype;
import org.broadinstitute.sting.gatk.walkers.RefWalker;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import org.broadinstitute.sting.gatk.walkers.RMD;
import org.broadinstitute.sting.playground.utils.GenotypingCallStats;
import org.broadinstitute.sting.playground.utils.TrioConcordanceRecord;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenotypeUtils;
import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.utils.GenotypeUtils.VariantType;
import org.broadinstitute.sting.utils.cmdLine.Argument;
//@Requires(value=DataSource.REFERENCE,referenceMetaData={@RMD(name="mother",type=rodSAMPileup.class),
@ -49,7 +40,7 @@ public class MendelianInheritanceWalker extends RefWalker<TrioConcordanceRecord
private GenotypeUtils.VariantType VARIANT_TYPE;
@Override
public TrioConcordanceRecord map(RefMetaDataTracker rodData, char ref, LocusContext context) {
public TrioConcordanceRecord map(RefMetaDataTracker rodData, ReferenceContext ref, AlignmentContext context) {
// String outLine = new String(context.getLocation() + " REF: "+ref + " RODS:" + rodData.getAllRods().size());

View File

@ -1,14 +1,10 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
import org.broadinstitute.sting.utils.Utils;
import net.sf.picard.reference.ReferenceSequence;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@WalkerName("CountMismatches")

View File

@ -1,13 +1,10 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
import org.broadinstitute.sting.utils.Utils;
import net.sf.picard.reference.ReferenceSequence;
import java.util.Iterator;
import java.util.List;
import static java.lang.reflect.Array.*;

View File

@ -5,11 +5,11 @@ import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.walkers.genotyper.OldAndBustedGenotypeLikelihoods;
import org.broadinstitute.sting.playground.utils.*;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.ReadBackedPileup;
import org.broadinstitute.sting.utils.cmdLine.Argument;
@ -111,11 +111,11 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
}
public MultiSampleCallResult map(RefMetaDataTracker tracker, char ref, LocusContext context)
public MultiSampleCallResult map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
if (ref == 'N') { return null; }
this.ref = ref;
MultiSampleCallResult result = this.MultiSampleCall(tracker, ref, context, sample_names);
if (ref.getBase() == 'N') { return null; }
this.ref = ref.getBase();
MultiSampleCallResult result = this.MultiSampleCall(tracker, ref.getBase(), context, sample_names);
return result;
}
@ -144,7 +144,7 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
char ref;
OldAndBustedGenotypeLikelihoods Genotype(LocusContext context, double[] allele_likelihoods, double indel_alt_freq)
OldAndBustedGenotypeLikelihoods Genotype(AlignmentContext context, double[] allele_likelihoods, double indel_alt_freq)
{
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
String bases = pileup.getBases();
@ -275,7 +275,7 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
return pD;
}
double Compute_pNull(LocusContext[] contexts)
double Compute_pNull(AlignmentContext[] contexts)
{
double[] allele_likelihoods = new double[4];
for (int i = 0; i < 4; i++) { allele_likelihoods[i] = 1e-6/3.0; }
@ -293,7 +293,7 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
double pD;
double pNull;
double lod;
double LOD(LocusContext[] contexts)
double LOD(AlignmentContext[] contexts)
{
em_result = EM(contexts);
OldAndBustedGenotypeLikelihoods[] G = em_result.genotype_likelihoods;
@ -325,7 +325,7 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
}
}
EM_Result EM(LocusContext[] contexts)
EM_Result EM(AlignmentContext[] contexts)
{
double[] allele_likelihoods = new double[4];
@ -357,14 +357,14 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
}
// Hacky global variables for debugging.
double StrandScore(LocusContext context)
double StrandScore(AlignmentContext context)
{
//LocusContext[] contexts = filterLocusContextBySample(context, sample_names, 0);
//AlignmentContext[] contexts = filterAlignmentContextBySample(context, sample_names, 0);
LocusContext fw = filterLocusContextByStrand(context, "+");
LocusContext bw = filterLocusContextByStrand(context, "-");
LocusContext[] contexts_fw = filterLocusContextBySample(fw, sample_names, 0);
LocusContext[] contexts_bw = filterLocusContextBySample(bw, sample_names, 0);
AlignmentContext fw = filterAlignmentContextByStrand(context, "+");
AlignmentContext bw = filterAlignmentContextByStrand(context, "-");
AlignmentContext[] contexts_fw = filterAlignmentContextBySample(fw, sample_names, 0);
AlignmentContext[] contexts_bw = filterAlignmentContextBySample(bw, sample_names, 0);
EM_Result em_fw = EM(contexts_fw);
EM_Result em_bw = EM(contexts_bw);
@ -465,12 +465,12 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
}
// This should actually return a GLF Record
MultiSampleCallResult MultiSampleCall(RefMetaDataTracker tracker, char ref, LocusContext context, List<String> sample_names)
MultiSampleCallResult MultiSampleCall(RefMetaDataTracker tracker, char ref, AlignmentContext context, List<String> sample_names)
{
String in_dbsnp;
if (tracker.lookup("DBSNP", null) != null) { in_dbsnp = "known"; } else { in_dbsnp = "novel"; }
LocusContext[] contexts = filterLocusContextBySample(context, sample_names, 0);
AlignmentContext[] contexts = filterAlignmentContextBySample(context, sample_names, 0);
double lod = LOD(contexts);
double strand_score = StrandScore(context);
//EM_Result em_result = EM(contexts);
@ -521,7 +521,7 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
// Utility Functions
/// Filter a locus context by forward and backward
private LocusContext filterLocusContextByStrand(LocusContext context, String strand)
private AlignmentContext filterAlignmentContextByStrand(AlignmentContext context, String strand)
{
ArrayList<SAMRecord> reads = new ArrayList<SAMRecord>();
ArrayList<Integer> offsets = new ArrayList<Integer>();
@ -537,11 +537,11 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
reads.add(read);
offsets.add(offset);
}
return new LocusContext(context.getLocation(), reads, offsets);
return new AlignmentContext(context.getLocation(), reads, offsets);
}
// Filter a locus context by sample ID
private LocusContext[] filterLocusContextBySample(LocusContext context, List<String> sample_names, int downsample)
private AlignmentContext[] filterAlignmentContextBySample(AlignmentContext context, List<String> sample_names, int downsample)
{
HashMap<String,Integer> index = new HashMap<String,Integer>();
for (int i = 0; i < sample_names.size(); i++)
@ -549,7 +549,7 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
index.put(sample_names.get(i), i);
}
LocusContext[] contexts = new LocusContext[sample_names.size()];
AlignmentContext[] contexts = new AlignmentContext[sample_names.size()];
ArrayList<SAMRecord>[] reads = new ArrayList[sample_names.size()];
ArrayList<Integer>[] offsets = new ArrayList[sample_names.size()];
@ -593,14 +593,14 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
reads[j] = downsampled_reads;
offsets[j] = downsampled_offsets;
contexts[j] = new LocusContext(context.getLocation(), reads[j], offsets[j]);
contexts[j] = new AlignmentContext(context.getLocation(), reads[j], offsets[j]);
}
}
else
{
for (int j = 0; j < reads.length; j++)
{
contexts[j] = new LocusContext(context.getLocation(), reads[j], offsets[j]);
contexts[j] = new AlignmentContext(context.getLocation(), reads[j], offsets[j]);
}
}

View File

@ -2,7 +2,8 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.playground.indels.Matrix;
@ -53,7 +54,7 @@ public class MultiSampleCallerAccuracyTest extends MultiSampleCaller
}
public MultiSampleCallResult map(RefMetaDataTracker tracker, char ref, LocusContext context)
public MultiSampleCallResult map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
HapMapGenotypeROD hapmap = (HapMapGenotypeROD)tracker.lookup("hapmap", null);
@ -83,7 +84,7 @@ public class MultiSampleCallerAccuracyTest extends MultiSampleCaller
ArrayList<String> working_samples = new ArrayList<String>();
working_samples.addAll(variant_samples);
working_samples.addAll(reference_samples);
LocusContext working_context = filterLocusContextBySamples(context, working_samples);
AlignmentContext working_context = filterAlignmentContextBySamples(context, working_samples);
// Call.
MultiSampleCallResult call_result = super.map(tracker, ref, working_context);
@ -155,7 +156,7 @@ public class MultiSampleCallerAccuracyTest extends MultiSampleCaller
// Filter a locus context by sample IDs
// (pulls out only reads from the specified samples, and returns them in one context).
private LocusContext filterLocusContextBySamples(LocusContext context, List<String> sample_names)
private AlignmentContext filterAlignmentContextBySamples(AlignmentContext context, List<String> sample_names)
{
HashSet<String> index = new HashSet<String>();
for (int i = 0; i < sample_names.size(); i++)
@ -185,7 +186,7 @@ public class MultiSampleCallerAccuracyTest extends MultiSampleCaller
}
}
return new LocusContext(context.getLocation(), reads, offsets);
return new AlignmentContext(context.getLocation(), reads, offsets);
}
// END Utility Functions

View File

@ -1,23 +1,13 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.HapMapAlleleFrequenciesROD;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
import java.util.List;
import java.util.Formatter;
import static java.lang.Math.log10;
import edu.mit.broad.picard.genotype.DiploidGenotype;
import net.sf.picard.PicardException;
public class Pilot3CoverageWalker extends LocusWalker<Integer, Integer> {
@ -34,13 +24,13 @@ public class Pilot3CoverageWalker extends LocusWalker<Integer, Integer> {
public String walkerType() { return "ByLocus"; }
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, char ref, AlignmentContext context) {
return true; // We are keeping all the reads
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
int MAPPING_QUALITY_THRESHOLD = 1;
int totalSites;
int tumorCovered;
@ -51,7 +41,7 @@ public class Pilot3CoverageWalker extends LocusWalker<Integer, Integer> {
int lastContigIndex = -1;
long lastPosition = -1;
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
if (start ==0) { start = System.currentTimeMillis(); }
List<SAMRecord> reads = context.getReads();

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
@ -30,7 +31,7 @@ public class PopPriorWalker extends LocusWalker<Integer, Integer> {
public String walkerType() { return "ByLocus"; }
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, char ref, AlignmentContext context) {
return true; // We are keeping all the reads
}
@ -94,9 +95,9 @@ public class PopPriorWalker extends LocusWalker<Integer, Integer> {
}
// Map over the org.broadinstitute.sting.gatk.LocusContext
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
char upRef = Character.toUpperCase(ref);
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
char upRef = Character.toUpperCase(ref.getBase());
List<SAMRecord> reads = context.getReads();
List<Integer> offsets = context.getOffsets();
@ -151,12 +152,12 @@ public class PopPriorWalker extends LocusWalker<Integer, Integer> {
// System.out.println(read.getReadName() + " " + base + " " + qual );
glAll.add(ref, base, qual);
glAll.add(ref.getBase(), base, qual);
if (read.getReadNegativeStrandFlag()) {
glReverse.add(ref, base, qual);
glReverse.add(ref.getBase(), base, qual);
} else {
glForward.add(ref, base, qual);
glForward.add(ref.getBase(), base, qual);
}
}

View File

@ -1,7 +1,8 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.By;
import org.broadinstitute.sting.gatk.walkers.DataSource;
@ -17,17 +18,17 @@ public class PrintCoverageWalker extends LocusWalker<Integer, Integer> {
public String walkerType() { return "ByLocus"; }
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
return true; // We are keeping all the reads
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
int aCount = 0;
int cCount = 0;
int gCount = 0;
int tCount = 0;
char upRef = Character.toUpperCase(ref);
char upRef = Character.toUpperCase(ref.getBase());
List<SAMRecord> reads = context.getReads();
for ( int i = 0; i < reads.size(); i++ )

View File

@ -2,16 +2,9 @@ package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.playground.gatk.walkers.varianteval.Histogram;
import java.util.*;
import java.io.*;
// Sanity check to test HapmapGenotypeROD
// Compute %dbsnp and transition/transversion rate.
@ -27,7 +20,7 @@ public class PrintHapmapGenotypes extends RefWalker<Integer, Integer>
{
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context)
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
{
// Iterate over each analysis, and update it
//rodDbSNP dbsnp = (rodDbSNP)tracker.lookup("dbsnp", null);

View File

@ -1,6 +1,32 @@
/*
* Copyright (c) 2009 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.*;
@ -25,7 +51,7 @@ public class PrintRODsWalker extends RefWalker<Integer, Integer> {
* @param context the context for the given locus
* @return 1 if the locus was successfully processed, 0 if otherwise
*/
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
ReferenceOrderedDatum variant = tracker.lookup("variant", null);
if (variant != null )

View File

@ -1,12 +1,10 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.BaseUtils;
import net.sf.samtools.SAMRecord;
import net.sf.picard.reference.ReferenceSequence;
import java.util.Random;

View File

@ -1,16 +1,10 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.Pair;
import org.broadinstitute.sting.utils.Utils;
import net.sf.samtools.*;
import net.sf.picard.reference.ReferenceSequence;
import java.util.ArrayList;
import java.util.Random;
import java.util.HashMap;
import java.io.File;

View File

@ -1,7 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import net.sf.samtools.SAMRecord;

View File

@ -5,15 +5,13 @@ import java.io.FileWriter;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.GATKArgumentCollection;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.Genotype;
import org.broadinstitute.sting.gatk.walkers.RefWalker;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import org.broadinstitute.sting.gatk.walkers.RMD;
import org.broadinstitute.sting.gatk.refdata.rodRefSeq;
import org.broadinstitute.sting.gatk.refdata.rodRefSeq;
import org.broadinstitute.sting.playground.utils.GenotypingCallStats;
import org.broadinstitute.sting.utils.GenotypeUtils;
import org.broadinstitute.sting.utils.StingException;
@ -56,7 +54,7 @@ public class SomaticMutationFromGenotypeWalker extends RefWalker<SomaticMutatio
private FilterType filter;
@Override
public SomaticMutationRecord map(RefMetaDataTracker rodData, char ref, LocusContext context) {
public SomaticMutationRecord map(RefMetaDataTracker rodData, ReferenceContext ref, AlignmentContext context) {
// String outLine = new String(context.getLocation() + " REF: "+ref + " RODS:" + rodData.getAllRods().size());

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import org.broadinstitute.sting.gatk.walkers.RefWalker;
@ -60,7 +61,7 @@ public class VennCallSetsWalker extends RefWalker<Integer, Integer> {
*/
public Integer reduceInit() { return 0; }
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
AllelicVariant call1 = (AllelicVariant)tracker.lookup("callset1", null);
AllelicVariant call2 = (AllelicVariant)tracker.lookup("callset2", null);

View File

@ -1,18 +1,15 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.DuplicateWalker;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.duplicates.DupUtils;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import java.util.List;
import java.io.File;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMFileWriter;
import net.sf.samtools.SAMFileHeader;
/**
* Created by IntelliJ IDEA.
@ -76,7 +73,7 @@ public class CombineDuplicatesWalker extends DuplicateWalker<SAMRecord, SAMFileW
* @param duplicateReads
* @return
*/
public SAMRecord map(GenomeLoc loc, byte[] refBases, LocusContext context,
public SAMRecord map(GenomeLoc loc, byte[] refBases, AlignmentContext context,
List<SAMRecord> uniqueReads,
List<SAMRecord> duplicateReads) {
//logger.info(String.format("%s has %d duplicates and %d non-duplicates", loc, duplicateReads.size(), uniqueReads.size()));

View File

@ -26,7 +26,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.duplicates;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.DuplicateWalker;
import org.broadinstitute.sting.utils.GenomeLoc;
@ -55,12 +55,12 @@ public class CountDuplicatesWalker extends DuplicateWalker<DuplicateCount, Dupli
* the map function, conforming to the duplicates interface
* @param loc the genomic location
* @param refBases the reference bases that cover this position, which we turn off
* @param context the LocusContext, containing all the reads overlapping this region
* @param context the AlignmentContext, containing all the reads overlapping this region
* @param uniqueReads all the unique reads, bundled together
* @param duplicateReads all the duplicate reads
* @return a DuplicateCount object, with the appropriate stats
*/
public DuplicateCount map(GenomeLoc loc, byte[] refBases, LocusContext context, List<SAMRecord> uniqueReads, List<SAMRecord> duplicateReads) {
public DuplicateCount map(GenomeLoc loc, byte[] refBases, AlignmentContext context, List<SAMRecord> uniqueReads, List<SAMRecord> duplicateReads) {
DuplicateCount dup = new DuplicateCount();
dup.count = 1;
dup.undupDepth = uniqueReads.size();

View File

@ -26,7 +26,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.duplicates;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.DuplicateWalker;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.GenomeLoc;
@ -160,7 +160,7 @@ public class DuplicateQualsWalker extends DuplicateWalker<List<DuplicateComp>, Q
}
// Print out data for regression
public List<DuplicateComp> map(GenomeLoc loc, byte[] refBases, LocusContext context,
public List<DuplicateComp> map(GenomeLoc loc, byte[] refBases, AlignmentContext context,
List<SAMRecord> uniqueReads,
List<SAMRecord> duplicateReads) {
//logger.info(String.format("%s has %d duplicates and %d non-duplicates", loc, duplicateReads.size(), uniqueReads.size()));

View File

@ -3,7 +3,8 @@ package org.broadinstitute.sting.playground.gatk.walkers.indels;
import net.sf.samtools.*;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
@ -16,7 +17,7 @@ public class CoverageGapIntervalWalker extends LocusWalker<Pair<GenomeLoc, Integ
public void initialize() {}
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
int goodReads = 0;
List<SAMRecord> reads = context.getReads();
for (int i = 0; i < reads.size(); i++ ) {
@ -26,7 +27,7 @@ public class CoverageGapIntervalWalker extends LocusWalker<Pair<GenomeLoc, Integ
return goodReads >= minReadsAtInterval;
}
public Pair<GenomeLoc, Integer> map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Pair<GenomeLoc, Integer> map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
// find the probability that this locus has a statistically significant gap in coverage
List<SAMRecord> reads = context.getReads();
List<Integer> offsets = context.getOffsets();

View File

@ -1,8 +1,8 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import java.io.PrintStream;
import java.util.List;
@ -62,5 +62,5 @@ public abstract class BasicVariantAnalysis implements VariantAnalysis {
}
public abstract String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context);
public abstract String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context);
}

View File

@ -2,11 +2,9 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import java.io.PrintStream;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
/**
@ -38,7 +36,7 @@ public class CallableBasesAnalysis extends BasicVariantAnalysis implements Genot
public long nGenotypable(int index) { return genotypable_bases[index]; }
public double percentGenotypable(int index) { return (100.0*nGenotypable(index)) / nSites(); }
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
all_bases++;
if ( eval == null ) // no data here!

View File

@ -3,14 +3,12 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.IntervalRod;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashSet;
import java.io.PrintStream;
/**
* The Broad Institute
@ -37,7 +35,7 @@ public class ClusterCounterAnalysis extends BasicVariantAnalysis implements Geno
variantsWithClusters.add(new HashSet<GenomeLoc>());
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
String r = null;
if ( eval != null && eval.isSNP() ) {

View File

@ -1,11 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import java.io.PrintStream;
import java.util.List;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
/**

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.*;
import java.util.List;
@ -75,7 +75,7 @@ public class GenotypeConcordance extends BasicVariantAnalysis implements Genotyp
}
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
AllelicVariant chip = (AllelicVariant)tracker.lookup(dbName, null);
inc(chip, eval, ref);
return null;

View File

@ -1,15 +1,12 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.SNPCallFromGenotypes;
import org.broadinstitute.sting.gatk.refdata.PooledEMSNPROD;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.genotype.HardyWeinbergCalculation;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
@ -35,7 +32,7 @@ public class HardyWeinbergEquilibrium extends ViolationVariantAnalysis implement
this.threshold = threshold;
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
String r = null;
if ( eval != null &&

View File

@ -1,8 +1,8 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import java.util.List;
import java.util.ArrayList;
@ -29,7 +29,7 @@ public class IndelMetricsAnalysis extends BasicVariantAnalysis implements Genoty
sizes[0][i] = sizes[1][i] = 0;
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
if ( eval != null && eval.isIndel() ) {
if ( eval.isInsertion() )
insertions++;

View File

@ -3,15 +3,13 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.IntervalRod;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.io.PrintStream;
import java.io.File;
import java.io.FileNotFoundException;
/**
* The Broad Institute
@ -36,7 +34,7 @@ public class NeighborDistanceAnalysis extends ViolationVariantAnalysis implement
neighborWiseDistances = new ArrayList<Long>();
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
String r = null;
if ( eval != null && eval.isSNP() ) {

View File

@ -1,13 +1,5 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import java.io.PrintStream;
import java.util.List;
/**
* The Broad Institute
* SOFTWARE COPYRIGHT NOTICE AGREEMENT

View File

@ -2,10 +2,9 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.BaseUtils;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
@ -26,7 +25,7 @@ public class TransitionTranversionAnalysis extends BasicVariantAnalysis implemen
super("transitions_transversions");
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
if ( eval != null && eval.isSNP() ) {
char refBase = eval.getRefSnpFWD();
char altBase = eval.getAltSnpFWD();

View File

@ -2,7 +2,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import java.io.PrintStream;
import java.util.List;
@ -23,7 +23,7 @@ public interface VariantAnalysis {
public PrintStream getCallPrintStream();
public List<String> getParams();
public void initialize(VariantEvalWalker master, PrintStream out, String filename);
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context);
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context);
public void finalize(long nSites);
public List<String> done();
}

View File

@ -2,9 +2,8 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import java.io.PrintStream;
import java.util.List;
import java.util.ArrayList;
@ -26,7 +25,7 @@ public class VariantCounter extends BasicVariantAnalysis implements GenotypeAnal
super("variant_counts");
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
nSNPs += eval == null ? 0 : 1;
return null;
}

View File

@ -2,7 +2,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import java.util.List;
import java.util.ArrayList;
@ -48,7 +48,7 @@ public class VariantDBCoverage extends BasicVariantAnalysis implements GenotypeA
return nOverlappingSites() / (1.0 * nEvalSites());
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
// There are four cases here:
AllelicVariant dbsnp = (AllelicVariant)tracker.lookup(dbName, null);
inc(dbsnp != null, eval != null);

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.SNPCallFromGenotypes;
@ -148,7 +149,7 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
}
}
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
nSites++;
// Iterate over each analysis, and update it
@ -166,13 +167,13 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
}
// update stats about all of the SNPs
updateAnalysisSet(ALL_SNPS, eval, tracker, ref, context);
updateAnalysisSet(ALL_SNPS, eval, tracker, ref.getBase(), context);
// update the known / novel set by checking whether the knownSNPDBName track has an entry here
if ( eval != null ) {
AllelicVariant dbsnp = (AllelicVariant)tracker.lookup(knownSNPDBName, null);
String noveltySet = dbsnp == null ? NOVEL_SNPS : KNOWN_SNPS;
updateAnalysisSet(noveltySet, eval, tracker, ref, context);
updateAnalysisSet(noveltySet, eval, tracker, ref.getBase(), context);
}
if ( eval instanceof SNPCallFromGenotypes ) {
@ -180,7 +181,7 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
int nVarGenotypes = call.nHetGenotypes() + call.nHomVarGenotypes();
//System.out.printf("%d variant genotypes at %s%n", nVarGenotypes, calls);
final String s = nVarGenotypes == 1 ? SINGLETON_SNPS : TWOHIT_SNPS;
updateAnalysisSet(s, eval, tracker, ref, context);
updateAnalysisSet(s, eval, tracker, ref.getBase(), context);
}
return 1;
@ -188,7 +189,7 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
public void updateAnalysisSet(final String analysisSetName, AllelicVariant eval,
RefMetaDataTracker tracker, char ref, LocusContext context) {
RefMetaDataTracker tracker, char ref, AlignmentContext context) {
// Iterate over each analysis, and update it
for ( VariantAnalysis analysis : getAnalysisSet(analysisSetName) ) {
String s = analysis.update(eval, tracker, ref, context);

View File

@ -2,12 +2,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.LocusContext;
import java.io.PrintStream;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
/**
* The Broad Institute
@ -27,7 +22,7 @@ public class VariantMatcher extends BasicVariantAnalysis implements GenotypeAnal
dbName = name;
}
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, LocusContext context) {
public String update(AllelicVariant eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) {
String r = null;
AllelicVariant db = (AllelicVariant)tracker.lookup(dbName, null);

View File

@ -25,15 +25,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.IntervalRod;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.io.PrintStream;
import java.io.File;
import java.io.FileNotFoundException;

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.gatk.walkers.DataSource;
@ -65,7 +66,7 @@ public class ClusteredSNPFilterWalker extends RefWalker<Integer, Integer> {
* @param context the context for the given locus
* @return 1 if the locus was successfully processed, 0 if otherwise
*/
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
rodVariants variant = (rodVariants)tracker.lookup("variant", null);
if (variant != null ) {

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.ReadBackedPileup;
@ -18,7 +18,7 @@ public class IVFBinomialStrand implements IndependentVariantFeature {
}
}
public void compute(char ref, LocusContext context) {
public void compute(char ref, AlignmentContext context) {
likelihoods = new double[10];
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);

View File

@ -1,11 +1,11 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
public class IVFNull implements IndependentVariantFeature {
public void initialize(String arguments) {}
public void compute(char ref, LocusContext context) {
public void compute(char ref, AlignmentContext context) {
}
public double[] getLikelihoods() {

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.ReadBackedPileup;
@ -33,7 +33,7 @@ public class IVFPrimaryBases implements IndependentVariantFeature {
* @param context the context for the given locus
* @return a ten-element array of log-likelihood result of the feature applied to each genotype
*/
public void compute(char ref, LocusContext context) {
public void compute(char ref, AlignmentContext context) {
likelihoods = new double[10];
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.ReadBackedPileup;
@ -60,7 +60,7 @@ public class IVFSecondaryBases implements IndependentVariantFeature {
* @param context the context for the given locus
* @return a ten-element array of log-likelihood result of the feature applied to each genotype
*/
public void compute(char ref, LocusContext context) {
public void compute(char ref, AlignmentContext context) {
likelihoods = new double[10];
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
/**
* Interface for conditionally independent variant features.
@ -26,7 +26,7 @@ public interface IndependentVariantFeature {
* @param ref the reference base
* @param context the context for the given locus
*/
public void compute(char ref, LocusContext context);
public void compute(char ref, AlignmentContext context);
public double[] getLikelihoods();

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.gatk.refdata.TabularROD;
import org.broadinstitute.sting.utils.*;
@ -13,8 +13,6 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import edu.mit.broad.picard.util.MathUtil;
class GenotypeFeatureData extends ArrayList<Double> {
public enum Tail { LeftTailed, RightTailed, TwoTailed }
@ -257,7 +255,7 @@ public abstract class RatioFilter implements VariantExclusionCriterion {
public boolean useZeroQualityReads() { return false; }
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
boolean exclude = false;
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.ReadBackedPileup;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.Pair;
@ -58,7 +58,7 @@ public class VECAlleleBalance implements VariantExclusionCriterion { //extends
return new Pair(major, minor);
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
Pair<Integer, Integer> counts = scoreVariant(ref, pileup, variant);
int n = counts.first + counts.second;

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
/**
@ -22,7 +22,7 @@ public class VECDepthOfCoverage implements VariantExclusionCriterion {
}
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
exclude = context.getReads().size() > maximum;
depth = context.getReads().size();
}

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.utils.BaseUtils;
import net.sf.samtools.SAMRecord;
@ -22,7 +22,7 @@ public class VECFisherStrand implements VariantExclusionCriterion {
factorials.add(0.0); // add fact(0)
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
int allele1 = BaseUtils.simpleBaseToBaseIndex(variant.getBestGenotype().charAt(0));
int allele2 = BaseUtils.simpleBaseToBaseIndex(variant.getBestGenotype().charAt(1));
@ -47,7 +47,7 @@ public class VECFisherStrand implements VariantExclusionCriterion {
public boolean useZeroQualityReads() { return false; }
public boolean strandTest(char ref, LocusContext context, int allele1, int allele2, double threshold, StringBuffer out) {
public boolean strandTest(char ref, AlignmentContext context, int allele1, int allele2, double threshold, StringBuffer out) {
int[][] table = getContingencyTable(context, allele1, allele2);
if ( !variantIsHet(table) )
return false;
@ -185,7 +185,7 @@ public class VECFisherStrand implements VariantExclusionCriterion {
* @param allele2 information for the called variant
* @return a 2x2 contingency table
*/
private static int[][] getContingencyTable(LocusContext context, int allele1, int allele2) {
private static int[][] getContingencyTable(AlignmentContext context, int allele1, int allele2) {
int[][] table = new int[2][2];

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.fasta.IndexedFastaSequenceFile;
@ -54,7 +54,7 @@ public class VECHomopolymer implements VariantExclusionCriterion {
return "";
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
char[] geno = variant.getBestGenotype().toCharArray();
int[] genotype = {-1,-1};

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
public class VECLodThreshold implements VariantExclusionCriterion {
private double lodThreshold = 5.0;
@ -14,7 +14,7 @@ public class VECLodThreshold implements VariantExclusionCriterion {
}
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
lod = variant.getLodBtr();
exclude = lod < lodThreshold;
}

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.utils.MathUtils;
import net.sf.samtools.SAMRecord;
@ -19,7 +19,7 @@ public class VECMappingQuality implements VariantExclusionCriterion {
}
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
List<SAMRecord> reads = context.getReads();
int[] qualities = new int[reads.size()];
for (int i=0; i < reads.size(); i++)

View File

@ -1,13 +1,13 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
public class VECNull implements VariantExclusionCriterion {
public void initialize(String arguments) {
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
}
public boolean isExcludable() {

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.*;
public class VECOnOffGenotypeRatio implements VariantExclusionCriterion { // extends RatioFilter {
@ -55,7 +55,7 @@ public class VECOnOffGenotypeRatio implements VariantExclusionCriterion { // ext
return new Pair<Integer, Integer>(on, off);
}
public void compute(char ref, LocusContext context, rodVariants variant) {
public void compute(char ref, AlignmentContext context, rodVariants variant) {
ReadBackedPileup pileup = new ReadBackedPileup(ref, context);
Pair<Integer, Integer> counts = scoreVariant(ref, pileup, variant);
int n = counts.first + counts.second;

View File

@ -1,12 +1,12 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.rodVariants;
public interface VariantExclusionCriterion {
public void initialize(String arguments);
public void compute(char ref, LocusContext context, rodVariants variant);
public void compute(char ref, AlignmentContext context, rodVariants variant);
public boolean isExcludable();

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.variants;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.*;
@ -181,7 +182,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
* @param context the context for the given locus
* @return 1 if the locus was successfully processed, 0 if otherwise
*/
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
rodVariants variant = (rodVariants) tracker.lookup("variant", null);
rodGFF hapmapSite = null;
@ -193,7 +194,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
}
// Ignore places where we don't have a variant or where the reference base is ambiguous.
if (variant != null && (!TRUTH || hapmapSite != null) && BaseUtils.simpleBaseToBaseIndex(ref) != -1) {
if (variant != null && (!TRUTH || hapmapSite != null) && BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1) {
if (VERBOSE) { out.println("Original:\n " + variant); }
if (LEARNING) {
@ -202,7 +203,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
// Apply features that modify the likelihoods and LOD scores
for ( IndependentVariantFeature ivf : requestedFeatures ) {
ivf.compute(ref, context);
ivf.compute(ref.getBase(), context);
double[] weights = ivf.getLikelihoods();
@ -220,10 +221,10 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
// we need to provide an alternative context without mapping quality 0 reads
// for those exclusion criterion that don't want them
LocusContext Q0freeContext = removeQ0reads(context);
AlignmentContext Q0freeContext = removeQ0reads(context);
for ( VariantExclusionCriterion vec : requestedExclusions ) {
vec.compute(ref, (vec.useZeroQualityReads() ? context : Q0freeContext), variant);
vec.compute(ref.getBase(), (vec.useZeroQualityReads() ? context : Q0freeContext), variant);
String exclusionClassName = rationalizeClassName(vec.getClass());
@ -269,7 +270,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
return 0;
}
private LocusContext removeQ0reads(LocusContext context) {
private AlignmentContext removeQ0reads(AlignmentContext context) {
// set up the variables
List<SAMRecord> reads = context.getReads();
List<Integer> offsets = context.getOffsets();
@ -288,7 +289,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
}
}
return new LocusContext(context.getLocation(), Q0freeReads, Q0freeOffsets);
return new AlignmentContext(context.getLocation(), Q0freeReads, Q0freeOffsets);
}
/**

View File

@ -1,6 +1,5 @@
package org.broadinstitute.sting.utils;
import org.broadinstitute.sting.gatk.LocusContext;
import net.sf.samtools.*;
import java.util.List;

View File

@ -1,10 +1,9 @@
package org.broadinstitute.sting.utils;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import net.sf.samtools.SAMRecord;
import java.util.List;
import java.util.ArrayList;
/**
* Created by IntelliJ IDEA.
@ -19,7 +18,7 @@ public class ReadBackedPileup extends BasicPileup {
List<SAMRecord> reads;
List<Integer> offsets;
public ReadBackedPileup(char ref, LocusContext context ) {
public ReadBackedPileup(char ref, AlignmentContext context ) {
this(context.getLocation(), ref, context.getReads(), context.getOffsets());
}

View File

@ -6,7 +6,7 @@ import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.apache.log4j.Logger;
import net.sf.samtools.SAMRecord;
@ -103,8 +103,8 @@ public class ArtificialReadsTraversal extends TraversalEngine {
// while we still have more reads
for (SAMRecord read : iter) {
// our locus context
LocusContext locus = null;
// our alignment context
AlignmentContext alignment = null;
// an array of characters that represent the reference
char[] refSeq = null;
@ -118,7 +118,7 @@ public class ArtificialReadsTraversal extends TraversalEngine {
sum = readWalker.reduce(x, sum);
}
if (locus != null) { printProgress("loci", locus.getLocation()); }
if (alignment != null) { printProgress("loci", alignment.getLocation()); }
}
return sum;
}

View File

@ -3,7 +3,7 @@ package org.broadinstitute.sting.gatk.datasources.providers;
import org.junit.Assert;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import net.sf.samtools.SAMRecord;
import java.util.List;
@ -42,7 +42,7 @@ public class AllLocusViewTest extends LocusViewTemplate {
for( long i = bounds.getStart(); i <= bounds.getStop(); i++ ) {
GenomeLoc site = GenomeLocParser.createGenomeLoc("chr1",i);
LocusContext locusContext = allLocusView.next();
AlignmentContext locusContext = allLocusView.next();
Assert.assertEquals("Locus context location is incorrect", site, locusContext.getLocation() );
int expectedReadsAtSite = 0;

View File

@ -3,7 +3,7 @@ package org.broadinstitute.sting.gatk.datasources.providers;
import org.junit.Assert;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import net.sf.samtools.SAMRecord;
import java.util.List;
@ -57,7 +57,7 @@ public class CoveredLocusViewTest extends LocusViewTemplate {
Assert.assertTrue("Incorrect number of loci in view",coveredLocusView.hasNext());
LocusContext locusContext = coveredLocusView.next();
AlignmentContext locusContext = coveredLocusView.next();
Assert.assertEquals("Target locus context location is incorrect", site, locusContext.getLocation() );
Assert.assertEquals("Found wrong number of reads at site", expectedReadsAtSite, locusContext.getReads().size());

Some files were not shown because too many files have changed in this diff Show More