/** * Allocate a new quality score table, based on requested parameters * in this set of tables, without any data in it. The return result * of this table is suitable for acting as a thread-local cache * for quality score values * @return a newly allocated, empty read group x quality score table */ public NestedIntegerArray<RecalDatum> makeQualityScoreTable() { return log == null ? new NestedIntegerArray<RecalDatum>(numReadGroups, qualDimension, eventDimension) : new LoggingNestedIntegerArray<RecalDatum>(log, "QUALITY_SCORE_TABLE", numReadGroups, qualDimension, eventDimension); }
public RecalibrationTables(final Covariate[] covariates, final int numReadGroups, final PrintStream log) { tables = new ArrayList<NestedIntegerArray<RecalDatum>>(covariates.length); for ( int i = 0; i < covariates.length; i++ ) tables.add(i, null); // initialize so we can set below qualDimension = covariates[TableType.QUALITY_SCORE_TABLE.ordinal()].maximumKeyValue() + 1; this.numReadGroups = numReadGroups; this.log = log; tables.set(TableType.READ_GROUP_TABLE.ordinal(), log == null ? new NestedIntegerArray<RecalDatum>(numReadGroups, eventDimension) : new LoggingNestedIntegerArray<RecalDatum>(log, "READ_GROUP_TABLE", numReadGroups, eventDimension)); tables.set(TableType.QUALITY_SCORE_TABLE.ordinal(), makeQualityScoreTable()); for (int i = TableType.OPTIONAL_COVARIATE_TABLES_START.ordinal(); i < covariates.length; i++) tables.set(i, log == null ? new NestedIntegerArray<RecalDatum>(numReadGroups, qualDimension, covariates[i].maximumKeyValue()+1, eventDimension) : new LoggingNestedIntegerArray<RecalDatum>(log, String.format("OPTIONAL_COVARIATE_TABLE_%d", i - TableType.OPTIONAL_COVARIATE_TABLES_START.ordinal() + 1), numReadGroups, qualDimension, covariates[i].maximumKeyValue()+1, eventDimension)); }
public NestedIntegerArray<RecalDatum> makeTable(final List<Row> rows) { final NestedIntegerArray<RecalDatum> x = new NestedIntegerArray<RecalDatum>(3, 3); for ( final Row r : rows ) x.put(new RecalDatum((long)r.no, (double)r.ne, (byte)10), r.rg, r.qual); return x; } }
@Requires("recalibrationTables != null && numCovariates > 0") @Ensures("result != null") private static NestedIntegerArray<RecalDatum> createDeltaTable(final RecalibrationTables recalibrationTables, final int numCovariates) { final int[] dimensionsForDeltaTable = new int[4]; // initialize the dimensions with those of the qual table to start with final NestedIntegerArray<RecalDatum> qualTable = recalibrationTables.getQualityScoreTable(); final int[] dimensionsOfQualTable = qualTable.getDimensions(); dimensionsForDeltaTable[0] = dimensionsOfQualTable[0]; // num read groups dimensionsForDeltaTable[1] = numCovariates + 1; // num covariates dimensionsForDeltaTable[2] = dimensionsOfQualTable[1]; dimensionsForDeltaTable[3] = dimensionsOfQualTable[2]; // now, update the dimensions based on the optional covariate tables as needed for ( int i = RecalibrationTables.TableType.OPTIONAL_COVARIATE_TABLES_START.ordinal(); i < numCovariates; i++ ) { final NestedIntegerArray<RecalDatum> covTable = recalibrationTables.getTable(i); final int[] dimensionsOfCovTable = covTable.getDimensions(); dimensionsForDeltaTable[2] = Math.max(dimensionsForDeltaTable[2], dimensionsOfCovTable[2]); dimensionsForDeltaTable[3] = Math.max(dimensionsForDeltaTable[3], dimensionsOfCovTable[3]); } return new NestedIntegerArray<RecalDatum>(dimensionsForDeltaTable); }