Search in sources :

Example 6 with GATKReportTable

use of org.broadinstitute.hellbender.utils.report.GATKReportTable in project gatk by broadinstitute.

the class VariantRecalibrator method makeMeansTable.

private GATKReportTable makeMeansTable(final String tableName, final String tableDescription, final List<String> annotationList, final GaussianMixtureModel model, final String formatString) {
    GATKReportTable meansTable = new GATKReportTable(tableName, tableDescription, annotationList.size(), GATKReportTable.Sorting.DO_NOT_SORT);
    meansTable.addColumn("Gaussian", "");
    for (final String annotationName : annotationList) {
        meansTable.addColumn(annotationName, formatString);
    }
    final List<MultivariateGaussian> modelGaussians = model.getModelGaussians();
    for (int i = 0; i < modelGaussians.size(); i++) {
        final MultivariateGaussian gaussian = modelGaussians.get(i);
        final double[] meanVec = gaussian.mu;
        if (meanVec.length != annotationList.size())
            throw new IllegalStateException("Gaussian mean vector does not have the same size as the list of annotations");
        meansTable.addRowIDMapping(i, i, true);
        for (int j = 0; j < annotationList.size(); j++) meansTable.set(i, annotationList.get(j), meanVec[j]);
    }
    return meansTable;
}
Also used : GATKReportTable(org.broadinstitute.hellbender.utils.report.GATKReportTable)

Example 7 with GATKReportTable

use of org.broadinstitute.hellbender.utils.report.GATKReportTable in project gatk by broadinstitute.

the class RecalibrationReportUnitTest method testReportsForTable.

private static void testReportsForTable(GATKReport originalReport, GATKReport calculatedReport, List<String> columnsToTest, String argumentReportTableTitle) {
    final GATKReportTable originalTable = originalReport.getTable(argumentReportTableTitle);
    final GATKReportTable calculatedTable = calculatedReport.getTable(argumentReportTableTitle);
    testTablesWithColumns(originalTable, calculatedTable, columnsToTest);
}
Also used : GATKReportTable(org.broadinstitute.hellbender.utils.report.GATKReportTable)

Example 8 with GATKReportTable

use of org.broadinstitute.hellbender.utils.report.GATKReportTable in project gatk by broadinstitute.

the class VariantRecalibrator method makeVectorTable.

protected GATKReportTable makeVectorTable(final String tableName, final String tableDescription, final List<String> annotationList, final double[] perAnnotationValues, final String columnName, final String formatString) {
    GATKReportTable vectorTable = new GATKReportTable(tableName, tableDescription, annotationList.size(), GATKReportTable.Sorting.DO_NOT_SORT);
    vectorTable.addColumn("Annotation", "%s");
    vectorTable.addColumn(columnName, formatString);
    for (int i = 0; i < perAnnotationValues.length; i++) {
        vectorTable.addRowIDMapping(annotationList.get(i), i, true);
        vectorTable.set(i, 1, perAnnotationValues[i]);
    }
    return vectorTable;
}
Also used : GATKReportTable(org.broadinstitute.hellbender.utils.report.GATKReportTable)

Example 9 with GATKReportTable

use of org.broadinstitute.hellbender.utils.report.GATKReportTable in project gatk by broadinstitute.

the class VariantRecalibrator method makeCovariancesTable.

private GATKReportTable makeCovariancesTable(final String tableName, final String tableDescription, final List<String> annotationList, final GaussianMixtureModel model, final String formatString) {
    GATKReportTable modelCovariances = new GATKReportTable(tableName, tableDescription, annotationList.size() + 2, //+2 is for Gaussian and Annotation columns
    GATKReportTable.Sorting.DO_NOT_SORT);
    modelCovariances.addColumn("Gaussian", "");
    modelCovariances.addColumn("Annotation", "");
    for (final String annotationName : annotationList) {
        modelCovariances.addColumn(annotationName, formatString);
    }
    final List<MultivariateGaussian> modelGaussians = model.getModelGaussians();
    for (int i = 0; i < modelGaussians.size(); i++) {
        final MultivariateGaussian gaussian = modelGaussians.get(i);
        final Matrix covMat = gaussian.sigma;
        if (covMat.getRowDimension() != annotationList.size() || covMat.getColumnDimension() != annotationList.size())
            throw new IllegalStateException("Gaussian covariance matrix does not have the same size as the list of annotations");
        for (int j = 0; j < annotationList.size(); j++) {
            modelCovariances.set(j + i * annotationList.size(), "Gaussian", i);
            modelCovariances.set(j + i * annotationList.size(), "Annotation", annotationList.get(j));
            for (int k = 0; k < annotationList.size(); k++) {
                modelCovariances.set(j + i * annotationList.size(), annotationList.get(k), covMat.get(j, k));
            }
        }
    }
    return modelCovariances;
}
Also used : Matrix(Jama.Matrix) GATKReportTable(org.broadinstitute.hellbender.utils.report.GATKReportTable)

Example 10 with GATKReportTable

use of org.broadinstitute.hellbender.utils.report.GATKReportTable in project gatk by broadinstitute.

the class RecalibrationArgumentCollection method generateReportTable.

public GATKReportTable generateReportTable(final String covariateNames) {
    GATKReportTable argumentsTable;
    argumentsTable = new GATKReportTable("Arguments", "Recalibration argument collection values used in this run", 2, GATKReportTable.Sorting.SORT_BY_COLUMN);
    argumentsTable.addColumn("Argument", "%s");
    argumentsTable.addColumn(RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, "");
    argumentsTable.addRowID("covariate", true);
    argumentsTable.set("covariate", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, covariateNames);
    argumentsTable.addRowID("no_standard_covs", true);
    argumentsTable.set("no_standard_covs", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, DO_NOT_USE_STANDARD_COVARIATES);
    argumentsTable.addRowID("run_without_dbsnp", true);
    argumentsTable.set("run_without_dbsnp", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, RUN_WITHOUT_DBSNP);
    argumentsTable.addRowID("solid_recal_mode", true);
    argumentsTable.set("solid_recal_mode", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, SOLID_RECAL_MODE);
    argumentsTable.addRowID("solid_nocall_strategy", true);
    argumentsTable.set("solid_nocall_strategy", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, SOLID_NOCALL_STRATEGY);
    argumentsTable.addRowID("mismatches_context_size", true);
    argumentsTable.set("mismatches_context_size", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, MISMATCHES_CONTEXT_SIZE);
    argumentsTable.addRowID("indels_context_size", true);
    argumentsTable.set("indels_context_size", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, INDELS_CONTEXT_SIZE);
    argumentsTable.addRowID("mismatches_default_quality", true);
    argumentsTable.set("mismatches_default_quality", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, MISMATCHES_DEFAULT_QUALITY);
    argumentsTable.addRowID("deletions_default_quality", true);
    argumentsTable.set("deletions_default_quality", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, DELETIONS_DEFAULT_QUALITY);
    argumentsTable.addRowID("insertions_default_quality", true);
    argumentsTable.set("insertions_default_quality", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, INSERTIONS_DEFAULT_QUALITY);
    argumentsTable.addRowID("maximum_cycle_value", true);
    argumentsTable.set("maximum_cycle_value", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, MAXIMUM_CYCLE_VALUE);
    argumentsTable.addRowID("low_quality_tail", true);
    argumentsTable.set("low_quality_tail", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, LOW_QUAL_TAIL);
    argumentsTable.addRowID("default_platform", true);
    argumentsTable.set("default_platform", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, DEFAULT_PLATFORM);
    argumentsTable.addRowID("force_platform", true);
    argumentsTable.set("force_platform", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, FORCE_PLATFORM);
    argumentsTable.addRowID("quantizing_levels", true);
    argumentsTable.set("quantizing_levels", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, QUANTIZING_LEVELS);
    argumentsTable.addRowID("recalibration_report", true);
    argumentsTable.set("recalibration_report", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, existingRecalibrationReport == null ? "null" : existingRecalibrationReport.getAbsolutePath());
    argumentsTable.addRowID("binary_tag_name", true);
    argumentsTable.set("binary_tag_name", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, BINARY_TAG_NAME == null ? "null" : BINARY_TAG_NAME);
    return argumentsTable;
}
Also used : GATKReportTable(org.broadinstitute.hellbender.utils.report.GATKReportTable)

Aggregations

GATKReportTable (org.broadinstitute.hellbender.utils.report.GATKReportTable)10 GATKReport (org.broadinstitute.hellbender.utils.report.GATKReport)3 ArrayList (java.util.ArrayList)2 Test (org.testng.annotations.Test)2 Matrix (Jama.Matrix)1 Random (java.util.Random)1 MutablePair (org.apache.commons.lang3.tuple.MutablePair)1 Pair (org.apache.commons.lang3.tuple.Pair)1 NestedIntegerArray (org.broadinstitute.hellbender.utils.collections.NestedIntegerArray)1 Covariate (org.broadinstitute.hellbender.utils.recalibration.covariates.Covariate)1