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
This commit is contained in:
chartl 2009-10-12 20:58:37 +00:00
parent 0d73fe69e7
commit ec68ae3bc5
1 changed files with 24 additions and 0 deletions

View File

@ -120,6 +120,30 @@ public class PoolUtils {
return new Pair<List<SAMRecord>,List<Integer>>(threshReads, threshOffsets);
}
public static Pair<List<SAMRecord>,List<Integer>> thresholdReadsByMappingQuality( List<SAMRecord> reads, List<Integer> offsets, int mapQual ) {
List<SAMRecord> goodMapReads;
List<Integer> goodMapOffsets;
if ( reads == null ) {
goodMapReads = null;
goodMapOffsets = null;
} else if ( mapQual < 0 ) {
goodMapReads = reads;
goodMapOffsets = offsets;
} else {
goodMapReads = new ArrayList<SAMRecord>();
goodMapOffsets = new ArrayList<Integer>();
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<SAMRecord>,List<Integer>>(goodMapReads,goodMapOffsets);
}
public static Pair<List<SAMRecord>,List<Integer>> thresholdReadsByQuality(Pair<List<SAMRecord>,List<Integer>> readPair, byte qThresh) {
return thresholdReadsByQuality(readPair.getFirst(),readPair.getSecond(),qThresh);
}