A quick implementation of the experimental covariates for the TGen folks to work with.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3344 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
rpoplin 2010-05-11 01:08:52 +00:00
parent aec5f7b630
commit b09e7231d1
12 changed files with 29 additions and 10 deletions

View File

@ -39,7 +39,6 @@ import net.sf.samtools.SAMRecord;
public interface Covariate {
public void initialize( RecalibrationArgumentCollection RAC ); // Initialize any member variables using the command-line arguments passed to the walkers
public Comparable getValue( SAMRecord read, int offset ); // Used to pick out the covariate's value from attributes of the read
public Comparable getValue( String str ); // Used to get the covariate's value from input csv file in TableRecalibrationWalker
public void getValues( SAMRecord read, Comparable[] comparable ); //Takes an array of size (at least) read.getReadLength() and fills it with covariate
//values for each position in the read. This method was created as an optimization over calling getValue( read, offset ) for each offset and allows

View File

@ -61,6 +61,7 @@ public class CycleCovariate implements StandardCovariate {
}
}
/*
// Used to pick out the covariate's value from attributes of the read
public final Comparable getValue( final SAMRecord read, final int offset ) {
@ -158,8 +159,9 @@ public class CycleCovariate implements StandardCovariate {
return cycle;
}
*/
// Used to pick out the covariate's value from attributes of the read
public void getValues(SAMRecord read, Comparable[] comparable) {
//-----------------------------

View File

@ -61,6 +61,7 @@ public class DinucCovariate implements StandardCovariate {
dinucHashMap.put( Dinuc.hashBytes(NO_CALL, NO_CALL), NO_DINUC );
}
/*
// Used to pick out the covariate's value from attributes of the read
public final Comparable getValue( final SAMRecord read, final int offset ) {
@ -93,7 +94,7 @@ public class DinucCovariate implements StandardCovariate {
return dinucHashMap.get( Dinuc.hashBytes( prevBase, base ) );
}
*/
/**
* Takes an array of size (at least) read.getReadLength() and fills it with the covariate values for each position in the read.

View File

@ -77,7 +77,9 @@ public class GCContentCovariate implements ExperimentalCovariate {
}
public void getValues(SAMRecord read, Comparable[] comparable) {
throw new IllegalStateException("Not yet implemented");
for(int iii = 0; iii < read.getReadLength(); iii++) {
comparable[iii] = getValue(read, iii); // BUGBUG: this can be optimized
}
}
// Used to get the covariate's value from input csv file in TableRecalibrationWalker

View File

@ -91,7 +91,9 @@ public class HomopolymerCovariate implements ExperimentalCovariate {
}
public void getValues(SAMRecord read, Comparable[] comparable) {
throw new IllegalStateException("Not yet implemented");
for(int iii = 0; iii < read.getReadLength(); iii++) {
comparable[iii] = getValue(read, iii); // BUGBUG: this can be optimized
}
}
// Used to get the covariate's value from input csv file in TableRecalibrationWalker

View File

@ -52,7 +52,9 @@ public class MappingQualityCovariate implements ExperimentalCovariate {
}
public void getValues(SAMRecord read, Comparable[] comparable) {
throw new IllegalStateException("Not yet implemented");
for(int iii = 0; iii < read.getReadLength(); iii++) {
comparable[iii] = getValue(read, iii); // BUGBUG: this can be optimized
}
}
}

View File

@ -67,6 +67,8 @@ public class MinimumNQSCovariate implements ExperimentalCovariate {
}
public void getValues(SAMRecord read, Comparable[] comparable) {
throw new IllegalStateException("Not yet implemented");
for(int iii = 0; iii < read.getReadLength(); iii++) {
comparable[iii] = getValue(read, iii); // BUGBUG: this can be optimized
}
}
}

View File

@ -57,7 +57,9 @@ public class PositionCovariate implements ExperimentalCovariate {
}
public void getValues(SAMRecord read, Comparable[] comparable) {
throw new IllegalStateException("Not yet implemented");
for(int iii = 0; iii < read.getReadLength(); iii++) {
comparable[iii] = getValue(read, iii); // BUGBUG: this can be optimized
}
}
}

View File

@ -45,7 +45,7 @@ public class PrimerRoundCovariate implements ExperimentalCovariate {
// Used to pick out the covariate's value from attributes of the read
public final Comparable getValue( final SAMRecord read, final int offset ) {
if( read.getReadGroup().getPlatform().equalsIgnoreCase( "SOLID" ) ) {
if( read.getReadGroup().getPlatform().equalsIgnoreCase( "SOLID" ) || read.getReadGroup().getPlatform().equalsIgnoreCase( "ABI_SOLID" ) ) {
int pos = offset;
if( read.getReadNegativeStrandFlag() ) {
pos = read.getReadLength() - (offset + 1);
@ -63,6 +63,8 @@ public class PrimerRoundCovariate implements ExperimentalCovariate {
}
public void getValues(SAMRecord read, Comparable[] comparable) {
throw new IllegalStateException("Not yet implemented");
for(int iii = 0; iii < read.getReadLength(); iii++) {
comparable[iii] = getValue(read, iii); // BUGBUG: this can be optimized
}
}
}

View File

@ -41,10 +41,12 @@ public class QualityScoreCovariate implements RequiredCovariate {
public void initialize( final RecalibrationArgumentCollection RAC ) {
}
/*
// Used to pick out the covariate's value from attributes of the read
public final Comparable getValue( final SAMRecord read, final int offset ) {
return (int)(read.getBaseQualities()[offset]);
}
*/
public void getValues(SAMRecord read, Comparable[] comparable) {
byte[] baseQualities = read.getBaseQualities();

View File

@ -43,10 +43,12 @@ public class ReadGroupCovariate implements RequiredCovariate{
public void initialize( final RecalibrationArgumentCollection RAC ) {
}
/*
// Used to pick out the covariate's value from attributes of the read
public final Comparable getValue( final SAMRecord read, final int offset ) {
return read.getReadGroup().getReadGroupId();
}
*/
public void getValues(SAMRecord read, Comparable[] comparable) {
final String readGroupId = read.getReadGroup().getReadGroupId();

View File

@ -41,6 +41,7 @@ public class TileCovariate implements ExperimentalCovariate {
exceptionWhenNoTile = RAC.EXCEPTION_IF_NO_TILE;
}
// Used to pick out the covariate's value from attributes of the read
public Comparable getValue(final SAMRecord read, final int offset) {
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());