-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lookahead Covariates moved to UG_feature_branch
- Loading branch information
1 parent
6a19613
commit 3ce718d
Showing
6 changed files
with
268 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/org/broadinstitute/hellbender/utils/recalibration/covariates/AltCovariate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.broadinstitute.hellbender.utils.recalibration.covariates; | ||
|
||
import htsjdk.samtools.SAMFileHeader; | ||
import org.broadinstitute.hellbender.utils.BaseUtils; | ||
import org.broadinstitute.hellbender.utils.read.GATKRead; | ||
import org.broadinstitute.hellbender.utils.recalibration.RecalibrationArgumentCollection; | ||
|
||
public final class AltCovariate implements Covariate { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public AltCovariate(final RecalibrationArgumentCollection RAC){ | ||
} | ||
|
||
// Used to pick out the covariate's value from attributes of the read | ||
@Override | ||
public void recordValues(final GATKRead read, final SAMFileHeader header, final ReadCovariates values, final boolean recordIndelValues) { | ||
final int readLength = read.getLength(); | ||
final byte[] readBases = read.getBasesNoCopy(); | ||
for (int i = 0; i < readLength; i++) { | ||
final int baseIndex = BaseUtils.simpleBaseToBaseIndex(readBases[i]); | ||
values.addCovariate(baseIndex, 0, 0, i); | ||
} | ||
} | ||
|
||
@Override | ||
public String formatKey(final int key){ | ||
if ( key < 0 ) { | ||
return "N"; | ||
} else { | ||
return String.format("%c", (char)BaseUtils.baseIndexToSimpleBase(key)); | ||
} | ||
} | ||
|
||
@Override | ||
public int keyFromValue(final Object value) { | ||
if ( (value instanceof String)) { | ||
final byte base = ((String)value).getBytes()[0]; | ||
if ( base == 'N' ) { | ||
return -1; | ||
} else { | ||
return BaseUtils.simpleBaseToBaseIndex(base); | ||
} | ||
|
||
} else { | ||
return (Integer)value; | ||
} | ||
} | ||
|
||
@Override | ||
public int maximumKeyValue() { | ||
return BaseUtils.Base.values().length; | ||
} | ||
} |
Oops, something went wrong.