Restructuring of ReferenceContext and ReadWalkers to accept a ReferenceContext. Now ReferenceContext is byte[] backed not char[]. Please no more chars for the reference. All of the tests pass now. Coming check-ins are going to clean up the char / byte problems in the GATK
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3397 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
02cc1afdc8
commit
8a725b6c93
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.alignment;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
|
@ -69,14 +70,6 @@ public class AlignmentValidationWalker extends ReadWalker<Integer,Integer> {
|
|||
aligner = new BWACAligner(bwtFiles,configuration);
|
||||
}
|
||||
|
||||
/** Must return true for reads that need to be processed. Reads, for which this method return false will
|
||||
* be skipped by the engine and never passed to the walker.
|
||||
*/
|
||||
@Override
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns a read to the given reference.
|
||||
* @param ref Reference over the read. Read will most likely be unmapped, so ref will be null.
|
||||
|
|
@ -84,7 +77,7 @@ public class AlignmentValidationWalker extends ReadWalker<Integer,Integer> {
|
|||
* @return Number of reads aligned by this map (aka 1).
|
||||
*/
|
||||
@Override
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
//logger.info(String.format("examining read %s", read.getReadName()));
|
||||
|
||||
byte[] bases = read.getReadBases();
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
|||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.alignment.bwa.c.BWACAligner;
|
||||
import org.broadinstitute.sting.alignment.bwa.BWAConfiguration;
|
||||
import org.broadinstitute.sting.alignment.bwa.BWTFiles;
|
||||
|
|
@ -70,14 +71,6 @@ public class AlignmentWalker extends ReadWalker<Integer,Integer> {
|
|||
*/
|
||||
private SAMFileHeader header;
|
||||
|
||||
/** Must return true for reads that need to be processed. Reads, for which this method return false will
|
||||
* be skipped by the engine and never passed to the walker.
|
||||
*/
|
||||
@Override
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aligner object. The aligner object will load and hold the BWT until close() is called.
|
||||
*/
|
||||
|
|
@ -109,7 +102,7 @@ public class AlignmentWalker extends ReadWalker<Integer,Integer> {
|
|||
* @return Number of alignments found for this read.
|
||||
*/
|
||||
@Override
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
SAMRecord alignedRead = aligner.align(read,header);
|
||||
if (outputBam != null) {
|
||||
outputBam.addAlignment(alignedRead);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.alignment;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.alignment.bwa.BWTFiles;
|
||||
import org.broadinstitute.sting.alignment.bwa.BWAConfiguration;
|
||||
import org.broadinstitute.sting.alignment.bwa.c.BWACAligner;
|
||||
|
|
@ -75,7 +76,7 @@ public class CountBestAlignmentsWalker extends ReadWalker<Integer,Integer> {
|
|||
* @return Number of alignments found for this read.
|
||||
*/
|
||||
@Override
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
Iterator<Alignment[]> alignmentIterator = aligner.getAllAlignments(read.getReadBases()).iterator();
|
||||
if(alignmentIterator.hasNext()) {
|
||||
int numAlignments = alignmentIterator.next().length;
|
||||
|
|
|
|||
|
|
@ -51,18 +51,20 @@ public class ReferenceContext {
|
|||
/**
|
||||
* The bases in the window around the current locus.
|
||||
*/
|
||||
private char[] bases;
|
||||
private byte[] bases;
|
||||
|
||||
private char[] basesAsCharCached = null;
|
||||
|
||||
/**
|
||||
* Contructor for a simple, windowless reference context.
|
||||
* @param locus locus of interest.
|
||||
* @param base reference base at that locus.
|
||||
*/
|
||||
public ReferenceContext( GenomeLoc locus, char base ) {
|
||||
this( locus, locus, new char[] { base } );
|
||||
public ReferenceContext( GenomeLoc locus, byte base ) {
|
||||
this( locus, locus, new byte[] { base } );
|
||||
}
|
||||
|
||||
public ReferenceContext( GenomeLoc locus, GenomeLoc window, char[] bases ) {
|
||||
public ReferenceContext( GenomeLoc locus, GenomeLoc window, byte[] bases ) {
|
||||
// if( !window.containsP(locus) )
|
||||
// throw new StingException("Invalid locus or window; window does not contain locus");
|
||||
|
||||
|
|
@ -87,10 +89,15 @@ public class ReferenceContext {
|
|||
* Get the base at the given locus.
|
||||
* @return The base at the given locus from the reference.
|
||||
*/
|
||||
public char getBase() {
|
||||
public byte getBase() {
|
||||
return bases[(int)(locus.getStart() - window.getStart())];
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public char getBaseAsChar() {
|
||||
return (char)getBase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base at the given locus.
|
||||
* @return The base at the given locus from the reference.
|
||||
|
|
@ -104,10 +111,18 @@ public class ReferenceContext {
|
|||
* @return All bases available. If the window is of size [0,0], the array will
|
||||
* contain only the base at the given locus.
|
||||
*/
|
||||
public char[] getBases() {
|
||||
public byte[] getBases() {
|
||||
return bases;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public char[] getBasesAsChars() {
|
||||
if ( basesAsCharCached == null )
|
||||
basesAsCharCached = new String(bases).toCharArray();
|
||||
return basesAsCharCached;
|
||||
}
|
||||
|
||||
|
||||
/** Extracts from the current window and returns n bases starting at this context's locus (NOT
|
||||
* from the window start!). The returned array of chars is newly allocated. If n is too large (runs beyond
|
||||
* the right boundary of this context's window), an exception will be thrown. If n==(-1), all bases starting
|
||||
|
|
@ -115,12 +130,12 @@ public class ReferenceContext {
|
|||
* @param n number of requested bases including and starting from the current locus
|
||||
* @return
|
||||
*/
|
||||
public char[] getBasesAtLocus(int n) {
|
||||
public byte[] getBasesAtLocusAsByte(int n) {
|
||||
|
||||
int start = (int)(locus.getStart()-window.getStart());
|
||||
int stop = ( n==(-1) ? bases.length : start+n );
|
||||
|
||||
char[] b = new char[stop-start];
|
||||
byte[] b = new byte[stop-start];
|
||||
|
||||
if ( stop > bases.length )
|
||||
throw new StingException("Bases beyond the current window requested: window="+window+", requested="+n);
|
||||
|
|
@ -129,4 +144,9 @@ public class ReferenceContext {
|
|||
for ( int j = start ; j < stop ; j++) b[i++]=bases[j];
|
||||
return b;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public char[] getBasesAtLocus(int n) {
|
||||
return new String(getBasesAtLocusAsByte(n)).toCharArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,16 @@ public class Allele implements Comparable<Allele> {
|
|||
throw new IllegalArgumentException("Unexpected base in allele bases " + new String(bases));
|
||||
}
|
||||
|
||||
|
||||
public Allele(byte base, boolean isRef) {
|
||||
this( base1ToBases(base), isRef);
|
||||
}
|
||||
|
||||
private static byte[] base1ToBases(byte base) {
|
||||
byte[] bases = { base };
|
||||
return bases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bases bases representing an allele
|
||||
* @return true if the bases represent the null allele
|
||||
|
|
@ -171,6 +181,7 @@ public class Allele implements Comparable<Allele> {
|
|||
this(bases.getBytes(), isRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a non-Ref allele. @see Allele(byte[], boolean) for full information
|
||||
*
|
||||
|
|
|
|||
|
|
@ -174,27 +174,51 @@ public class LocusReferenceView extends ReferenceView {
|
|||
//validateLocation( genomeLoc );
|
||||
|
||||
GenomeLoc window = GenomeLocParser.createGenomeLoc( genomeLoc.getContig(), getWindowStart(genomeLoc), getWindowStop(genomeLoc) );
|
||||
char[] bases = null;
|
||||
|
||||
if(bounds != null) {
|
||||
int refStart = -1;
|
||||
if (bounds != null) {
|
||||
window = trimToBounds(window);
|
||||
bases = StringUtil.bytesToString( referenceSequence.getBases(), (int)(window.getStart() - getWindowStart(bounds)), (int)window.size() ).toCharArray();
|
||||
refStart = (int)(window.getStart() - getWindowStart(bounds));
|
||||
}
|
||||
else {
|
||||
if(referenceSequence == null || referenceSequence.getContigIndex() != genomeLoc.getContigIndex())
|
||||
referenceSequence = reference.getSequence(genomeLoc.getContig());
|
||||
bases = StringUtil.bytesToString( referenceSequence.getBases(), (int)window.getStart()-1, (int)window.size()).toCharArray();
|
||||
refStart = (int)window.getStart()-1;
|
||||
}
|
||||
|
||||
// todo -- how often is this copy unnecessary?
|
||||
int len = (int)window.size();
|
||||
byte[] bases = new byte[len];
|
||||
System.arraycopy(referenceSequence.getBases(), refStart, bases, 0, len);
|
||||
return new ReferenceContext( genomeLoc, window, bases );
|
||||
}
|
||||
|
||||
// public ReferenceContext getReferenceContext( GenomeLoc genomeLoc ) {
|
||||
// //validateLocation( genomeLoc );
|
||||
//
|
||||
// GenomeLoc window = GenomeLocParser.createGenomeLoc( genomeLoc.getContig(), getWindowStart(genomeLoc), getWindowStop(genomeLoc) );
|
||||
// char[] bases = null;
|
||||
//
|
||||
// if(bounds != null) {
|
||||
// window = trimToBounds(window);
|
||||
// bases = StringUtil.bytesToString( referenceSequence.getBases(), (int)(window.getStart() - getWindowStart(bounds)), (int)window.size() ).toCharArray();
|
||||
// }
|
||||
// else {
|
||||
// if(referenceSequence == null || referenceSequence.getContigIndex() != genomeLoc.getContigIndex())
|
||||
// referenceSequence = reference.getSequence(genomeLoc.getContig());
|
||||
// bases = StringUtil.bytesToString( referenceSequence.getBases(), (int)window.getStart()-1, (int)window.size()).toCharArray();
|
||||
// }
|
||||
// return new ReferenceContext( genomeLoc, window, bases );
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Allow the user to pull reference info from any arbitrary region of the reference.
|
||||
* @param genomeLoc The locus.
|
||||
* @return A list of the bases starting at the start of the locus (inclusive) and ending
|
||||
* at the end of the locus (inclusive).
|
||||
*/
|
||||
public char[] getReferenceBases( GenomeLoc genomeLoc ) {
|
||||
public byte[] getReferenceBases( GenomeLoc genomeLoc ) {
|
||||
return super.getReferenceBases(genomeLoc);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import net.sf.picard.reference.ReferenceSequence;
|
|||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
/*
|
||||
* Copyright (c) 2009 The Broad Institute
|
||||
*
|
||||
|
|
@ -61,10 +62,16 @@ public class ReadReferenceView extends ReferenceView {
|
|||
* mapped to the reference, followed by X's coresponding to the rest of the read.
|
||||
* This indicates that the rest lies off the end of the contig.
|
||||
*/
|
||||
public char[] getReferenceBases( SAMRecord read ) {
|
||||
if (read.getReadUnmappedFlag())
|
||||
return null;
|
||||
return getReferenceBases( GenomeLocParser.createGenomeLoc(read) );
|
||||
// public char[] getReferenceBases( SAMRecord read ) {
|
||||
// if (read.getReadUnmappedFlag())
|
||||
// return null;
|
||||
// return getReferenceBases( GenomeLocParser.createGenomeLoc(read) );
|
||||
// }
|
||||
|
||||
public ReferenceContext getReferenceContext( SAMRecord read ) {
|
||||
GenomeLoc loc = GenomeLocParser.createGenomeLoc(read);
|
||||
byte[] bases = super.getReferenceBases(loc);
|
||||
return new ReferenceContext( loc, loc, bases );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@ package org.broadinstitute.sting.gatk.datasources.providers;
|
|||
import org.broadinstitute.sting.utils.fasta.IndexedFastaSequenceFile;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Collection;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.sf.samtools.SAMSequenceRecord;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import net.sf.samtools.util.StringUtil;
|
||||
import net.sf.picard.reference.ReferenceSequence;
|
||||
/**
|
||||
|
|
@ -60,10 +64,41 @@ public class ReferenceView implements View {
|
|||
* @return A list of the bases starting at the start of the locus (inclusive) and ending
|
||||
* at the end of the locus (inclusive).
|
||||
*/
|
||||
protected char[] getReferenceBases( GenomeLoc genomeLoc ) {
|
||||
// protected char[] getReferenceBasesAsChars( GenomeLoc genomeLoc ) {
|
||||
//// SAMSequenceRecord sequenceInfo = reference.getSequenceDictionary().getSequence(genomeLoc.getContig());
|
||||
//// long stop = Math.min( genomeLoc.getStop(), sequenceInfo.getSequenceLength() );
|
||||
//// ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(),genomeLoc.getStart(),stop);
|
||||
//// return (StringUtil.bytesToString(subsequence.getBases()) + Utils.dupString('X', (int)(genomeLoc.getStop() - stop)) ).toCharArray();
|
||||
// return new String(getReferenceBases(genomeLoc)).toCharArray();
|
||||
// }
|
||||
|
||||
final static int BUFFER = 10000;
|
||||
final static byte[] Xs = new byte[BUFFER];
|
||||
static {
|
||||
Arrays.fill(Xs, (byte)'X');
|
||||
}
|
||||
|
||||
protected byte[] getReferenceBases( SAMRecord read ) {
|
||||
return getReferenceBases(GenomeLocParser.createGenomeLoc(read));
|
||||
|
||||
}
|
||||
|
||||
protected byte[] getReferenceBases( GenomeLoc genomeLoc ) {
|
||||
SAMSequenceRecord sequenceInfo = reference.getSequenceDictionary().getSequence(genomeLoc.getContig());
|
||||
long stop = Math.min( genomeLoc.getStop(), sequenceInfo.getSequenceLength() );
|
||||
ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(),genomeLoc.getStart(),stop);
|
||||
return (StringUtil.bytesToString(subsequence.getBases()) + Utils.dupString('X', (int)(genomeLoc.getStop() - stop)) ).toCharArray();
|
||||
ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(), genomeLoc.getStart(), stop);
|
||||
|
||||
int overhang = (int)(genomeLoc.getStop() - stop);
|
||||
if ( overhang > 0 ) {
|
||||
if ( overhang > BUFFER ) // todo -- this is a bit dangerous
|
||||
throw new StingException("Insufficient buffer size for Xs overhanging genome -- expand BUFFER");
|
||||
byte[] all = new byte[subsequence.getBases().length + overhang];
|
||||
System.arraycopy(subsequence.getBases(), 0, all, 0, subsequence.getBases().length);
|
||||
System.arraycopy(Xs, 0, all, subsequence.getBases().length, overhang);
|
||||
return all;
|
||||
} else {
|
||||
// fast path
|
||||
return subsequence.getBases();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ public class RefMetaDataTracker {
|
|||
*
|
||||
* see getVariantContexts for more information.
|
||||
*
|
||||
* @param ref ReferenceContext to enable conversion to variant context
|
||||
* @param name name
|
||||
* @param curLocation location
|
||||
* @param allowedTypes allowed types
|
||||
|
|
@ -239,17 +240,17 @@ public class RefMetaDataTracker {
|
|||
* @param takeFirstOnly do we take the first rod only?
|
||||
* @return variant context
|
||||
*/
|
||||
public Collection<VariantContext> getVariantContexts(String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
|
||||
return getVariantContexts(null, Arrays.asList(name), allowedTypes, curLocation, requireStartHere, takeFirstOnly);
|
||||
}
|
||||
// public Collection<VariantContext> getVariantContexts(String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
|
||||
// return getVariantContexts(null, Arrays.asList(name), allowedTypes, curLocation, requireStartHere, takeFirstOnly);
|
||||
// }
|
||||
|
||||
public Collection<VariantContext> getVariantContexts(ReferenceContext ref, String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
|
||||
return getVariantContexts(ref, Arrays.asList(name), allowedTypes, curLocation, requireStartHere, takeFirstOnly);
|
||||
}
|
||||
|
||||
public Collection<VariantContext> getVariantContexts(Collection<String> names, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
|
||||
return getVariantContexts(null, names, allowedTypes, curLocation, requireStartHere, takeFirstOnly);
|
||||
}
|
||||
// public Collection<VariantContext> getVariantContexts(Collection<String> names, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
|
||||
// return getVariantContexts(null, names, allowedTypes, curLocation, requireStartHere, takeFirstOnly);
|
||||
// }
|
||||
|
||||
public Collection<VariantContext> getVariantContexts(ReferenceContext ref, Collection<String> names, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
|
||||
Collection<VariantContext> contexts = new ArrayList<VariantContext>();
|
||||
|
|
@ -274,8 +275,8 @@ public class RefMetaDataTracker {
|
|||
* @param requireStartHere do we require the rod to start at this location?
|
||||
* @return variant context
|
||||
*/
|
||||
public VariantContext getVariantContext(String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere ) {
|
||||
Collection<VariantContext> contexts = getVariantContexts(name, allowedTypes, curLocation, requireStartHere, false );
|
||||
public VariantContext getVariantContext(ReferenceContext ref, String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere ) {
|
||||
Collection<VariantContext> contexts = getVariantContexts(ref, name, allowedTypes, curLocation, requireStartHere, false );
|
||||
|
||||
if ( contexts.size() > 1 )
|
||||
throw new StingException("Requested a single VariantContext object for track " + name + " but multiple variants were present at position " + curLocation);
|
||||
|
|
|
|||
|
|
@ -61,17 +61,17 @@ public class VariantContextAdaptors {
|
|||
|
||||
/** generic superclass */
|
||||
private static abstract class VCAdaptor {
|
||||
abstract VariantContext convert(String name, Object input);
|
||||
// abstract VariantContext convert(String name, Object input);
|
||||
abstract VariantContext convert(String name, Object input, ReferenceContext ref);
|
||||
}
|
||||
|
||||
public static VariantContext toVariantContext(String name, Object variantContainingObject) {
|
||||
if ( ! adaptors.containsKey(variantContainingObject.getClass()) )
|
||||
return null;
|
||||
else {
|
||||
return adaptors.get(variantContainingObject.getClass()).convert(name, variantContainingObject);
|
||||
}
|
||||
}
|
||||
// public static VariantContext toVariantContext(String name, Object variantContainingObject) {
|
||||
// if ( ! adaptors.containsKey(variantContainingObject.getClass()) )
|
||||
// return null;
|
||||
// else {
|
||||
// return adaptors.get(variantContainingObject.getClass()).convert(name, variantContainingObject);
|
||||
// }
|
||||
// }
|
||||
|
||||
public static VariantContext toVariantContext(String name, Object variantContainingObject, ReferenceContext ref) {
|
||||
if ( ! adaptors.containsKey(variantContainingObject.getClass()) )
|
||||
|
|
@ -96,9 +96,9 @@ public class VariantContextAdaptors {
|
|||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private static class DBSnpAdaptor extends VCAdaptor {
|
||||
VariantContext convert(String name, Object input) {
|
||||
return convert(name, input, null);
|
||||
}
|
||||
// VariantContext convert(String name, Object input) {
|
||||
// return convert(name, input, null);
|
||||
// }
|
||||
|
||||
VariantContext convert(String name, Object input, ReferenceContext ref) {
|
||||
DbSNPFeature dbsnp = (DbSNPFeature)input;
|
||||
|
|
@ -132,10 +132,10 @@ public class VariantContextAdaptors {
|
|||
}
|
||||
|
||||
private static class VCFRecordAdaptor extends VCAdaptor {
|
||||
// WARNING: do not use this method if you have anything other than point mutations in your VCF
|
||||
VariantContext convert(String name, Object input) {
|
||||
return vcfToVariantContext(name, (VCFRecord)input, null);
|
||||
}
|
||||
// // WARNING: do not use this method if you have anything other than point mutations in your VCF
|
||||
// VariantContext convert(String name, Object input) {
|
||||
// return vcfToVariantContext(name, (VCFRecord)input, null);
|
||||
// }
|
||||
|
||||
VariantContext convert(String name, Object input, ReferenceContext ref) {
|
||||
return vcfToVariantContext(name, (VCFRecord)input, ref);
|
||||
|
|
@ -168,7 +168,7 @@ public class VariantContextAdaptors {
|
|||
Allele allele;
|
||||
// special case: semi-deletion
|
||||
if ( vcf.isDeletion() && refAllele.length() > alt.getLength() ) {
|
||||
char[] semiDeletion = new char[refAllele.length() - alt.getLength()];
|
||||
byte[] semiDeletion = new byte[refAllele.length() - alt.getLength()];
|
||||
System.arraycopy(ref.getBases(), alt.getLength(), semiDeletion, 0, refAllele.length() - alt.getLength());
|
||||
allele = new Allele(String.valueOf(semiDeletion), false);
|
||||
} else {
|
||||
|
|
@ -223,13 +223,16 @@ public class VariantContextAdaptors {
|
|||
}
|
||||
|
||||
private static Allele determineRefAllele(VCFRecord vcf, ReferenceContext ref) {
|
||||
if ( ref == null )
|
||||
throw new StingException("Illegal determineRefAllele call!");
|
||||
|
||||
Allele refAllele;
|
||||
if ( vcf.isInsertion() ) {
|
||||
refAllele = new Allele(Allele.NULL_ALLELE_STRING, true);
|
||||
} else if ( ref == null ) {
|
||||
refAllele = new Allele(vcf.getReference(), true);
|
||||
// } else if ( ref == null ) {
|
||||
// refAllele = new Allele(vcf.getReference(), true);
|
||||
} else if ( !vcf.isIndel() ) {
|
||||
refAllele = new Allele(Character.toString(ref.getBase()), true);
|
||||
refAllele = new Allele(ref.getBase(), true);
|
||||
} else if ( vcf.isDeletion() ) {
|
||||
int start = (int)(ref.getLocus().getStart() - ref.getWindow().getStart() + 1);
|
||||
int delLength = 0;
|
||||
|
|
@ -240,9 +243,7 @@ public class VariantContextAdaptors {
|
|||
if ( delLength > ref.getWindow().getStop() - ref.getLocus().getStop() )
|
||||
throw new IllegalArgumentException("Length of deletion is larger than reference context provided at " + ref.getLocus());
|
||||
|
||||
char[] deletion = new char[delLength];
|
||||
System.arraycopy(ref.getBases(), start, deletion, 0, delLength);
|
||||
refAllele = new Allele(String.valueOf(deletion), true);
|
||||
refAllele = deletionAllele(ref, start, delLength);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Conversion of VCF type " + vcf.getType() + " is not supported.");
|
||||
}
|
||||
|
|
@ -250,6 +251,13 @@ public class VariantContextAdaptors {
|
|||
return refAllele;
|
||||
}
|
||||
|
||||
private static Allele deletionAllele(ReferenceContext ref, int start, int len) {
|
||||
byte[] deletion = new byte[len];
|
||||
System.arraycopy(ref.getBases(), start, deletion, 0, len);
|
||||
return new Allele(deletion, true);
|
||||
}
|
||||
|
||||
|
||||
public static VCFHeader createVCFHeader(Set<VCFHeaderLine> hInfo, VariantContext vc) {
|
||||
HashSet<String> names = new LinkedHashSet<String>();
|
||||
for ( Genotype g : vc.getGenotypesSortedByName() ) {
|
||||
|
|
@ -259,11 +267,11 @@ public class VariantContextAdaptors {
|
|||
return new VCFHeader(hInfo == null ? new HashSet<VCFHeaderLine>() : hInfo, names);
|
||||
}
|
||||
|
||||
public static VCFRecord toVCF(VariantContext vc, char vcfRefBase) {
|
||||
public static VCFRecord toVCF(VariantContext vc, byte vcfRefBase) {
|
||||
return toVCF(vc, vcfRefBase, null, true, false);
|
||||
}
|
||||
|
||||
public static VCFRecord toVCF(VariantContext vc, char vcfRefBase, List<String> allowedGenotypeAttributeKeys, boolean filtersWereAppliedToContext, boolean filtersWereAppliedToGenotypes) {
|
||||
public static VCFRecord toVCF(VariantContext vc, byte vcfRefBase, List<String> allowedGenotypeAttributeKeys, boolean filtersWereAppliedToContext, boolean filtersWereAppliedToGenotypes) {
|
||||
// deal with the reference
|
||||
String referenceBases = new String(vc.getReference().getBases());
|
||||
|
||||
|
|
@ -293,21 +301,21 @@ public class VariantContextAdaptors {
|
|||
if ( a.isNull() ) {
|
||||
if ( a.isReference() ) {
|
||||
// ref, where alt is insertion
|
||||
encoding = new VCFGenotypeEncoding(Character.toString(vcfRefBase));
|
||||
encoding = new VCFGenotypeEncoding(Character.toString((char)vcfRefBase));
|
||||
} else {
|
||||
// non-ref deletion
|
||||
encoding = new VCFGenotypeEncoding("D" + Integer.toString(referenceBases.length()));
|
||||
}
|
||||
} else if ( a.isReference() ) {
|
||||
// ref, where alt is deletion
|
||||
encoding = new VCFGenotypeEncoding(Character.toString(vcfRefBase));
|
||||
encoding = new VCFGenotypeEncoding(Character.toString((char)vcfRefBase));
|
||||
} else {
|
||||
// non-ref insertion
|
||||
encoding = new VCFGenotypeEncoding("I" + alleleString);
|
||||
}
|
||||
} else if ( vc.getType() == VariantContext.Type.NO_VARIATION ) {
|
||||
// ref
|
||||
encoding = new VCFGenotypeEncoding(Character.toString(vcfRefBase));
|
||||
encoding = new VCFGenotypeEncoding(Character.toString((char)vcfRefBase));
|
||||
} else {
|
||||
// ref or alt for snp
|
||||
encoding = new VCFGenotypeEncoding(alleleString);
|
||||
|
|
@ -381,7 +389,7 @@ public class VariantContextAdaptors {
|
|||
infoFields.put(key, outputValue);
|
||||
}
|
||||
|
||||
return new VCFRecord(Character.toString(vcfRefBase), contig, position, ID, vcfAltAlleles, qual, filters, infoFields, genotypeFormatString, genotypeObjects);
|
||||
return new VCFRecord(Character.toString((char)vcfRefBase), contig, position, ID, vcfAltAlleles, qual, filters, infoFields, genotypeFormatString, genotypeObjects);
|
||||
}
|
||||
|
||||
private static String formatVCFField(String key, Object val) {
|
||||
|
|
@ -389,7 +397,7 @@ public class VariantContextAdaptors {
|
|||
if ( val == null )
|
||||
result = VCFGenotypeRecord.getMissingFieldValue(key);
|
||||
else if ( val instanceof Double )
|
||||
result = String.format("%.2f", val);
|
||||
result = String.format("%.2f", (Double)val);
|
||||
else
|
||||
result = val.toString();
|
||||
|
||||
|
|
@ -418,9 +426,9 @@ public class VariantContextAdaptors {
|
|||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private static class PlinkRodAdaptor extends VCAdaptor {
|
||||
VariantContext convert(String name, Object input) {
|
||||
return convert(name, input, null);
|
||||
}
|
||||
// VariantContext convert(String name, Object input) {
|
||||
// return convert(name, input, null);
|
||||
// }
|
||||
|
||||
VariantContext convert(String name, Object input, ReferenceContext ref) {
|
||||
if ( ref == null )
|
||||
|
|
@ -487,16 +495,15 @@ public class VariantContextAdaptors {
|
|||
private Allele determineRefAllele(PlinkRod plink, ReferenceContext ref) {
|
||||
Allele refAllele;
|
||||
if ( !plink.isIndel() ) {
|
||||
refAllele = new Allele(Character.toString(ref.getBase()), true);
|
||||
refAllele = new Allele(ref.getBase(), true);
|
||||
} else if ( plink.isInsertion() ) {
|
||||
refAllele = new Allele(Allele.NULL_ALLELE_STRING, true);
|
||||
} else {
|
||||
long maxLength = ref.getWindow().getStop() - ref.getLocus().getStop();
|
||||
if ( plink.getLength() > maxLength )
|
||||
throw new UnsupportedOperationException("Plink conversion currently can only handle indels up to length " + maxLength);
|
||||
char[] deletion = new char[plink.getLength()];
|
||||
System.arraycopy(ref.getBases(), 1, deletion, 0, plink.getLength());
|
||||
refAllele = new Allele(String.valueOf(deletion), true);
|
||||
refAllele = deletionAllele(ref, 1, plink.getLength());
|
||||
|
||||
}
|
||||
return refAllele;
|
||||
}
|
||||
|
|
@ -588,9 +595,9 @@ public class VariantContextAdaptors {
|
|||
* @param input the Rod object, in this case a RodGeliText
|
||||
* @return a VariantContext object
|
||||
*/
|
||||
VariantContext convert(String name, Object input) {
|
||||
return convert(name, input, null);
|
||||
}
|
||||
// VariantContext convert(String name, Object input) {
|
||||
// return convert(name, input, null);
|
||||
// }
|
||||
|
||||
/**
|
||||
* convert to a Variant Context, given:
|
||||
|
|
@ -656,9 +663,9 @@ public class VariantContextAdaptors {
|
|||
* @param input the Rod object, in this case a RodGeliText
|
||||
* @return a VariantContext object
|
||||
*/
|
||||
VariantContext convert(String name, Object input) {
|
||||
return convert(name, input, null);
|
||||
}
|
||||
// VariantContext convert(String name, Object input) {
|
||||
// return convert(name, input, null);
|
||||
// }
|
||||
|
||||
/**
|
||||
* convert to a Variant Context, given:
|
||||
|
|
@ -729,9 +736,9 @@ public class VariantContextAdaptors {
|
|||
* @param input the Rod object, in this case a RodGeliText
|
||||
* @return a VariantContext object
|
||||
*/
|
||||
VariantContext convert(String name, Object input) {
|
||||
return convert(name, input, null);
|
||||
}
|
||||
// VariantContext convert(String name, Object input) {
|
||||
// return convert(name, input, null);
|
||||
// }
|
||||
|
||||
/**
|
||||
* convert to a Variant Context, given:
|
||||
|
|
@ -748,7 +755,7 @@ public class VariantContextAdaptors {
|
|||
|
||||
// add the reference allele
|
||||
HashSet<Allele> alleles = new HashSet<Allele>();
|
||||
Allele refAllele = new Allele(Character.toString(ref.getBase()), true);
|
||||
Allele refAllele = new Allele(ref.getBase(), true);
|
||||
alleles.add(refAllele);
|
||||
|
||||
// make a mapping from sample to genotype
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@ package org.broadinstitute.sting.gatk.traversals;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.apache.log4j.Logger;
|
||||
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.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The Broad Institute
|
||||
|
|
@ -77,12 +79,12 @@ public class TraverseReads<M,T> extends TraversalEngine<M,T,ReadWalker<M,T>,Read
|
|||
|
||||
// while we still have more reads
|
||||
for (SAMRecord read : reads) {
|
||||
// an array of characters that represent the reference
|
||||
char[] refSeq = null;
|
||||
// ReferenceContext -- the reference bases covered by the read
|
||||
ReferenceContext refContext = null;
|
||||
|
||||
// get the array of characters for the reference sequence, since we're a mapped read
|
||||
if (needsReferenceBasesP && !read.getReadUnmappedFlag() && dataProvider.hasReference())
|
||||
refSeq = reference.getReferenceBases(read);
|
||||
refContext = reference.getReferenceContext(read);
|
||||
|
||||
// update the number of reads we've seen
|
||||
TraversalStatistics.nRecords++;
|
||||
|
|
@ -91,9 +93,9 @@ public class TraverseReads<M,T> extends TraversalEngine<M,T,ReadWalker<M,T>,Read
|
|||
// if the read is mapped, create a metadata tracker
|
||||
ReadMetaDataTracker tracker = (read.getReferenceIndex() >= 0) ? rodView.getReferenceOrderedDataForRead(read) : null;
|
||||
|
||||
final boolean keepMeP = walker.filter(refSeq, read);
|
||||
final boolean keepMeP = walker.filter(refContext, read);
|
||||
if (keepMeP) {
|
||||
M x = walker.map(refSeq, read, tracker); // the tracker can be null
|
||||
M x = walker.map(refContext, read, tracker); // the tracker can be null
|
||||
sum = walker.reduce(x, sum);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.broadinstitute.sting.commandline.Argument;
|
|||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -168,7 +169,7 @@ public class ClipReadsWalker extends ReadWalker<ClipReadsWalker.ReadClipper, Cli
|
|||
* @param read the read itself, as a SAMRecord
|
||||
* @return the ReadClipper object describing what should be done to clip this read
|
||||
*/
|
||||
public ReadClipper map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public ReadClipper map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
if ( onlyDoRead == null || read.getReadName().equals(onlyDoRead) ) {
|
||||
ReadClipper clipper = new ReadClipper(read);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
|||
*/
|
||||
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import net.sf.samtools.SAMFileWriter;
|
||||
|
|
@ -62,7 +63,7 @@ public class FixBAMSortOrderTag extends ReadWalker<SAMRecord, SAMFileWriter> {
|
|||
public SAMFileHeader.SortOrder SORT_ORDER=SAMFileHeader.SortOrder.coordinate;
|
||||
|
||||
@Override
|
||||
public SAMRecord map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public SAMRecord map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
return read;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
|||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
|
|
@ -113,7 +114,7 @@ public class FlagStatWalker extends ReadWalker<Integer, Integer> {
|
|||
|
||||
private FlagStat myStat = new FlagStat();
|
||||
|
||||
public Integer map( char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
public Integer map( ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
myStat.readCount++;
|
||||
if (read.getReadFailsVendorQualityCheckFlag()) {
|
||||
myStat.QC_failure++;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
|||
if(shouldShowSecondaryBasePileup(basePileup))
|
||||
secondBasePileup = getSecondBasePileup(basePileup);
|
||||
|
||||
out.printf("%s%s %s%n", basePileup.getPileupString(ref.getBase()), secondBasePileup, rods);
|
||||
out.printf("%s%s %s%n", basePileup.getPileupString(ref.getBaseAsChar()), secondBasePileup, rods);
|
||||
}
|
||||
|
||||
if ( context.hasExtendedEventPileup() ) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import net.sf.samtools.SAMFileWriter;
|
|||
import net.sf.samtools.SAMReadGroupRecord;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
/**
|
||||
|
|
@ -63,7 +64,7 @@ public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
|
|||
* @param read the read itself, as a SAMRecord
|
||||
* @return true if the read passes the filter, false if it doesn't
|
||||
*/
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
public boolean filter(ReferenceContext ref, SAMRecord read) {
|
||||
// check the read group
|
||||
if ( readGroup != null ) {
|
||||
SAMReadGroupRecord myReadGroup = read.getReadGroup();
|
||||
|
|
@ -91,7 +92,7 @@ public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
|
|||
* @param read the read itself, as a SAMRecord
|
||||
* @return the read itself
|
||||
*/
|
||||
public SAMRecord map( char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
public SAMRecord map( ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
return read;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
|||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
|
|
@ -18,11 +19,11 @@ public abstract class ReadWalker<MapType, ReduceType> extends Walker<MapType, Re
|
|||
/** Must return true for reads that need to be processed. Reads, for which this method return false will
|
||||
* be skipped by the engine and never passed to the walker.
|
||||
*/
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
public boolean filter(ReferenceContext ref, SAMRecord read) {
|
||||
// We are keeping all the reads
|
||||
return true;
|
||||
}
|
||||
|
||||
// Map over the org.broadinstitute.sting.gatk.contexts.AlignmentContext
|
||||
public abstract MapType map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker);
|
||||
public abstract MapType map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
|||
|
||||
import net.sf.samtools.*;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -53,7 +54,7 @@ public class SplitSamFileWalker extends ReadWalker<SAMRecord, Map<String, SAMFil
|
|||
logger.info("SplitSamFile version: " + VERSION);
|
||||
}
|
||||
|
||||
public SAMRecord map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public SAMRecord map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
return read;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation {
|
|||
private static double computeGCContent(ReferenceContext ref) {
|
||||
int gc = 0, at = 0;
|
||||
|
||||
for ( char base : ref.getBases() ) {
|
||||
for ( byte base : ref.getBases() ) {
|
||||
int baseIndex = BaseUtils.simpleBaseToBaseIndex(base);
|
||||
if ( baseIndex == BaseUtils.gIndex || baseIndex == BaseUtils.cIndex )
|
||||
gc++;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
|
|||
|
||||
int run;
|
||||
if ( vc.isSNP() ) {
|
||||
run = computeHomopolymerRun(vc.getAlternateAllele(0).toString().charAt(0), ref);
|
||||
run = computeHomopolymerRun(vc.getAlternateAllele(0).getBases()[0], ref);
|
||||
} else if ( vc.isIndel() && ANNOTATE_INDELS ) {
|
||||
run = computeIndelHomopolymerRun(vc,ref);
|
||||
} else {
|
||||
|
|
@ -42,12 +42,12 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
|
|||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
|
||||
private static int computeHomopolymerRun(char altAllele, ReferenceContext ref) {
|
||||
private static int computeHomopolymerRun(byte altAllele, ReferenceContext ref) {
|
||||
|
||||
// TODO -- this needs to be computed in a more accurate manner
|
||||
// We currently look only at direct runs of the alternate allele adjacent to this position
|
||||
|
||||
char[] bases = ref.getBases();
|
||||
byte[] bases = ref.getBases();
|
||||
GenomeLoc window = ref.getWindow();
|
||||
GenomeLoc locus = ref.getLocus();
|
||||
|
||||
|
|
@ -71,13 +71,13 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
|
|||
}
|
||||
|
||||
private static int computeIndelHomopolymerRun(VariantContext vc, ReferenceContext ref) {
|
||||
char[] bases = ref.getBases();
|
||||
byte[] bases = ref.getBases();
|
||||
GenomeLoc locus = ref.getLocus();
|
||||
GenomeLoc window = ref.getWindow();
|
||||
int refBasePos = (int) (locus.getStart() - window.getStart())+1;
|
||||
if ( vc.isDeletion() ) {
|
||||
// check that deleted bases are the same
|
||||
char dBase = bases[refBasePos];
|
||||
byte dBase = bases[refBasePos];
|
||||
for ( int i = 0; i < vc.getAlternateAllele(0).length(); i ++ ) {
|
||||
if ( bases[refBasePos+i] != dBase ) {
|
||||
return 0;
|
||||
|
|
@ -87,7 +87,7 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
|
|||
return computeHomopolymerRun(dBase,ref);
|
||||
} else {
|
||||
// check that inserted bases are the same
|
||||
char insBase = (char) vc.getAlternateAllele(0).getBases()[0];
|
||||
byte insBase = vc.getAlternateAllele(0).getBases()[0];
|
||||
for ( byte b : vc.getAlternateAllele(0).getBases() ) {
|
||||
if ( insBase != (char) b ) {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public abstract class RankSumTest implements InfoFieldAnnotation, WorkInProgress
|
|||
if ( context == null )
|
||||
continue;
|
||||
|
||||
fillQualsFromPileup(ref.getBase(), vc.getAlternateAllele(0).toString().charAt(0), context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), refQuals, altQuals);
|
||||
fillQualsFromPileup(ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), refQuals, altQuals);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class SecondBaseSkew implements InfoFieldAnnotation, ExperimentalAnnotati
|
|||
Pair<Integer, Integer> depth = new Pair<Integer, Integer>(0, 0);
|
||||
for ( String sample : stratifiedContexts.keySet() ) {
|
||||
//Pair<Integer,Integer> sampleDepth = getSecondaryPileupNonrefCount(ref.getBase(),stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getPileup(), alternate);
|
||||
Pair<Integer, Integer> sampleDepth = getSecondaryPileupNonrefCount(ref.getBase(), stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), alternate);
|
||||
Pair<Integer, Integer> sampleDepth = getSecondaryPileupNonrefCount(ref.getBaseAsChar(), stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), alternate);
|
||||
depth.first += sampleDepth.first;
|
||||
depth.second += sampleDepth.second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public class VariantAnnotator extends LocusWalker<Integer, Integer> {
|
|||
return 0;
|
||||
|
||||
Object variant = rods.get(0);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("variant", variant);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("variant", variant, ref);
|
||||
if ( vc == null )
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,12 +77,12 @@ public class IndelSubsets implements ConcordanceType {
|
|||
}
|
||||
|
||||
private int homopolymerRunSize(ReferenceContext ref, VCFRecord indel) {
|
||||
char[] bases = ref.getBases();
|
||||
byte[] bases = ref.getBases();
|
||||
GenomeLoc window = ref.getWindow();
|
||||
GenomeLoc locus = ref.getLocus();
|
||||
|
||||
int refBasePos = (int)(locus.getStart() - window.getStart());
|
||||
char indelBase = indel.isDeletion() ? bases[refBasePos+1] : indel.getAlternateAlleleList().get(0).charAt(0);
|
||||
byte indelBase = indel.isDeletion() ? bases[refBasePos+1] : (byte)indel.getAlternateAlleleList().get(0).charAt(0);
|
||||
int leftRun = 0;
|
||||
for ( int i = refBasePos; i >= 0; i--) {
|
||||
if ( bases[i] != indelBase )
|
||||
|
|
@ -90,7 +90,7 @@ public class IndelSubsets implements ConcordanceType {
|
|||
leftRun++;
|
||||
}
|
||||
|
||||
indelBase = indel.isDeletion() ? bases[Math.min(refBasePos+indel.getAlternateAlleleList().get(0).length(),bases.length-1)] : indel.getAlternateAlleleList().get(0).charAt(indel.getAlternateAlleleList().get(0).length()-1);
|
||||
indelBase = indel.isDeletion() ? bases[Math.min(refBasePos+indel.getAlternateAlleleList().get(0).length(),bases.length-1)] : (byte)indel.getAlternateAlleleList().get(0).charAt(indel.getAlternateAlleleList().get(0).length()-1);
|
||||
int rightRun = 0;
|
||||
for ( int i = refBasePos + (indel.isDeletion() ? 1+indel.getAlternateAlleleList().get(0).length() : 1); i < bases.length; i++) {
|
||||
if ( bases[i] != indelBase )
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class SNPGenotypeConcordance implements ConcordanceType {
|
|||
}
|
||||
|
||||
public String computeConcordance(Map<String, VCFGenotypeRecord> samplesToRecords, ReferenceContext ref) {
|
||||
char refBase = ref.getBase();
|
||||
char refBase = ref.getBaseAsChar();
|
||||
|
||||
VCFGenotypeRecord call1 = samplesToRecords.get(sample1);
|
||||
if ( call1 != null && call1.isNoCall() )
|
||||
|
|
@ -90,7 +90,7 @@ public class SNPGenotypeConcordance implements ConcordanceType {
|
|||
// are they the same genotype
|
||||
if ( genotype1.equals(genotype2) )
|
||||
result.append("sameGenotype");
|
||||
else if ( sameVariantAllele(genotype1, genotype2, ref.getBase()) )
|
||||
else if ( sameVariantAllele(genotype1, genotype2, ref.getBaseAsChar()) )
|
||||
result.append("differentGenotypeSameVariantAllele");
|
||||
else
|
||||
result.append("differentVariantAllele");
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import net.sf.samtools.SAMRecord;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
/**
|
||||
|
|
@ -54,7 +55,7 @@ public class CoarseCoverageWalker extends ReadWalker<Integer,Integer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
if ( read.getReadUnmappedFlag() ||
|
||||
read.getDuplicateReadFlag() ||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.gatk.walkers.fasta;
|
|||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
|
@ -59,7 +60,7 @@ public class BamToFastqWalker extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
out.println("@" + read.getReadName());
|
||||
if ( !RE_REVERSE || !read.getReadNegativeStrandFlag() ) {
|
||||
out.println(read.getReadString());
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class FastaAlternateReferenceWalker extends FastaReferenceWalker {
|
|||
return new Pair<GenomeLoc, String>(context.getLocation(), "");
|
||||
}
|
||||
|
||||
String refBase = String.valueOf(ref.getBase());
|
||||
String refBase = String.valueOf(ref.getBaseAsChar());
|
||||
|
||||
for ( VariantContext vc : tracker.getAllVariantContexts(ref) ) {
|
||||
// if we have multiple variants at a locus, just take the first one we see
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
|||
if ( rods.size() == 0 )
|
||||
return 0;
|
||||
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("variant", rods.get(0));
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("variant", rods.get(0), ref);
|
||||
FiltrationContext varContext = new FiltrationContext(tracker, ref, vc);
|
||||
|
||||
// if we're still initializing the context, do so
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import net.sf.samtools.util.SequenceUtil;
|
||||
|
||||
public class SimpleIndelCalculationModel extends GenotypeCalculationModel {
|
||||
|
||||
private int MIN_COVERAGE = 6;
|
||||
|
|
@ -100,7 +102,7 @@ public class SimpleIndelCalculationModel extends GenotypeCalculationModel {
|
|||
// calculate the sum of quality scores for each base
|
||||
ReadBackedExtendedEventPileup pileup = context.getExtendedEventPileup();
|
||||
|
||||
List<Pair<String,Integer>> all_events = pileup.getEventStringsWithCounts(ref);
|
||||
List<Pair<String,Integer>> all_events = pileup.getEventStringsWithCounts(BaseUtils.charSeq2byteSeq(ref));
|
||||
for ( Pair<String,Integer> p : all_events ) {
|
||||
if ( p.second > bestIndelCount ) {
|
||||
bestIndelCount = p.second;
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ public class UnifiedGenotyperEngine {
|
|||
gcm.set(GenotypeCalculationModelFactory.makeGenotypeCalculation(samples, logger, UAC, format, verboseWriter, beagleWriter));
|
||||
}
|
||||
|
||||
char ref = Character.toUpperCase(refContext.getBase());
|
||||
char ref = Character.toUpperCase(refContext.getBaseAsChar());
|
||||
if ( !BaseUtils.isRegularBase(ref) )
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODItera
|
|||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadFilters;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
import org.broadinstitute.sting.utils.collections.CircularArray;
|
||||
|
|
@ -178,7 +179,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
|||
|
||||
|
||||
@Override
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
// if ( read.getReadName().equals("428EFAAXX090610:2:36:1384:639#0") ) System.out.println("GOT READ");
|
||||
|
||||
|
|
@ -294,9 +295,9 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
|||
if ( rg == null ) throw new StingException("Read "+read.getReadName()+" has no read group in merged stream. RG is required for somatic calls.");
|
||||
|
||||
if ( normalReadGroups.contains(rg) ) {
|
||||
normal_context.add(read,ref);
|
||||
normal_context.add(read,ref.getBasesAsChars());
|
||||
} else if ( tumorReadGroups.contains(rg) ) {
|
||||
tumor_context.add(read,ref);
|
||||
tumor_context.add(read,ref.getBasesAsChars());
|
||||
} else {
|
||||
throw new StingException("Unrecognized read group in merged stream: "+rg);
|
||||
}
|
||||
|
|
@ -315,7 +316,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
|||
|
||||
|
||||
} else {
|
||||
normal_context.add(read, ref);
|
||||
normal_context.add(read, ref.getBasesAsChars());
|
||||
if ( normal_context.getReads().size() > MAX_READ_NUMBER ) {
|
||||
System.out.println("WARNING: a count of "+MAX_READ_NUMBER+" reads reached in a window "+
|
||||
refName+':'+normal_context.getStart()+'-'+normal_context.getStop()+". The whole window will be dropped");
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import net.sf.samtools.util.StringUtil;
|
|||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
|
||||
|
|
@ -283,7 +284,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
if ( currentInterval == null ) {
|
||||
emit(read);
|
||||
return 0;
|
||||
|
|
@ -314,9 +315,9 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ) {
|
||||
readsNotToClean.add(read);
|
||||
} else {
|
||||
readsToClean.add(read, ref);
|
||||
readsToClean.add(read, ref.getBasesAsChars());
|
||||
// add the rods to the list of known variants
|
||||
populateKnownIndels(metaDataTracker);
|
||||
populateKnownIndels(metaDataTracker, null); // todo -- fixme!
|
||||
}
|
||||
|
||||
if ( readsToClean.size() + readsNotToClean.size() >= MAX_READS ) {
|
||||
|
|
@ -335,7 +336,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private void cleanAndCallMap(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker, GenomeLoc readLoc) {
|
||||
private void cleanAndCallMap(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker, GenomeLoc readLoc) {
|
||||
clean(readsToClean);
|
||||
knownIndelsToTry.clear();
|
||||
|
||||
|
|
@ -403,7 +404,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
private void populateKnownIndels(ReadMetaDataTracker metaDataTracker) {
|
||||
private void populateKnownIndels(ReadMetaDataTracker metaDataTracker, ReferenceContext ref) {
|
||||
for ( Collection<GATKFeature> rods : metaDataTracker.getContigOffsetMapping().values() ) {
|
||||
Iterator<GATKFeature> rodIter = rods.iterator();
|
||||
while ( rodIter.hasNext() ) {
|
||||
|
|
@ -411,7 +412,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
if ( knownIndelsToTry.containsKey(rod) )
|
||||
continue;
|
||||
if ( VariantContextAdaptors.canBeConvertedToVariantContext(rod))
|
||||
knownIndelsToTry.put(rod, VariantContextAdaptors.toVariantContext("", rod));
|
||||
knownIndelsToTry.put(rod, VariantContextAdaptors.toVariantContext("", rod, ref));
|
||||
else
|
||||
knownIndelsToTry.put(rod, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class RealignerTargetCreator extends LocusWalker<RealignerTargetCreator.E
|
|||
if ( pileup != null ) {
|
||||
|
||||
int mismatchQualities = 0, totalQualities = 0;
|
||||
char upperRef = Character.toUpperCase(ref.getBase());
|
||||
char upperRef = Character.toUpperCase(ref.getBaseAsChar());
|
||||
for (PileupElement p : pileup ) {
|
||||
// check the ends of the reads to see how far they extend
|
||||
SAMRecord read = p.getRead();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
|||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
/**
|
||||
* Walks over the input data set, calculating the number of reads seen for diagnostic purposes.
|
||||
|
|
@ -13,7 +14,7 @@ import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
|||
*/
|
||||
@Requires({DataSource.READS, DataSource.REFERENCE})
|
||||
public class CountReadsWalker extends ReadWalker<Integer, Integer> {
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker tracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker tracker) {
|
||||
//System.out.println(read.format());
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.walkers.Requires;
|
|||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
|
@ -104,7 +105,7 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
|||
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
if ( AlignmentUtils.isReadUnmapped(read) && MAPPED_ONLY) return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import net.sf.samtools.SAMRecord;
|
|||
*/
|
||||
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.getBase(),
|
||||
out.printf( "In map: ref = %s, loc = %s, reads = %s%n", ref.getBaseAsChar(),
|
||||
context.getLocation(),
|
||||
Arrays.deepToString( getReadNames(context.getReads()) ) );
|
||||
return context;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.broadinstitute.sting.gatk.walkers.Requires;
|
|||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
|
|
@ -67,7 +68,7 @@ public class ReadClippingStatsWalker extends ReadWalker<ReadClippingStatsWalker.
|
|||
int readLength, nClippingEvents, nClippedBases;
|
||||
}
|
||||
|
||||
public ReadClippingInfo map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public ReadClippingInfo map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
if ( AlignmentUtils.isReadUnmapped(read) && MAPPED_ONLY)
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.qc;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import net.sf.samtools.SAMFileWriter;
|
||||
|
|
@ -67,7 +68,7 @@ public class ReadValidationWalker extends ReadWalker<SAMRecord, SAMRecord> {
|
|||
* @param read the read itself, as a SAMRecord
|
||||
* @return true if the read passes the filter, false if it doesn't
|
||||
*/
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
public boolean filter(ReferenceContext ref, SAMRecord read) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ public class ReadValidationWalker extends ReadWalker<SAMRecord, SAMRecord> {
|
|||
* @param read the read itself, as a SAMRecord
|
||||
* @return the read itself
|
||||
*/
|
||||
public SAMRecord map( char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
public SAMRecord map( ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
return read;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
|||
SAMPileupFeature truePileup = getTruePileup( tracker );
|
||||
|
||||
if ( truePileup == null ) {
|
||||
out.printf("No truth pileup data available at %s%n", pileup.getPileupString(ref.getBase()));
|
||||
out.printf("No truth pileup data available at %s%n", pileup.getPileupString(ref.getBaseAsChar()));
|
||||
if ( ! CONTINUE_AFTER_AN_ERROR ) {
|
||||
Utils.scareUser(String.format("No pileup data available at %s given GATK's output of %s -- this walker requires samtools pileup data over all bases",
|
||||
context.getLocation(), new String(pileup.getBases())));
|
||||
|
|
@ -62,7 +62,7 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
|||
} else {
|
||||
String pileupDiff = pileupDiff(pileup, truePileup, true);
|
||||
if ( pileupDiff != null ) {
|
||||
out.printf("%s vs. %s%n", pileup.getPileupString(ref.getBase()), truePileup.getPileupString());
|
||||
out.printf("%s vs. %s%n", pileup.getPileupString(ref.getBaseAsChar()), truePileup.getPileupString());
|
||||
if ( ! CONTINUE_AFTER_AN_ERROR ) {
|
||||
throw new RuntimeException(String.format("Pileups aren't equal: %s", pileupDiff));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
if( gatkRead.getBaseQualities()[offset] > 0 ) {
|
||||
|
||||
bases = gatkRead.getReadBases();
|
||||
refBase = (byte)ref.getBase();
|
||||
refBase = ref.getBase();
|
||||
|
||||
// Skip if this base is an 'N' or etc.
|
||||
if( BaseUtils.isRegularBase( (char)(bases[offset]) ) ) {
|
||||
|
|
@ -345,9 +345,9 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
* @param context The AlignmentContext which holds the reads covered by this locus
|
||||
* @param ref The reference base
|
||||
*/
|
||||
private static void updateMismatchCounts(final Pair<Long, Long> counts, final AlignmentContext context, final char ref) {
|
||||
private static void updateMismatchCounts(final Pair<Long, Long> counts, final AlignmentContext context, final byte ref) {
|
||||
for( PileupElement p : context.getBasePileup() ) {
|
||||
final char readChar = (char)(p.getBase());
|
||||
final byte readChar = p.getBase();
|
||||
final int readCharBaseIndex = BaseUtils.simpleBaseToBaseIndex(readChar);
|
||||
final int refCharBaseIndex = BaseUtils.simpleBaseToBaseIndex(ref);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import org.broadinstitute.sting.gatk.walkers.DataSource;
|
|||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||
|
|
@ -316,7 +317,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
|||
* @param read The read to be recalibrated
|
||||
* @return The read with quality scores replaced
|
||||
*/
|
||||
public SAMRecord map( char[] refBases, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
public SAMRecord map( ReferenceContext refBases, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
|
||||
RecalDataManager.parseSAMRecord( read, RAC );
|
||||
|
||||
|
|
@ -332,7 +333,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
|||
return read; // can't recalibrate a SOLiD read with no calls in the color space, and the user wants to skip over them
|
||||
}
|
||||
}
|
||||
originalQuals = RecalDataManager.calcColorSpace( read, originalQuals, RAC.SOLID_RECAL_MODE, coinFlip, refBases );
|
||||
originalQuals = RecalDataManager.calcColorSpace( read, originalQuals, RAC.SOLID_RECAL_MODE, coinFlip, refBases == null ? null : refBases.getBasesAsChars() );
|
||||
}
|
||||
|
||||
//compute all covariate values for this read
|
||||
|
|
@ -360,9 +361,9 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
|||
if ( read.getAttribute(RecalDataManager.ORIGINAL_QUAL_ATTRIBUTE_TAG) == null ) { // Save the old qualities if the tag isn't already taken in the read
|
||||
read.setAttribute(RecalDataManager.ORIGINAL_QUAL_ATTRIBUTE_TAG, QualityUtils.phredToFastq(originalQuals));
|
||||
}
|
||||
|
||||
if (read.getAttribute(SAMTag.UQ.name()) != null) {
|
||||
// TODO - When refBases is switches to byte[], call the appropriate overload in SAM-JDK, and remove char[] overload from SAM-JDK.
|
||||
read.setAttribute(SAMTag.UQ.name(), SequenceUtil.sumQualitiesOfMismatches(read, refBases, read.getAlignmentStart() - 1));
|
||||
read.setAttribute(SAMTag.UQ.name(), SequenceUtil.sumQualitiesOfMismatches(read, refBases.getBases(), read.getAlignmentStart() - 1, false));
|
||||
}
|
||||
|
||||
return read;
|
||||
|
|
|
|||
|
|
@ -92,8 +92,6 @@ public class PickSequenomProbes extends RodWalker<String, String> {
|
|||
|
||||
logger.debug("Probing " + ref.getLocus() + " " + ref.getWindow());
|
||||
|
||||
String refBase = String.valueOf(ref.getBase());
|
||||
|
||||
Collection<VariantContext> VCs = tracker.getAllVariantContexts(ref);
|
||||
if ( VCs.size() == 0 )
|
||||
return "";
|
||||
|
|
@ -128,7 +126,7 @@ public class PickSequenomProbes extends RodWalker<String, String> {
|
|||
}
|
||||
}
|
||||
|
||||
char[] context_bases = ref.getBases();
|
||||
byte[] context_bases = ref.getBases();
|
||||
for (int i = 0; i < 401; i++) {
|
||||
if ( maskFlags[i] == 1 ) {
|
||||
context_bases[i] = 'N';
|
||||
|
|
@ -140,11 +138,11 @@ public class PickSequenomProbes extends RodWalker<String, String> {
|
|||
|
||||
String assay_sequence;
|
||||
if ( vc.isSNP() )
|
||||
assay_sequence = leading_bases + "[" + refBase + "/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
||||
assay_sequence = leading_bases + "[" + ref.getBaseAsChar() + "/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
||||
else if ( vc.isInsertion() )
|
||||
assay_sequence = leading_bases + refBase + "[-/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
||||
assay_sequence = leading_bases + ref.getBaseAsChar() + "[-/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
||||
else if ( vc.isDeletion() )
|
||||
assay_sequence = leading_bases + refBase + "[" + new String(vc.getReference().getBases()) + "/-]" + trailing_bases.substring(vc.getReference().length());
|
||||
assay_sequence = leading_bases + ref.getBaseAsChar() + "[" + new String(vc.getReference().getBases()) + "/-]" + trailing_bases.substring(vc.getReference().length());
|
||||
else
|
||||
return "";
|
||||
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
//System.out.printf("map at %s with %d skipped%n", context.getLocation(), context.getSkippedBases());
|
||||
|
||||
Map<String, VariantContext> vcs = getVariantContexts(tracker, context);
|
||||
Map<String, VariantContext> vcs = getVariantContexts(ref, tracker, context);
|
||||
//Collection<VariantContext> comps = getCompVariantContexts(tracker, context);
|
||||
|
||||
// to enable walking over pairs where eval or comps have no elements
|
||||
|
|
@ -493,7 +493,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private void writeInterestingSite(List<String> interestingReasons, VariantContext vc, char ref) {
|
||||
private void writeInterestingSite(List<String> interestingReasons, VariantContext vc, byte ref) {
|
||||
if ( vc != null && writer != null && interestingReasons.size() > 0 ) {
|
||||
// todo -- the vc == null check is because you can be interesting because you are a FN, and so VC == null
|
||||
MutableVariantContext mvc = new MutableVariantContext(vc);
|
||||
|
|
@ -576,21 +576,21 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
//
|
||||
//logger.info(String.format("Ignore second+ events at locus %s in rod %s => rec is %s", context.getLocation(), rodList.getName(), rec));
|
||||
|
||||
private Map<String, VariantContext> getVariantContexts(RefMetaDataTracker tracker, AlignmentContext context) {
|
||||
private Map<String, VariantContext> getVariantContexts(ReferenceContext ref, RefMetaDataTracker tracker, AlignmentContext context) {
|
||||
// todo -- we need to deal with dbSNP where there can be multiple records at the same start site. A potential solution is to
|
||||
// todo -- allow the variant evaluation to specify the type of variants it wants to see and only take the first such record at a site
|
||||
Map<String, VariantContext> bindings = new HashMap<String, VariantContext>();
|
||||
if ( tracker != null ) {
|
||||
bindVariantContexts(bindings, evalNames, tracker, context, false);
|
||||
bindVariantContexts(bindings, compNames, tracker, context, true);
|
||||
bindVariantContexts(ref, bindings, evalNames, tracker, context, false);
|
||||
bindVariantContexts(ref, bindings, compNames, tracker, context, true);
|
||||
}
|
||||
return bindings;
|
||||
}
|
||||
|
||||
private void bindVariantContexts(Map<String, VariantContext> map, Collection<String> names,
|
||||
private void bindVariantContexts(ReferenceContext ref, Map<String, VariantContext> map, Collection<String> names,
|
||||
RefMetaDataTracker tracker, AlignmentContext context, boolean allowExcludes ) {
|
||||
for ( String name : names ) {
|
||||
Collection<VariantContext> contexts = tracker.getVariantContexts(name, ALLOW_VARIANT_CONTEXT_TYPES, context.getLocation(), true, true);
|
||||
Collection<VariantContext> contexts = tracker.getVariantContexts(ref, name, ALLOW_VARIANT_CONTEXT_TYPES, context.getLocation(), true, true);
|
||||
if ( contexts.size() > 1 )
|
||||
throw new StingException("Found multiple variant contexts at " + context.getLocation());
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class FilterLiftedVCF extends RodWalker<Integer, Integer> {
|
|||
List<Object> rods = tracker.getReferenceMetaData("vcf");
|
||||
|
||||
for ( Object rod : rods )
|
||||
filterAndWrite(ref.getBase(), (VCFRecord)rod);
|
||||
filterAndWrite(ref.getBaseAsChar(), (VCFRecord)rod);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,14 +350,14 @@ public class MultiSampleCaller extends LocusWalker<MultiSampleCaller.MultiSample
|
|||
|
||||
context = filter_each_read(context);
|
||||
|
||||
if (ref.getBase() == 'N') { return null; }
|
||||
if (ref.getBaseAsChar() == 'N') { return null; }
|
||||
if (BaseUtils.simpleBaseToBaseIndex(ref.getBase()) == -1) { return null; }
|
||||
if (context.getReads().size() <= 0) { return null; }
|
||||
if (context.getReads().size() >= 10000) { return null; } // to deal with big piles -- totally arbitrary threshold
|
||||
|
||||
this.ref = ref.getBase();
|
||||
MultiSampleCallResult result = this.MultiSampleCall(tracker, ref.getBase(), context, sample_names);
|
||||
if ( INCLUDE_STATS ) stats_output_file.println(DepthStats.Row(ref.getBase(), context));
|
||||
this.ref = ref.getBaseAsChar();
|
||||
MultiSampleCallResult result = this.MultiSampleCall(tracker, ref.getBaseAsChar(), context, sample_names);
|
||||
if ( INCLUDE_STATS ) stats_output_file.println(DepthStats.Row(ref.getBaseAsChar(), context));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.sf.samtools.SAMRecord;
|
|||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
|
|
@ -28,7 +29,7 @@ public class AlignedReadsHistoWalker extends ReadWalker<Integer, Integer> {
|
|||
return !read.getReadUnmappedFlag();
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
//System.out.println(read.getAttribute("NM"));
|
||||
int editDist = Integer.parseInt(read.getAttribute("NM").toString());
|
||||
if (editDist <= 50)
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class AlleleBalanceHistogramWalker extends LocusWalker<Map<String,Double>
|
|||
}
|
||||
|
||||
for ( PileupElement e : alicon.getBasePileup() ) {
|
||||
if ( BaseUtils.basesAreEqual( e.getBase(), (byte) ref.getBase() ) ) {
|
||||
if ( BaseUtils.basesAreEqual( e.getBase(), ref.getBase() ) ) {
|
||||
refBases++;
|
||||
} else if ( BaseUtils.basesAreEqual(e.getBase(), (byte) snpBase ) ) {
|
||||
altBases++;
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
|||
public void updateTable(BaseTransitionTable t, SAMRecord r, int o, ReferenceContext ref) {
|
||||
// System.out.println("Update Table");
|
||||
if ( r.getReadNegativeStrandFlag() ) {
|
||||
t.update(BaseUtils.simpleComplement((char) r.getReadBases()[o]),BaseUtils.simpleComplement(ref.getBase()));
|
||||
t.update((byte)BaseUtils.simpleComplement((char) r.getReadBases()[o]), (byte)BaseUtils.simpleComplement(ref.getBaseAsChar()));
|
||||
} else {
|
||||
t.update(r.getReadBases()[o], ref.getBase());
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
|||
return String.format("%s\t%s%n",header,"Counts");
|
||||
}
|
||||
|
||||
public int countMismatches(char ref, ReadBackedPileup p) {
|
||||
public int countMismatches(byte ref, ReadBackedPileup p) {
|
||||
int refM = p.getBaseCounts()[BaseUtils.simpleBaseToBaseIndex(ref)];
|
||||
return p.size()-refM;
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ class BaseTransitionTable implements Comparable {
|
|||
out.print(s.toString());
|
||||
}
|
||||
|
||||
public void update(char observedBase, char refBase ) {
|
||||
public void update(byte observedBase, byte refBase ) {
|
||||
//if ( observedBase == refBase ) {
|
||||
// throw new StingException("BaseTransitionTable received equal observed and reference bases, which should not happen.");
|
||||
//}
|
||||
|
|
@ -485,10 +485,6 @@ class BaseTransitionTable implements Comparable {
|
|||
table[BaseUtils.simpleBaseToBaseIndex(observedBase)][BaseUtils.simpleBaseToBaseIndex(refBase)]++;
|
||||
}
|
||||
|
||||
public void update(byte observed, char ref) {
|
||||
update( (char) observed, ref);
|
||||
}
|
||||
|
||||
public int numConditions() {
|
||||
return conditions.size();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
|
|
@ -353,7 +354,7 @@ public class DSBWalkerV3 extends ReadWalker<Integer,Integer> {
|
|||
}
|
||||
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
if ( AlignmentUtils.isReadUnmapped(read) ) return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
|
@ -63,7 +64,7 @@ public class IOCrusherWalker extends ReadWalker<SAMRecord, ArrayList<SAMFileWrit
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public SAMRecord map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public SAMRecord map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
nReadsRead++;
|
||||
return read;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class IndelDBRateWalker extends RodWalker<OverlapTable,OverlapTabulator>
|
|||
tracker.getReferenceMetaData("comp").size() != 0 ? tracker.getReferenceMetaData("comp").get(0) : null;
|
||||
VariantContext compContext;
|
||||
if ( comp != null ) {
|
||||
compContext = VariantContextAdaptors.toVariantContext("comp",comp);
|
||||
compContext = VariantContextAdaptors.toVariantContext("comp",comp, ref);
|
||||
} else {
|
||||
compContext = null;
|
||||
}
|
||||
|
|
@ -142,12 +142,12 @@ public class IndelDBRateWalker extends RodWalker<OverlapTable,OverlapTabulator>
|
|||
if ( vcfWriter != null ) {
|
||||
int i = 0;
|
||||
while ( i < compContexts.size() && compContexts.get(i).getLocation().isBefore(evalContexts.get(0).getLocation())) {
|
||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(compContexts.get(i),(char)compContexts.get(i).getReference().getBases()[0]));
|
||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(compContexts.get(i),compContexts.get(i).getReference().getBases()[0]));
|
||||
i++;
|
||||
}
|
||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(evalContexts.get(0),ref.getBase()));
|
||||
while ( i < compContexts.size() && compContexts.get(i).getLocation().distance(evalContexts.get(0).getLocation()) <= indelWindow) {
|
||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(compContexts.get(i),(char) compContexts.get(i).getReference().getBases()[0]));
|
||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(compContexts.get(i),compContexts.get(i).getReference().getBases()[0]));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,25 @@ import net.sf.samtools.SAMRecord;
|
|||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@WalkerName("CountMismatches")
|
||||
public class MismatchCounterWalker extends ReadWalker<Integer, Integer> {
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
int nMismatches = 0;
|
||||
|
||||
int start = read.getAlignmentStart()-1;
|
||||
int stop = read.getAlignmentEnd();
|
||||
// sometimes BWA outputs screwy reads
|
||||
if ( stop - start > ref.length )
|
||||
if ( stop - start > ref.getBases().length )
|
||||
return 0;
|
||||
|
||||
if ( read.getAlignmentBlocks().size() == 1 ) {
|
||||
// No indels
|
||||
List<Byte> refSeq = Utils.subseq(ref);
|
||||
List<Byte> refSeq = Utils.subseq(ref.getBases());
|
||||
List<Byte> readBases = Utils.subseq(read.getReadBases());
|
||||
|
||||
assert(refSeq.size() == readBases.size());
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.sf.samtools.SAMRecord;
|
|||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -17,12 +18,12 @@ public class MismatchHistoWalker extends ReadWalker<Integer, Integer> {
|
|||
protected final int MAX_TARGET_EDIT_DISTANCE = 10;
|
||||
|
||||
// Do we actually want to operate on the context?
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
public boolean filter(ReferenceContext ref, SAMRecord read) {
|
||||
// we only want aligned reads
|
||||
return !read.getReadUnmappedFlag();
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
int editDist = Integer.parseInt(read.getAttribute("NM").toString());
|
||||
|
||||
|
|
@ -34,15 +35,15 @@ public class MismatchHistoWalker extends ReadWalker<Integer, Integer> {
|
|||
int start = read.getAlignmentStart()-1;
|
||||
int stop = read.getAlignmentEnd();
|
||||
// sometimes BWA outputs screwy reads
|
||||
if ( stop - start > ref.length )
|
||||
if ( stop - start > ref.getBases().length )
|
||||
return 0;
|
||||
|
||||
List<Byte> refSeq = Utils.subseq(ref);
|
||||
List<Byte> refSeq = Utils.subseq(ref.getBases());
|
||||
List<Byte> readBases = Utils.subseq(read.getReadBases());
|
||||
assert(refSeq.size() == readBases.size());
|
||||
|
||||
// it's actually faster to reallocate a resized array than to use ArrayLists...
|
||||
if ( ref.length > mismatchCounts.length ) {
|
||||
if ( ref.getBases().length > mismatchCounts.length ) {
|
||||
int oldLength = mismatchCounts.length;
|
||||
mismatchCounts = (long[])resizeArray(mismatchCounts, refSeq.size());
|
||||
for ( int i = oldLength; i < refSeq.size(); i++ )
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.utils.QualityUtils;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
|
|
@ -61,7 +62,7 @@ public class PairedQualityScoreCountsWalker extends ReadWalker<Pair<byte[],Boole
|
|||
return reduceCounts;
|
||||
}
|
||||
|
||||
public Pair<byte[],Boolean> map( char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Pair<byte[],Boolean> map( ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
if ( canUseRead(read) ) {
|
||||
return getCorrectlyOrientedBaseQualities(read);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.QualityUtils;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
|
|
@ -56,8 +57,8 @@ public class ReadErrorRateWalker extends ReadWalker<boolean[], ReadErrorRateColl
|
|||
* @param read the read to assess
|
||||
* @return true if the read can be processed, false if it should be ignored
|
||||
*/
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
return (read.getCigar().numCigarElements() == 1 && read.getReadLength() <= ref.length && (!useNonNextBestBase || read.getAttribute("SQ") != null));
|
||||
public boolean filter(ReferenceContext ref, SAMRecord read) {
|
||||
return (read.getCigar().numCigarElements() == 1 && read.getReadLength() <= ref.getBases().length && (!useNonNextBestBase || read.getAttribute("SQ") != null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +72,7 @@ public class ReadErrorRateWalker extends ReadWalker<boolean[], ReadErrorRateColl
|
|||
* Last element is for internal use so the reduce() function can figure out how
|
||||
* many reads we processed.
|
||||
*/
|
||||
public boolean[] map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public boolean[] map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
boolean[] errorsPerCycle = new boolean[read.getReadLength() + 1];
|
||||
|
||||
byte[] bases = read.getReadBases();
|
||||
|
|
@ -85,7 +86,7 @@ public class ReadErrorRateWalker extends ReadWalker<boolean[], ReadErrorRateColl
|
|||
System.out.println();
|
||||
|
||||
for (int cycle = 0; cycle < bases.length; cycle++) {
|
||||
byte compBase = convertIUPACBaseToSimpleBase((byte)ref[cycle]);
|
||||
byte compBase = convertIUPACBaseToSimpleBase(ref.getBases()[cycle]);
|
||||
|
||||
System.out.print((char) compBase);
|
||||
}
|
||||
|
|
@ -93,7 +94,7 @@ public class ReadErrorRateWalker extends ReadWalker<boolean[], ReadErrorRateColl
|
|||
}
|
||||
|
||||
for (int cycle = 0; cycle < bases.length; cycle++) {
|
||||
byte compBase = convertIUPACBaseToSimpleBase((byte)ref[cycle]);
|
||||
byte compBase = convertIUPACBaseToSimpleBase(ref.getBases()[cycle]);
|
||||
|
||||
if (compBase != '.') {
|
||||
if (useNextBestBase || useNextRandomBase || useNonNextBestBase) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
|
|
@ -70,7 +71,7 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
|||
protected static BufferedReader inputReader = null;
|
||||
protected static String line = null;
|
||||
|
||||
public SAMRecord map( char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
public SAMRecord map( ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker ) {
|
||||
return read; // all the work is done in the reduce step for this walker
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import net.sf.samtools.*;
|
||||
|
|
@ -90,7 +91,7 @@ public class ReplaceQuals extends ReadWalker<SAMRecord, SAMFileWriter> {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public SAMRecord map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public SAMRecord map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
final String name = read.getReadName();
|
||||
|
||||
if ( readNameToPairs.containsKey(name) ) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.alignment.bwa.BWAAligner;
|
||||
import org.broadinstitute.sting.alignment.bwa.BWAConfiguration;
|
||||
import org.broadinstitute.sting.alignment.bwa.c.BWACAligner;
|
||||
|
|
@ -130,7 +131,7 @@ public class TestReadFishingWalker extends ReadWalker<Integer,Long> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
Alignment bestAlignment = aligner.getBestAlignment(read.getReadBases());
|
||||
System.out.println("bestAlignment = " + bestAlignment);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class VCFReferenceFixerWalker extends RodWalker<VCFRecord,Long> {
|
|||
vcfrod = (VCFRecord) rod;
|
||||
}
|
||||
|
||||
if (vcfrod != null) vcfrod.setReferenceBase(new String(BaseUtils.charSeq2byteSeq(context.getBases())));
|
||||
if (vcfrod != null) vcfrod.setReferenceBase(new String(context.getBases()));
|
||||
return vcfrod;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class ProportionOfNonrefBasesSupportingSNP implements InfoFieldAnnotation
|
|||
Pair<Integer,Integer> totalNonref_totalSNP = new Pair<Integer,Integer>(0,0);
|
||||
for ( String sample : context.keySet() ) {
|
||||
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
|
||||
totalNonref_totalSNP = getNonrefAndSNP(pileup, ref.getBase(), vc.getAlternateAllele(0).toString().charAt(0), totalNonref_totalSNP);
|
||||
totalNonref_totalSNP = getNonrefAndSNP(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalNonref_totalSNP);
|
||||
|
||||
}
|
||||
if ( totalNonref_totalSNP.equals(new Pair<Integer,Integer>(0,0)) )
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class ProportionOfRefSecondBasesSupportingSNP implements InfoFieldAnnotat
|
|||
Pair<Integer,Integer> totalAndSNPSupporting = new Pair<Integer,Integer>(0,0);
|
||||
for ( String sample : context.keySet() ) {
|
||||
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
|
||||
totalAndSNPSupporting = getTotalRefAndSNPSupportCounts(pileup, ref.getBase(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting);
|
||||
totalAndSNPSupporting = getTotalRefAndSNPSupportCounts(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting);
|
||||
|
||||
}
|
||||
if ( totalAndSNPSupporting.equals(new Pair<Integer,Integer>(0,0)) )
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class ProportionOfSNPSecondBasesSupportingRef implements InfoFieldAnnotat
|
|||
Pair<Integer,Integer> totalAndSNPSupporting = new Pair<Integer,Integer>(0,0);
|
||||
for ( String sample : context.keySet() ) {
|
||||
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
|
||||
totalAndSNPSupporting = getTotalSNPandRefSupporting(pileup, ref.getBase(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting);
|
||||
totalAndSNPSupporting = getTotalSNPandRefSupporting(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting);
|
||||
|
||||
}
|
||||
if ( totalAndSNPSupporting.equals(new Pair<Integer,Integer>(0,0)) )
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class LocusConcordanceInfo {
|
|||
}
|
||||
|
||||
public byte getReferenceBase() {
|
||||
return (byte) reference.getBase();
|
||||
return reference.getBase();
|
||||
}
|
||||
|
||||
public boolean isTruthOnly () {
|
||||
|
|
@ -63,7 +63,7 @@ class LocusConcordanceInfo {
|
|||
|
||||
public boolean isVariantSite() {
|
||||
for ( VCFGenotypeRecord g : truthVCFRecord.getVCFGenotypeRecords() ) {
|
||||
if ( g.isVariant(reference.getBase()) ) {
|
||||
if ( g.isVariant(reference.getBaseAsChar()) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class BeagleTrioToVCFWalker extends RodWalker<VariantContext, Long> {
|
|||
VariantContext vc = null;
|
||||
|
||||
if ( ref != null ) {
|
||||
vc = tracker.getVariantContext(TRACK_NAME, null, context.getLocation(), false);
|
||||
vc = tracker.getVariantContext(ref, TRACK_NAME, null, context.getLocation(), false);
|
||||
BeagleROD beagle = tracker.lookup(BEAGLE_NAME,BeagleROD.class);
|
||||
|
||||
if ( vc != null ) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class VCFToBeagleWalker extends RodWalker<Integer, VCFToBeagleWalker.Resu
|
|||
if ( ref != null ) {
|
||||
EnumSet<VariantContext.Type> allowedTypes = EnumSet.of(VariantContext.Type.SNP);
|
||||
|
||||
VariantContext vc = tracker.getVariantContext("variants", allowedTypes, context.getLocation(), false);
|
||||
VariantContext vc = tracker.getVariantContext(ref, "variants", allowedTypes, context.getLocation(), false);
|
||||
|
||||
if ( vc != null && vc.isBiallelic() && vc.isNotFiltered() ) {
|
||||
if ( trio != null ) { // we are emitting a trio file
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -106,7 +107,7 @@ public class CalculateAlleleLikelihoodsWalker extends ReadWalker<Integer, Intege
|
|||
return 0;
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
HLAnamesAL.add(read.getReadName());
|
||||
HLAreadsAL.add(formatter.FormatRead(read.getCigarString(), read.getReadString()));
|
||||
HLAstartposAL.add(read.getAlignmentStart());
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import net.sf.samtools.SAMRecord;
|
|||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -180,7 +181,7 @@ public class CalculatePhaseLikelihoodsWalker extends ReadWalker<Integer, Integer
|
|||
return isWithinInterval;
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
if (!ReadsToDiscard.contains(read.getReadName())){
|
||||
UpdateCorrelation(read);
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ public class CallHLAWalker extends LocusWalker<Integer, Pair<Long, Long>>{
|
|||
}
|
||||
|
||||
//Get likelihood score for homozygous ref: used to normalize likelihoood scores at 0.
|
||||
String homref = String.valueOf(ref.getBase())+String.valueOf(ref.getBase());
|
||||
String homref = String.valueOf(ref.getBaseAsChar())+String.valueOf(ref.getBaseAsChar());
|
||||
Double homreflikelihood = Double.parseDouble((String) Scores.get(homref).toString());
|
||||
|
||||
//Add SNP if it is a SNP and hasn't been added before
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -89,7 +90,7 @@ public class ClusterReadsWalker extends ReadWalker<Integer, Integer> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker tracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker tracker) {
|
||||
//Calculate concordance for this read and all overlapping reads
|
||||
if (!ReadsToDiscard.contains(read.getReadName())){
|
||||
AlignedReads.add(read);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
import java.util.Hashtable;
|
||||
/**
|
||||
* Creates a haplotype file given reads (for SNP analysis, imputation, etc)
|
||||
|
|
@ -37,7 +39,7 @@ public class CreateHaplotypesWalker extends ReadWalker<Integer, Integer> {
|
|||
|
||||
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
int readstart = read.getAlignmentStart();
|
||||
int readstop = read.getAlignmentEnd();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -209,7 +210,7 @@ public class CreatePedFileWalker extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
HLAnamesAL.add(read.getReadName());
|
||||
HLAreadsAL.add(formatter.FormatRead(read.getCigarString(), read.getReadString()));
|
||||
HLAstartposAL.add(read.getAlignmentStart());
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -227,7 +228,7 @@ public class FindClosestAlleleWalker extends ReadWalker<Integer, Integer> {
|
|||
return maxFreq;
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
//Calculate concordance for this read and all overlapping reads
|
||||
if (read.getMappingQuality() > 0){
|
||||
double maxConcordance = CalculateConcordance(read);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -139,7 +140,7 @@ public class FindPolymorphicSitesWalker extends ReadWalker<Integer, Integer> {
|
|||
NonPolymorphicSites = nonpolymorphicsites.toArray(new Integer[nonpolymorphicsites.size()]);
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
//Calculate concordance for this read and all overlapping reads
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
|
|||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -161,7 +162,7 @@ public class ImputeAllelesWalker extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
int readstart = read.getAlignmentStart();
|
||||
int readstop = read.getAlignmentEnd();
|
||||
int startimputation = 0, stopimputation = 0;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class LocusMismatchWalker extends LocusWalker<String,Integer> implements
|
|||
//System.out.printf("Using %s%n", e.getRead().getReadName());
|
||||
baseCounts[e.getBaseIndex()] += 1;
|
||||
usableDepth++;
|
||||
if ( ! BaseUtils.basesAreEqual(e.getBase(), (byte)ref.getBase()) ) {
|
||||
if ( ! BaseUtils.basesAreEqual(e.getBase(), ref.getBase()) ) {
|
||||
nMismatches++;
|
||||
qSumMismatches += e.getQual();
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ public class LocusMismatchWalker extends LocusWalker<String,Integer> implements
|
|||
baseCountString += baseCounts[BaseUtils.simpleBaseToBaseIndex(b)] + " ";
|
||||
}
|
||||
return String.format("%s %c %10s %5.2f %d %d %d %s",
|
||||
pileup.getLocation(), ref.getBase(),
|
||||
pileup.getLocation(), ref.getBaseAsChar(),
|
||||
getGenotypeClass(g), 10 * g.getNegLog10PError(),
|
||||
usableDepth, nMismatches, qSumMismatches, baseCountString);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class TrioGenotyperWalker extends RefWalker<VariantContext, Integer>{
|
|||
}
|
||||
|
||||
public VariantContext map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
VariantContext vc = tracker.getVariantContext("variants", EnumSet.of(VariantContext.Type.SNP), context.getLocation(), true);
|
||||
VariantContext vc = tracker.getVariantContext(ref, "variants", EnumSet.of(VariantContext.Type.SNP), context.getLocation(), true);
|
||||
|
||||
if ( vc != null && vc.isPolymorphic() ) {
|
||||
if ( ! vc.hasGenotypes(FAMILY_MEMBERS) )
|
||||
|
|
@ -179,7 +179,7 @@ public class TrioGenotyperWalker extends RefWalker<VariantContext, Integer>{
|
|||
if ( a == 0 )
|
||||
writer.writeHeader(VariantContextAdaptors.createVCFHeader(null, vc));
|
||||
|
||||
writer.addRecord(VariantContextAdaptors.toVCF(vc, '.'));
|
||||
writer.addRecord(VariantContextAdaptors.toVCF(vc, (byte)'.'));
|
||||
a++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ public class VCFConcordance extends RodWalker<Integer, Integer> {
|
|||
VariantContext eval = null;
|
||||
VariantContext truth = null;
|
||||
try {
|
||||
eval = tracker.getVariantContext("eval", vc, loc, true);
|
||||
truth = tracker.getVariantContext("truth", vc, loc, true);
|
||||
eval = tracker.getVariantContext(ref, "eval", vc, loc, true);
|
||||
truth = tracker.getVariantContext(ref, "truth", vc, loc, true);
|
||||
} catch (java.util.NoSuchElementException e) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,11 +205,11 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> {
|
|||
return 0;
|
||||
|
||||
Object variant = rods.get(0);
|
||||
if( ref.getBase() == 'N') {
|
||||
if( BaseUtils.isNBase(ref.getBase()) ) {
|
||||
return 0; //TODO Currently, VariantContextAdaptors.toVCF(annotatedVC, ref.getBase()) fails when base is 'N'. is this right?
|
||||
}
|
||||
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("variant", variant);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("variant", variant, ref);
|
||||
if ( vc == null )
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ public class TranscriptToInfo extends RodWalker<TreeMap<String, String>, TreeMap
|
|||
if(parsedTranscriptRod.positiveStrand) {
|
||||
parsedTranscriptRod.txSequence.append(ref.getBase());
|
||||
} else {
|
||||
final char complementBase = BaseUtils.simpleComplement(ref.getBase());
|
||||
final char complementBase = BaseUtils.simpleComplement(ref.getBaseAsChar());
|
||||
parsedTranscriptRod.txSequence.insert(0, complementBase);
|
||||
}
|
||||
|
||||
|
|
@ -275,16 +275,16 @@ public class TranscriptToInfo extends RodWalker<TreeMap<String, String>, TreeMap
|
|||
{
|
||||
if(position < parsedTranscriptRod.cdsStart)
|
||||
{
|
||||
parsedTranscriptRod.utr5Sequence.append(ref.getBase()); //within utr5
|
||||
parsedTranscriptRod.utr5Sequence.append(ref.getBaseAsChar()); //within utr5
|
||||
}
|
||||
else if(position >= parsedTranscriptRod.cdsStart && position <= parsedTranscriptRod.cdsEnd)
|
||||
{
|
||||
parsedTranscriptRod.cdsSequence.append(ref.getBase()); //within CDS
|
||||
parsedTranscriptRod.cdsSequence.append(ref.getBaseAsChar()); //within CDS
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final char complementBase = BaseUtils.simpleComplement(ref.getBase());
|
||||
final char complementBase = BaseUtils.simpleComplement(ref.getBaseAsChar());
|
||||
if(position > parsedTranscriptRod.cdsEnd)
|
||||
{
|
||||
//As we move left to right (aka. 3' to 5'), we do insert(0,..) to reverse the sequence so that it become 5' to 3' in parsedTranscriptRod.utr5Sequence.
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class ComputeConfusionMatrix extends LocusWalker<Integer, Integer> {
|
|||
int windowCenter = (windowLength - 1)/2;
|
||||
|
||||
String fwRefBases = new String(ref.getBases());
|
||||
String fwRefBase = String.format("%c", ref.getBase());
|
||||
String fwRefBase = String.format("%c", ref.getBaseAsChar());
|
||||
String fwWindowLeft = fwRefBases.substring(windowCenter - WINDOW_SIZE, windowCenter);
|
||||
|
||||
//String rcRefBases = new String(BaseUtils.simpleReverseComplement(ref.getBases()));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.diagnostics;
|
|||
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
|
@ -31,11 +32,11 @@ public class MatePairLibrarySize extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean filter(char[] ref, SAMRecord read) {
|
||||
public boolean filter(ReferenceContext ref, SAMRecord read) {
|
||||
return (read.getReadPairedFlag() && read.getFirstOfPairFlag());
|
||||
}
|
||||
|
||||
public Integer map(char[] ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
int insert = read.getInferredInsertSize();
|
||||
|
||||
Integer oldcount = matePairSize.get(read.getReadGroup().getLibrary()).get(insert);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class SNPDensity extends RefWalker<Pair<VariantContext, GenomeLoc>, SNPDe
|
|||
|
||||
VCFRecord vcf = tracker.lookup("eval",VCFRecord.class);
|
||||
if (vcf != null)
|
||||
vc = VariantContextAdaptors.toVariantContext("eval", vcf);
|
||||
vc = VariantContextAdaptors.toVariantContext("eval", vcf, ref);
|
||||
return new Pair<VariantContext, GenomeLoc>(vc, context.getLocation());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.graphalign;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.*;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
||||
|
|
@ -176,7 +177,7 @@ public class GraphReferenceAssessor extends ReadWalker<Integer, Integer> {
|
|||
return minNMM;
|
||||
}
|
||||
|
||||
public Integer map(char[] refArg, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
public Integer map(ReferenceContext refArg, SAMRecord read, ReadMetaDataTracker metaDataTracker) {
|
||||
|
||||
if ( MAXREADS-- == 0 ) {
|
||||
System.exit(0);
|
||||
|
|
@ -184,7 +185,7 @@ public class GraphReferenceAssessor extends ReadWalker<Integer, Integer> {
|
|||
;
|
||||
} else if ( ! read.getReadUnmappedFlag() && read.getCigar().numCigarElements() == 1 ) {
|
||||
try {
|
||||
byte[] ref = BaseUtils.charSeq2byteSeq(refArg);
|
||||
byte[] ref = refArg.getBases();
|
||||
// we're all XM
|
||||
int nMMFromRead = (Short)read.getAttribute("NM");
|
||||
MismatchCounter nAlignedMM = countMismatches(ref, read.getReadBases(), read.getBaseQualities());
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class GATKPaperGenotyper extends LocusWalker<SimpleCall, Integer> impleme
|
|||
if (ref.getBase() == 'N' || ref.getBase() == 'n') return null; // we don't deal with the N ref base case
|
||||
|
||||
ReadBackedPileup pileup = context.getPileup();
|
||||
double likelihoods[] = DiploidGenotypePriors.getReferencePolarizedPriors(ref.getBase(),
|
||||
double likelihoods[] = DiploidGenotypePriors.getReferencePolarizedPriors(ref.getBaseAsChar(),
|
||||
DiploidGenotypePriors.HUMAN_HETEROZYGOSITY,
|
||||
0.01);
|
||||
// get the bases and qualities from the pileup
|
||||
|
|
@ -97,7 +97,7 @@ public class GATKPaperGenotyper extends LocusWalker<SimpleCall, Integer> impleme
|
|||
return new SimpleCall(context.getLocation(),
|
||||
GENOTYPE.values()[sortedList[9]].toString(),
|
||||
likelihoods[sortedList[9]] - likelihoods[sortedList[8]],
|
||||
ref.getBase());
|
||||
ref.getBaseAsChar());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ public class SecondaryBaseTransitionTableWalker extends LocusWalker<Integer, Int
|
|||
}
|
||||
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
char refBase = Character.toUpperCase(ref.getBase());
|
||||
char refBase = Character.toUpperCase(ref.getBaseAsChar());
|
||||
ReadBackedPileup pileup = context.getBasePileup();
|
||||
int[] baseCounts = pileup.getBaseCounts();
|
||||
int length = 0;
|
||||
for (int i : baseCounts) {length += i;}
|
||||
char[] contextBases = ref.getBases();
|
||||
char prevBase = Character.toUpperCase(contextBases[0]);
|
||||
char nextBase = Character.toUpperCase(contextBases[contextBases.length - 1]);
|
||||
byte[] contextBases = ref.getBases();
|
||||
byte prevBase = (byte)Character.toUpperCase(contextBases[0]);
|
||||
byte nextBase = (byte)Character.toUpperCase(contextBases[contextBases.length - 1]);
|
||||
|
||||
if (contextBases.length == 3 && refBase != 'N' && pileup.getBases() != null && pileup.getSecondaryBases() != null) {
|
||||
VariantCallContext ugResult = ug.runGenotyper(tracker,ref,context);
|
||||
|
|
@ -83,14 +83,14 @@ public class SecondaryBaseTransitionTableWalker extends LocusWalker<Integer, Int
|
|||
if (!element.getRead().getReadNegativeStrandFlag()) {
|
||||
strandRef = Character.toString(refBase);
|
||||
strandPrimary = Character.toString(primaryBase);
|
||||
strandPrev = Character.toString(prevBase);
|
||||
strandPrev = Character.toString((char)prevBase);
|
||||
strandSecondary = Character.toString(secondaryBase);
|
||||
strandCall = call;
|
||||
}
|
||||
else {
|
||||
strandRef = Character.toString(BaseUtils.simpleComplement(refBase));
|
||||
strandPrimary = Character.toString(BaseUtils.simpleComplement(primaryBase));
|
||||
strandPrev = Character.toString(BaseUtils.simpleComplement(nextBase));
|
||||
strandPrev = Character.toString(BaseUtils.simpleComplement((char)nextBase));
|
||||
strandSecondary = Character.toString(BaseUtils.simpleComplement(secondaryBase));
|
||||
strandCall = BaseUtils.simpleReverseComplement(call);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class AnnotationDataManager {
|
|||
INDICATE_MEAN_NUM_VARS = _INDICATE_MEAN_NUM_VARS;
|
||||
}
|
||||
|
||||
public void addAnnotations( final VariantContext vc, final char ref, final String sampleName, final boolean isInTruthSet, final boolean isTrueVariant ) {
|
||||
public void addAnnotations( final VariantContext vc, final byte ref, final String sampleName, final boolean isInTruthSet, final boolean isTrueVariant ) {
|
||||
|
||||
if( sampleName != null ) { // Only process variants that are found in the sample with this sampleName
|
||||
if( vc.getGenotype(sampleName).isNoCall() ) { // This variant isn't found in this sample so break out
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public class ApplyVariantClustersWalker extends RodWalker<ExpandingArrayList<Var
|
|||
boolean isKnown = !vc.getAttribute("ID").equals(".");
|
||||
if(usingDBSNP) {
|
||||
isKnown = false;
|
||||
for( VariantContext dbsnpVC : tracker.getVariantContexts(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME, null, context.getLocation(), false, false) ) {
|
||||
for( VariantContext dbsnpVC : tracker.getVariantContexts(ref, DbSNPHelper.STANDARD_DBSNP_TRACK_NAME, null, context.getLocation(), false, false) ) {
|
||||
if(dbsnpVC != null && dbsnpVC.isSNP()) {
|
||||
isKnown=true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public class VariantOptimizer extends RodWalker<ExpandingArrayList<VariantDatum>
|
|||
boolean isKnown = !vc.getAttribute("ID").equals(".");
|
||||
if(usingDBSNP) {
|
||||
isKnown = false;
|
||||
for( final VariantContext dbsnpVC : tracker.getVariantContexts(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME, null, context.getLocation(), false, false) ) {
|
||||
for( final VariantContext dbsnpVC : tracker.getVariantContexts(ref, DbSNPHelper.STANDARD_DBSNP_TRACK_NAME, null, context.getLocation(), false, false) ) {
|
||||
if(dbsnpVC != null && dbsnpVC.isSNP()) {
|
||||
isKnown = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class VCFGenotypeWriterAdapter implements VCFGenotypeWriter {
|
|||
if ( mHeader == null )
|
||||
throw new IllegalStateException("The VCF Header must be written before records can be added");
|
||||
|
||||
VCFRecord call = VariantContextAdaptors.toVCF(vc, refAllele.charAt(0), allowedGenotypeFormatStrings, false, false);
|
||||
VCFRecord call = VariantContextAdaptors.toVCF(vc, (byte)refAllele.charAt(0), allowedGenotypeFormatStrings, false, false);
|
||||
|
||||
Set<Allele> altAlleles = vc.getAlternateAlleles();
|
||||
StringBuffer altAlleleCountString = new StringBuffer();
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public class ReadBackedExtendedEventPileup implements Iterable<ExtendedEventPile
|
|||
* @return list of distinct events; first element of a pair is a string representation of the event, second element
|
||||
* gives the number of reads, in which that event was observed
|
||||
*/
|
||||
public List<Pair<String,Integer>> getEventStringsWithCounts(char[] refBases) {
|
||||
public List<Pair<String,Integer>> getEventStringsWithCounts(byte[] refBases) {
|
||||
Map<String, Integer> events = new HashMap<String,Integer>();
|
||||
|
||||
for ( ExtendedEventPileupElement e : this ) {
|
||||
|
|
@ -385,7 +385,7 @@ public class ReadBackedExtendedEventPileup implements Iterable<ExtendedEventPile
|
|||
* @param refBases
|
||||
* @return
|
||||
*/
|
||||
private String getDeletionString(int length, char[] refBases) {
|
||||
private String getDeletionString(int length, byte[] refBases) {
|
||||
if ( refBases == null ) {
|
||||
return Integer.toString(length)+"D"; // if we do not have reference bases, we can only report something like "5D"
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class AlignmentUtils {
|
|||
|
||||
int windowStart = (int)ref.getWindow().getStart();
|
||||
int windowStop = (int)ref.getWindow().getStop();
|
||||
char[] refBases = ref.getBases();
|
||||
byte[] refBases = ref.getBases();
|
||||
byte[] readBases = p.getRead().getReadBases();
|
||||
byte[] readQualities = p.getRead().getBaseQualities();
|
||||
Cigar c = p.getRead().getCigar();
|
||||
|
|
@ -179,7 +179,7 @@ public class AlignmentUtils {
|
|||
if ( currentPos < windowStart )
|
||||
continue;
|
||||
|
||||
char refChr = refBases[refIndex++];
|
||||
byte refChr = refBases[refIndex++];
|
||||
|
||||
// do we need to skip the target site?
|
||||
if ( ignoreTargetSite && ref.getLocus().getStart() == currentPos )
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import org.broadinstitute.sting.gatk.walkers.Walker;
|
|||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
|
@ -102,14 +103,14 @@ public class ArtificialReadsTraversal<M,T> extends TraversalEngine<M,T,Walker<M,
|
|||
AlignmentContext alignment = null;
|
||||
|
||||
// an array of characters that represent the reference
|
||||
char[] refSeq = null;
|
||||
ReferenceContext refSeq = null;
|
||||
|
||||
// update the number of reads we've seen
|
||||
TraversalStatistics.nRecords++;
|
||||
|
||||
final boolean keepMeP = readWalker.filter(refSeq, read);
|
||||
if (keepMeP) {
|
||||
M x = readWalker.map(refSeq, read,null); // TODO: fix me at some point, it would be nice to fake out ROD data too
|
||||
M x = readWalker.map(refSeq, read, null); // TODO: fix me at some point, it would be nice to fake out ROD data too
|
||||
sum = readWalker.reduce(x, sum);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ public class LocusReferenceViewUnitTest extends ReferenceViewTemplate {
|
|||
LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, null, shard.getGenomeLocs().get(0), null, sequenceFile, null);
|
||||
LocusReferenceView view = new LocusReferenceView(dataProvider);
|
||||
|
||||
char[] results = view.getReferenceBases(GenomeLocParser.createGenomeLoc(0, sequenceFile.getSequence("chrM").length() - 10, sequenceFile.getSequence("chrM").length() + 9));
|
||||
byte[] results = view.getReferenceBases(GenomeLocParser.createGenomeLoc(0, sequenceFile.getSequence("chrM").length() - 10, sequenceFile.getSequence("chrM").length() + 9));
|
||||
System.out.printf("results are %s%n", new String(results));
|
||||
Assert.assertEquals(20, results.length);
|
||||
for (int x = 0; x < results.length; x++) {
|
||||
if (x <= 10) Assert.assertTrue(results[x] != 'X');
|
||||
|
|
@ -104,7 +105,7 @@ public class LocusReferenceViewUnitTest extends ReferenceViewTemplate {
|
|||
|
||||
ReferenceSequence expectedAsSeq = sequenceFile.getSubsequenceAt(locus.getContig(), locus.getStart(), locus.getStop());
|
||||
char expected = StringUtil.bytesToString(expectedAsSeq.getBases()).charAt(0);
|
||||
char actual = view.getReferenceContext(locus).getBase();
|
||||
char actual = view.getReferenceContext(locus).getBaseAsChar();
|
||||
|
||||
Assert.assertEquals(String.format("Value of base at position %s in shard %s does not match expected", locus.toString(), shard.getGenomeLocs()),
|
||||
expected,
|
||||
|
|
|
|||
|
|
@ -75,8 +75,9 @@ public class ReadReferenceViewUnitTest extends ReferenceViewTemplate {
|
|||
|
||||
SAMRecord rec = buildSAMRecord(selectedContig.getSequenceName(),(int)contigStart,(int)contigStop);
|
||||
ReferenceSequence expectedAsSeq = sequenceFile.getSubsequenceAt(selectedContig.getSequenceName(),(int)contigStart,selectedContig.getSequenceLength());
|
||||
char[] expected = StringUtil.bytesToString(expectedAsSeq.getBases()).toCharArray();
|
||||
char[] actual = view.getReferenceBases(rec);
|
||||
//char[] expected = StringUtil.bytesToString(expectedAsSeq.getBases()).toCharArray();
|
||||
byte[] expected = expectedAsSeq.getBases();
|
||||
byte[] actual = view.getReferenceBases(rec);
|
||||
|
||||
Assert.assertEquals(expected.length, (readLength - overlap));
|
||||
Assert.assertEquals(actual.length, readLength);
|
||||
|
|
@ -101,8 +102,8 @@ public class ReadReferenceViewUnitTest extends ReferenceViewTemplate {
|
|||
ReadReferenceView view = new ReadReferenceView(dataProvider);
|
||||
|
||||
ReferenceSequence expectedAsSeq = sequenceFile.getSubsequenceAt(loc.getContig(),loc.getStart(),loc.getStop());
|
||||
char[] expected = StringUtil.bytesToString(expectedAsSeq.getBases()).toCharArray();
|
||||
char[] actual = view.getReferenceBases(read);
|
||||
byte[] expected = expectedAsSeq.getBases();
|
||||
byte[] actual = view.getReferenceBases(read);
|
||||
|
||||
Assert.assertArrayEquals(String.format("Base array at in shard %s does not match expected",loc.toString()),
|
||||
expected,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class VariantContextAdaptorsUnitTest extends BaseTest {
|
|||
while (glf.hasNext()) {
|
||||
glf.next();
|
||||
records.add((GLFSingleCall)glf.mRecord); // we know they're all single calls in the reference file
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("GLF",glf);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("GLF",glf, null);
|
||||
gw.addCall(vc,null);
|
||||
}
|
||||
gw.close(); // close the file
|
||||
|
|
@ -148,7 +148,7 @@ public class VariantContextAdaptorsUnitTest extends BaseTest {
|
|||
while (line != null && line != "") {
|
||||
geliText = (GeliTextFeature)codec.decode(line);
|
||||
records.add(geliText); // we know they're all single calls in the reference file
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("Geli",geliText);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("Geli",geliText, null);
|
||||
if (vc != null) gw.addCall(vc,null);
|
||||
line = readLine(reader);
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ public class VariantContextAdaptorsUnitTest extends BaseTest {
|
|||
while (iterator.hasNext()) {
|
||||
rodGELI gel = new rodGELI("myROD",iterator.next());
|
||||
records.add(gel);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("myROD",gel);
|
||||
VariantContext vc = VariantContextAdaptors.toVariantContext("myROD",gel, null);
|
||||
if (vc != null) gw.addCall(vc,null);
|
||||
}
|
||||
iterator.close();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
|||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
|
||||
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialReadsTraversal;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialSAMFileWriter;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
|
||||
|
|
@ -54,7 +55,9 @@ public class PrintReadsWalkerUnitTest extends BaseTest {
|
|||
*/
|
||||
private ArtificialReadsTraversal trav;
|
||||
private int readTotal = 0;
|
||||
private char bases[] = {'a', 't'};
|
||||
//private char bases[] = {'a', 't'};
|
||||
private ReferenceContext bases = null;
|
||||
//private ReferenceContext ref = new ReferenceContext()
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue