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:
parent
aec5f7b630
commit
b09e7231d1
|
|
@ -39,7 +39,6 @@ import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
public interface Covariate {
|
public interface Covariate {
|
||||||
public void initialize( RecalibrationArgumentCollection RAC ); // Initialize any member variables using the command-line arguments passed to the walkers
|
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 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
|
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
|
//values for each position in the read. This method was created as an optimization over calling getValue( read, offset ) for each offset and allows
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Used to pick out the covariate's value from attributes of the read
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
||||||
|
|
||||||
|
|
@ -158,8 +159,9 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
|
|
||||||
return cycle;
|
return cycle;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
public void getValues(SAMRecord read, Comparable[] comparable) {
|
||||||
|
|
||||||
//-----------------------------
|
//-----------------------------
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ public class DinucCovariate implements StandardCovariate {
|
||||||
dinucHashMap.put( Dinuc.hashBytes(NO_CALL, NO_CALL), NO_DINUC );
|
dinucHashMap.put( Dinuc.hashBytes(NO_CALL, NO_CALL), NO_DINUC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Used to pick out the covariate's value from attributes of the read
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
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 ) );
|
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.
|
* Takes an array of size (at least) read.getReadLength() and fills it with the covariate values for each position in the read.
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,9 @@ public class GCContentCovariate implements ExperimentalCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
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
|
// Used to get the covariate's value from input csv file in TableRecalibrationWalker
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,9 @@ public class HomopolymerCovariate implements ExperimentalCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
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
|
// Used to get the covariate's value from input csv file in TableRecalibrationWalker
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ public class MappingQualityCovariate implements ExperimentalCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ public class MinimumNQSCovariate implements ExperimentalCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,9 @@ public class PositionCovariate implements ExperimentalCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +45,7 @@ public class PrimerRoundCovariate implements ExperimentalCovariate {
|
||||||
|
|
||||||
// Used to pick out the covariate's value from attributes of the read
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
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;
|
int pos = offset;
|
||||||
if( read.getReadNegativeStrandFlag() ) {
|
if( read.getReadNegativeStrandFlag() ) {
|
||||||
pos = read.getReadLength() - (offset + 1);
|
pos = read.getReadLength() - (offset + 1);
|
||||||
|
|
@ -63,6 +63,8 @@ public class PrimerRoundCovariate implements ExperimentalCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,10 +41,12 @@ public class QualityScoreCovariate implements RequiredCovariate {
|
||||||
public void initialize( final RecalibrationArgumentCollection RAC ) {
|
public void initialize( final RecalibrationArgumentCollection RAC ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Used to pick out the covariate's value from attributes of the read
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
||||||
return (int)(read.getBaseQualities()[offset]);
|
return (int)(read.getBaseQualities()[offset]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
public void getValues(SAMRecord read, Comparable[] comparable) {
|
||||||
byte[] baseQualities = read.getBaseQualities();
|
byte[] baseQualities = read.getBaseQualities();
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,12 @@ public class ReadGroupCovariate implements RequiredCovariate{
|
||||||
public void initialize( final RecalibrationArgumentCollection RAC ) {
|
public void initialize( final RecalibrationArgumentCollection RAC ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Used to pick out the covariate's value from attributes of the read
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
public final Comparable getValue( final SAMRecord read, final int offset ) {
|
||||||
return read.getReadGroup().getReadGroupId();
|
return read.getReadGroup().getReadGroupId();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public void getValues(SAMRecord read, Comparable[] comparable) {
|
public void getValues(SAMRecord read, Comparable[] comparable) {
|
||||||
final String readGroupId = read.getReadGroup().getReadGroupId();
|
final String readGroupId = read.getReadGroup().getReadGroupId();
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ public class TileCovariate implements ExperimentalCovariate {
|
||||||
exceptionWhenNoTile = RAC.EXCEPTION_IF_NO_TILE;
|
exceptionWhenNoTile = RAC.EXCEPTION_IF_NO_TILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Used to pick out the covariate's value from attributes of the read
|
// Used to pick out the covariate's value from attributes of the read
|
||||||
public Comparable getValue(final SAMRecord read, final int offset) {
|
public Comparable getValue(final SAMRecord read, final int offset) {
|
||||||
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue