diff --git a/java/src/org/broadinstitute/sting/playground/utils/PoolUtils.java b/java/src/org/broadinstitute/sting/playground/utils/PoolUtils.java index baa8a2fb1..288c52ebc 100755 --- a/java/src/org/broadinstitute/sting/playground/utils/PoolUtils.java +++ b/java/src/org/broadinstitute/sting/playground/utils/PoolUtils.java @@ -120,6 +120,30 @@ public class PoolUtils { return new Pair,List>(threshReads, threshOffsets); } + public static Pair,List> thresholdReadsByMappingQuality( List reads, List offsets, int mapQual ) { + List goodMapReads; + List goodMapOffsets; + if ( reads == null ) { + goodMapReads = null; + goodMapOffsets = null; + } else if ( mapQual < 0 ) { + goodMapReads = reads; + goodMapOffsets = offsets; + } else { + goodMapReads = new ArrayList(); + goodMapOffsets = new ArrayList(); + + for ( int readNo = 0; readNo < reads.size(); readNo ++ ) { + if ( reads.get(readNo).getMappingQuality() > mapQual ) { + goodMapReads.add(reads.get(readNo)); + goodMapOffsets.add(offsets.get(readNo)); + } + } + } + + return new Pair,List>(goodMapReads,goodMapOffsets); + } + public static Pair,List> thresholdReadsByQuality(Pair,List> readPair, byte qThresh) { return thresholdReadsByQuality(readPair.getFirst(),readPair.getSecond(),qThresh); }