Merged bug fix from Stable into Unstable

This commit is contained in:
Eric Banks 2011-07-06 16:05:48 -04:00
commit 52f6f9fdcc
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import net.sf.samtools.*;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.*;
@ -113,9 +114,10 @@ public class ConstrainedMateFixingManager {
HashMap<String, SAMRecordHashObject> forMateMatching = new HashMap<String, SAMRecordHashObject>();
TreeSet<SAMRecord> waitingReads = new TreeSet<SAMRecord>(comparer);
private <T> T remove(TreeSet<T> treeSet) {
final T first = treeSet.first();
treeSet.remove(first);
private SAMRecord remove(TreeSet<SAMRecord> treeSet) {
final SAMRecord first = treeSet.first();
if ( !treeSet.remove(first) )
throw new UserException("Error caching SAM record " + first.getReadName() + ", which is usually caused by malformed SAM/BAM files in which multiple identical copies of a read are present.");
return first;
}