Add option to specify maximum STR length to RepeatCovariates from command line to ease testing
This commit is contained in:
parent
75ceddf9e5
commit
baf2c4c338
|
|
@ -223,6 +223,18 @@ public class RecalibrationArgumentCollection {
|
|||
@Output(fullName = "recal_table_update_log", shortName = "recal_table_update_log", required = false, doc = "If provided, log all updates to the recalibration tables to the given file. For debugging/testing purposes only")
|
||||
public PrintStream RECAL_TABLE_UPDATE_LOG = null;
|
||||
|
||||
/**
|
||||
* The repeat covariate will use a context of this size to calculate it's covariate value for base insertions and deletions
|
||||
*/
|
||||
@Hidden
|
||||
@Argument(fullName = "max_str_unit_length", shortName = "maxstr", doc = "Max size of the k-mer context to be used for repeat covariates", required = false)
|
||||
public int MAX_STR_UNIT_LENGTH = 8;
|
||||
|
||||
@Hidden
|
||||
@Argument(fullName = "max_repeat_length", shortName = "maxrep", doc = "Max number of repetitions to be used for repeat covariates", required = false)
|
||||
public int MAX_REPEAT_LENGTH = 20;
|
||||
|
||||
|
||||
public File existingRecalibrationReport = null;
|
||||
|
||||
public GATKReportTable generateReportTable(final String covariateNames) {
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
public abstract class RepeatCovariate implements ExperimentalCovariate {
|
||||
public static final int MAX_REPEAT_LENGTH = 20;
|
||||
public static final int MAX_STR_UNIT_LENGTH = 8;
|
||||
protected int MAX_REPEAT_LENGTH;
|
||||
protected int MAX_STR_UNIT_LENGTH;
|
||||
private final HashMap<String, Integer> repeatLookupTable = new HashMap<String, Integer>();
|
||||
private final HashMap<Integer, String> repeatReverseLookupTable = new HashMap<Integer, String>();
|
||||
private int nextId = 0;
|
||||
|
|
@ -70,6 +70,8 @@ public abstract class RepeatCovariate implements ExperimentalCovariate {
|
|||
// Initialize any member variables using the command-line arguments passed to the walkers
|
||||
@Override
|
||||
public void initialize(final RecalibrationArgumentCollection RAC) {
|
||||
MAX_STR_UNIT_LENGTH = RAC.MAX_STR_UNIT_LENGTH;
|
||||
MAX_REPEAT_LENGTH = RAC.MAX_REPEAT_LENGTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ public class RepeatCovariatesUnitTest {
|
|||
@Test(enabled = true)
|
||||
public void testManyObservations() {
|
||||
final int NUM_UNITS = 10;
|
||||
final int MAX_REPEAT_UNIT_LENGTH = RepeatCovariate.MAX_STR_UNIT_LENGTH;
|
||||
final int MAX_NUM_REPETITIONS = RepeatCovariate.MAX_REPEAT_LENGTH;
|
||||
final int MAX_REPEAT_UNIT_LENGTH = RAC.MAX_STR_UNIT_LENGTH;
|
||||
final int MAX_NUM_REPETITIONS = RAC.MAX_REPEAT_LENGTH;
|
||||
final int NUM_TEST_CASES = 100;
|
||||
|
||||
Random random = new Random();
|
||||
|
|
@ -207,7 +207,7 @@ public class RepeatCovariatesUnitTest {
|
|||
|
||||
int fw = GATKVariantContextUtils.findNumberofRepetitions(ruValM.getBytes(), readBases.substring(offset+1,readLength).getBytes(),true);
|
||||
int bw = GATKVariantContextUtils.findNumberofRepetitions(ruValM.getBytes(), readBases.substring(0,offset+1).getBytes(),false);
|
||||
Assert.assertEquals(Math.min(fw+bw,RepeatCovariate.MAX_REPEAT_LENGTH),(int)Integer.valueOf(rlValM));
|
||||
Assert.assertEquals(Math.min(fw+bw,RAC.MAX_REPEAT_LENGTH),(int)Integer.valueOf(rlValM));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue