From ec68ae3bc5a0b3a1fd753675fa0fd3b6eb30d297 Mon Sep 17 00:00:00 2001 From: chartl Date: Mon, 12 Oct 2009 20:58:37 +0000 Subject: [PATCH] Added a filter that will split the read set by a threshold of mapping quality (Request from Jason Flannick) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1812 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/playground/utils/PoolUtils.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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); }