Avoid calling getBasePileup when there's no pileup in NBaseCount annotation
This commit is contained in:
parent
729bb954e2
commit
5f7ccdcc01
|
|
@ -27,8 +27,9 @@ public class NBaseCount extends InfoFieldAnnotation {
|
|||
int countNBaseSolid = 0;
|
||||
int countRegularBaseSolid = 0;
|
||||
|
||||
for( final Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) {
|
||||
for( final PileupElement p : sample.getValue().getBasePileup()) {
|
||||
for( final AlignmentContext context : stratifiedContexts.values() ) {
|
||||
if ( context.hasBasePileup() ) { // must be called as getBasePileup may throw error when pileup has no bases
|
||||
for( final PileupElement p : context.getBasePileup()) {
|
||||
if( p.getRead().getReadGroup().getPlatform().toUpperCase().contains("SOLID") ) {
|
||||
if( BaseUtils.isNBase( p.getBase() ) ) {
|
||||
countNBaseSolid++;
|
||||
|
|
@ -38,6 +39,7 @@ public class NBaseCount extends InfoFieldAnnotation {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyNames().get(0), String.format("%.4f", (double)countNBaseSolid / (double)(countNBaseSolid + countRegularBaseSolid + 1)));
|
||||
return map;
|
||||
|
|
|
|||
Loading…
Reference in New Issue