More misc cleanup.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2191 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
rpoplin 2009-11-30 22:29:07 +00:00
parent b89b9adb2c
commit 6bb864da2a
2 changed files with 9 additions and 7 deletions

View File

@ -78,11 +78,12 @@ public class CycleCovariate implements Covariate {
else if( read.getReadGroup().getPlatform().contains( "454" ) ) { // Some bams have "LS454" and others have just "454"
int cycle = 0;
//BUGBUG: should reverse directions on negative strand reads!
byte prevBase = read.getReadBases()[0];
byte[] bases = read.getReadBases();
byte prevBase = bases[0];
for( int iii = 1; iii <= offset; iii++ ) {
if(read.getReadBases()[iii] != prevBase) { // This base doesn't match the previous one so it is a new cycle
if( bases[iii] != prevBase ) { // This base doesn't match the previous one so it is a new cycle
cycle++;
prevBase = read.getReadBases()[iii];
prevBase = bases[iii];
}
}
return cycle;

View File

@ -49,12 +49,13 @@ public class MinimumNQSCovariate implements Covariate {
public final Comparable getValue( final SAMRecord read, final int offset ) {
// Loop over the list of base quality scores in the window and find the minimum
int minQual = read.getBaseQualities()[offset];
byte[] quals = read.getBaseQualities();
int minQual = quals[offset];
int minIndex = Math.max(offset - windowReach, 0);
int maxIndex = Math.min(offset + windowReach, read.getBaseQualities().length - 1);
int maxIndex = Math.min(offset + windowReach, quals.length - 1);
for ( int iii = minIndex; iii < maxIndex; iii++ ) {
if( read.getBaseQualities()[iii] < minQual ) {
minQual = read.getBaseQualities()[iii];
if( quals[iii] < minQual ) {
minQual = quals[iii];
}
}
return minQual;