IndelCounterWalker -- a new little walker that counts indels over a region (want to see what kind of havoc BWA may be resulting in). Don't know when BasicPileup.indelPileup() was written, but kudos to whoever wrote it.
BTTJ - remove 'N's from previous base analysis -- even if both read and ref are 'N' (which does happen, occasionally) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1925 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
04e9a494e9
commit
863d3023d5
|
|
@ -246,7 +246,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
|||
}
|
||||
|
||||
for ( int prevBase = 1; prevBase <= nPreviousBases; prevBase ++ ) {
|
||||
if ( Character.toUpperCase(read.getReadBases()[offset + prevBase*c]) != Character.toUpperCase(ref.getBases()[nPreviousBases+1+prevBase*c]) ) {
|
||||
if ( Character.toUpperCase(read.getReadBases()[offset + prevBase*c]) != Character.toUpperCase(ref.getBases()[nPreviousBases+1+prevBase*c]) || ! BaseUtils.isRegularBase(ref.getBases()[nPreviousBases+1+prevBase*c])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package org.broadinstitute.sting.playground.gatk.walkers;
|
||||
|
||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.utils.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.BasicPileup;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: chartl
|
||||
* Date: Oct 28, 2009
|
||||
* Time: 3:19:48 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class IndelCounterWalker extends LocusWalker<Integer,Integer> {
|
||||
|
||||
public Integer reduceInit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Integer reduce( Integer prevReduce, Integer map ) {
|
||||
return map + prevReduce;
|
||||
}
|
||||
|
||||
public Integer treeReduce( Integer reduce1, Integer reduce2 ) {
|
||||
return reduce(reduce1,reduce2);
|
||||
}
|
||||
|
||||
public Integer map ( RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context ) {
|
||||
if (BaseUtils.isRegularBase(ref.getBase()) ) {
|
||||
return numIndels(context);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer numIndels ( AlignmentContext context ) {
|
||||
String[] indelPileup = BasicPileup.indelPileup(context.getReads(),context.getOffsets());
|
||||
// number of indels is the number of non-"null" indeces
|
||||
int nIndel = 0;
|
||||
for( String indel : indelPileup ) {
|
||||
if ( ! indel.equals("null") ) { // currently how non-indel bases are represented in pileup
|
||||
nIndel ++;
|
||||
}
|
||||
}
|
||||
|
||||
return nIndel;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue