Fixing merge conflict

This commit is contained in:
Eric Banks 2011-11-02 12:50:32 -04:00
commit 4501dce58d
5 changed files with 750 additions and 762 deletions

View File

@ -408,12 +408,12 @@ public class MathUtils {
return Math.sqrt(rms);
}
public static double rms(Collection<Double> l) {
public static double rms(Collection<Integer> l) {
if (l.size() == 0)
return 0.0;
double rms = 0.0;
for (Double i : l)
for (int i : l)
rms += i*i;
rms /= l.size();
return Math.sqrt(rms);

View File

@ -198,13 +198,15 @@ public class AlignmentUtils {
return sum;
}
/** Returns the mismatches in the read within the given reference context.
/** Returns the number of mismatches in the pileup element within the given reference context.
*
* @param read the SAMRecord
* @param ref the reference context
* @return each base is represented by a bit in the BitSet. True for mismatch, false for ref
* @param read the SAMRecord
* @param ref the reference context
* @param maxMismatches the maximum number of surrounding mismatches we tolerate to consider a base good
* @param windowSize window size (on each side) to test
* @return a bitset representing which bases are good
*/
public static BitSet mismatchesInRefWindow(SAMRecord read, ReferenceContext ref) {
public static BitSet mismatchesInRefWindow(SAMRecord read, ReferenceContext ref, int maxMismatches, int windowSize) {
// first determine the positions with mismatches
int readLength = read.getReadLength();
BitSet mismatches = new BitSet(readLength);
@ -212,7 +214,7 @@ public class AlignmentUtils {
// it's possible we aren't starting at the beginning of a read,
// and we don't need to look at any of the previous context outside our window
// (although we do need future context)
int readStartPos = read.getAlignmentStart();
int readStartPos = Math.max(read.getAlignmentStart(), ref.getLocus().getStart() - windowSize);
int currentReadPos = read.getAlignmentStart();
byte[] refBases = ref.getBases();
@ -263,22 +265,9 @@ public class AlignmentUtils {
break;
}
}
return mismatches;
}
/** Returns a BitSet showing what bases are good according to the criteria of maxMismatches in the window
*
* @param read the SAMRecord
* @param ref the reference context
* @param maxMismatches the maximum number of surrounding mismatches we tolerate to consider a base good
* @param windowSize window size (on each side) to test
* @return a bitset representing which bases are good
*/
public static BitSet mismatchesInRefWindow(SAMRecord read, ReferenceContext ref, int maxMismatches, int windowSize) {
int readLength = read.getReadLength();
// all bits are set to false by default
BitSet result = new BitSet(readLength);
BitSet mismatches = mismatchesInRefWindow(read, ref);
int currentPos = 0, leftPos = 0, rightPos;
int mismatchCount = 0;

View File

@ -43,6 +43,7 @@ import java.util.Map;
*
*/
public class GATKSAMRecord extends BAMRecord {
public static final String REDUCED_READ_QUALITY_TAG = "RR";
// the SAMRecord data we're caching
private String mReadString = null;
private GATKSAMReadGroupRecord mReadGroup = null;
@ -151,7 +152,7 @@ public class GATKSAMRecord extends BAMRecord {
public byte[] getReducedReadCounts() {
if ( ! retrievedReduceReadCounts ) {
reducedReadCounts = getByteArrayAttribute(ReadUtils.REDUCED_READ_QUALITY_TAG);
reducedReadCounts = getByteArrayAttribute(REDUCED_READ_QUALITY_TAG);
retrievedReduceReadCounts = true;
}

View File

@ -51,8 +51,6 @@ public class ReadUtils {
//
// ----------------------------------------------------------------------------------------------------
public static final String REDUCED_READ_QUALITY_TAG = "RQ";
// ----------------------------------------------------------------------------------------------------
//
// General utilities

View File

@ -29,7 +29,7 @@ public class ReadUtilsUnitTest extends BaseTest {
reducedRead = ArtificialSAMUtils.createArtificialRead(header, "reducedRead", 0, 1, BASES.length());
reducedRead.setReadBases(BASES.getBytes());
reducedRead.setBaseQualityString(QUALS);
reducedRead.setAttribute(ReadUtils.REDUCED_READ_QUALITY_TAG, REDUCED_READ_COUNTS);
reducedRead.setAttribute(GATKSAMRecord.REDUCED_READ_QUALITY_TAG, REDUCED_READ_COUNTS);
}
private void testReadBasesAndQuals(SAMRecord read, int expectedStart, int expectedStop) {