Package org.broadinstitute.gatk.engine.report

Examples of org.broadinstitute.gatk.engine.report.GATKReportTable



    public File existingRecalibrationReport = null;

    public GATKReportTable generateReportTable(final String covariateNames) {
        GATKReportTable argumentsTable;
        if(SORT_BY_ALL_COLUMNS) {
            argumentsTable = new GATKReportTable("Arguments", "Recalibration argument collection values used in this run", 2, GATKReportTable.TableSortingWay.SORT_BY_COLUMN);
        } else {
            argumentsTable = new GATKReportTable("Arguments", "Recalibration argument collection values used in this run", 2);
        }
        argumentsTable.addColumn("Argument");
        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;
    }
View Full Code Here


            if (tableIndex == RecalibrationTables.TableType.READ_GROUP_TABLE.ordinal())
                columnNames.add(estimatedQReported); // only the read group table needs the estimated Q reported
            columnNames.add(nObservations);
            columnNames.add(nErrors);

            final GATKReportTable reportTable;
            if (tableIndex <= RecalibrationTables.TableType.OPTIONAL_COVARIATE_TABLES_START.ordinal()) {
                if(sortByCols) {
                    reportTable = new GATKReportTable("RecalTable" + reportTableIndex++, "", columnNames.size(), GATKReportTable.TableSortingWay.SORT_BY_COLUMN);
                } else {
                    reportTable = new GATKReportTable("RecalTable" + reportTableIndex++, "", columnNames.size(), GATKReportTable.TableSortingWay.DO_NOT_SORT);
                }
                for (final Pair<String, String> columnName : columnNames)
                    reportTable.addColumn(columnName.getFirst(), columnName.getSecond());
                rowIndex = 0; // reset the row index since we're starting with a new table
            } else {
                reportTable = result.get(RecalibrationTables.TableType.OPTIONAL_COVARIATE_TABLES_START.ordinal());
            }

            final NestedIntegerArray<RecalDatum> table = recalibrationTables.getTable(tableIndex);
            for (final NestedIntegerArray.Leaf row : table.getAllLeaves()) {
                final RecalDatum datum = (RecalDatum)row.value;
                final int[] keys = row.keys;

                int columnIndex = 0;
                int keyIndex = 0;
                reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), requestedCovariates[0].formatKey(keys[keyIndex++]));
                if (tableIndex != RecalibrationTables.TableType.READ_GROUP_TABLE.ordinal()) {
                    reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), requestedCovariates[1].formatKey(keys[keyIndex++]));
                    if (tableIndex >= RecalibrationTables.TableType.OPTIONAL_COVARIATE_TABLES_START.ordinal()) {
                        final Covariate covariate = requestedCovariates[tableIndex];

                        reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), covariate.formatKey(keys[keyIndex++]));
                        reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), covariateNameMap.get(covariate));
                    }
                }

                final EventType event = EventType.eventFrom(keys[keyIndex]);
                reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), event.toString());

                reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), datum.getEmpiricalQuality());
                if (tableIndex == RecalibrationTables.TableType.READ_GROUP_TABLE.ordinal())
                    reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), datum.getEstimatedQReported()); // we only add the estimated Q reported in the RG table
                reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), datum.getNumObservations());
                reportTable.set(rowIndex, columnNames.get(columnIndex).getFirst(), datum.getNumMismatches());

                rowIndex++;
            }
            result.add(reportTable);
        }
View Full Code Here

        final GATKReport report = new GATKReport(recalFile);

        argumentTable = report.getTable(RecalUtils.ARGUMENT_REPORT_TABLE_TITLE);
        RAC = initializeArgumentCollectionTable(argumentTable);

        GATKReportTable quantizedTable = report.getTable(RecalUtils.QUANTIZED_REPORT_TABLE_TITLE);
        quantizationInfo = initializeQuantizationTable(quantizedTable);

        Pair<ArrayList<Covariate>, ArrayList<Covariate>> covariates = RecalUtils.initializeCovariates(RAC); // initialize the required and optional covariates
        ArrayList<Covariate> requiredCovariates = covariates.getFirst();
        ArrayList<Covariate> optionalCovariates = covariates.getSecond();
View Full Code Here

     *
     * @param report the GATKReport containing the table with RecalUtils.READGROUP_REPORT_TABLE_TITLE
     * @return the unique read groups
     */
    private static SortedSet<String> getReadGroups(final GATKReport report) {
        final GATKReportTable reportTable = report.getTable(RecalUtils.READGROUP_REPORT_TABLE_TITLE);
        final SortedSet<String> readGroups = new TreeSet<String>();
        for ( int i = 0; i < reportTable.getNumRows(); i++ )
            readGroups.add(reportTable.get(i, RecalUtils.READGROUP_COLUMN_NAME).toString());
        return readGroups;
    }
View Full Code Here

    private void testReports(final GATKReport originalReport, final GATKReport calculatedReport) {

        // test the Arguments table
        List<String> columnsToTest = Arrays.asList(RecalUtils.ARGUMENT_COLUMN_NAME, RecalUtils.ARGUMENT_VALUE_COLUMN_NAME);
        GATKReportTable originalTable = originalReport.getTable(RecalUtils.ARGUMENT_REPORT_TABLE_TITLE);
        GATKReportTable calculatedTable = calculatedReport.getTable(RecalUtils.ARGUMENT_REPORT_TABLE_TITLE);
        testTablesWithColumns(originalTable, calculatedTable, columnsToTest);

        // test the Quantized table
        columnsToTest = Arrays.asList(RecalUtils.QUALITY_SCORE_COLUMN_NAME, RecalUtils.QUANTIZED_COUNT_COLUMN_NAME, RecalUtils.QUANTIZED_VALUE_COLUMN_NAME);
        originalTable = originalReport.getTable(RecalUtils.QUANTIZED_REPORT_TABLE_TITLE);
View Full Code Here

    public int getQuantizationLevels() {
        return quantizationLevels;
    }

    public GATKReportTable generateReportTable(boolean sortByCols) {
        GATKReportTable quantizedTable;
        if(sortByCols) {
            quantizedTable = new GATKReportTable(RecalUtils.QUANTIZED_REPORT_TABLE_TITLE, "Quality quantization map", 3, GATKReportTable.TableSortingWay.SORT_BY_COLUMN);
        }   else {
            quantizedTable = new GATKReportTable(RecalUtils.QUANTIZED_REPORT_TABLE_TITLE, "Quality quantization map", 3);
        }
        quantizedTable.addColumn(RecalUtils.QUALITY_SCORE_COLUMN_NAME);
        quantizedTable.addColumn(RecalUtils.QUANTIZED_COUNT_COLUMN_NAME);
        quantizedTable.addColumn(RecalUtils.QUANTIZED_VALUE_COLUMN_NAME);

        for (int qual = 0; qual <= QualityUtils.MAX_SAM_QUAL_SCORE; qual++) {
            quantizedTable.set(qual, RecalUtils.QUALITY_SCORE_COLUMN_NAME, qual);
            quantizedTable.set(qual, RecalUtils.QUANTIZED_COUNT_COLUMN_NAME, empiricalQualCounts.get(qual));
            quantizedTable.set(qual, RecalUtils.QUANTIZED_VALUE_COLUMN_NAME, quantizedQuals.get(qual));
        }
        return quantizedTable;
    }
View Full Code Here

        report.print(out);
    }

    private final void addQualHistogramToReport(final GATKReport report) {
        report.addTable("QualHistogram", "Quality score histogram provided to report", 2);
        GATKReportTable table = report.getTable("QualHistogram");

        table.addColumn("qual");
        table.addColumn("count");

        for ( int q = 0; q < nObservationsPerQual.size(); q++ ) {
            table.set(q, "qual", q);
            table.set(q, "count", nObservationsPerQual.get(q));
        }
    }
View Full Code Here

    }


    private final void addIntervalsToReport(final GATKReport report) {
        report.addTable("QualQuantizerIntervals", "Table of QualQuantizer quantization intervals", 10);
        GATKReportTable table = report.getTable("QualQuantizerIntervals");

        table.addColumn("name");
        table.addColumn("qStart");
        table.addColumn("qEnd");
        table.addColumn("level");
        table.addColumn("merge.order");
        table.addColumn("nErrors");
        table.addColumn("nObservations");
        table.addColumn("qual");
        table.addColumn("penalty");
        table.addColumn("root.node");
        //table.addColumn("subintervals", "NA");

        for ( QualInterval interval : quantizedIntervals )
            addIntervalToReport(table, interval, true);
    }
View Full Code Here

        // now that we have a specific list of values we want to show, display them
        GATKReport report = new GATKReport();
        final String tableName = "differences";
        report.addTable(tableName, "Summarized differences between the master and test files. See http://www.broadinstitute.org/gatk/guide/article?id=1299 for more information", 3);
        final GATKReportTable table = report.getTable(tableName);
        table.addColumn("Difference");
        table.addColumn("NumberOfOccurrences");
        table.addColumn("ExampleDifference");
        for ( final Difference diff : toShow ) {
            final String key = diff.getPath();
            table.addRowID(key, true);
            table.set(key, "NumberOfOccurrences", diff.getCount());
            table.set(key, "ExampleDifference", diff.valueDiffString());
        }
        GATKReport output = new GATKReport(table);
        output.print(params.out);
    }
View Full Code Here

    }

    public void onTraversalDone(ConcordanceMetrics metrics) {
        // todo -- this is over 200 lines of code just to format the output and could use some serious cleanup
        GATKReport report = new GATKReport();
        GATKReportTable concordanceCounts = new GATKReportTable("GenotypeConcordance_Counts","Per-sample concordance tables: comparison counts",2+GenotypeType.values().length*GenotypeType.values().length);
        GATKReportTable concordanceEvalProportions = new GATKReportTable("GenotypeConcordance_EvalProportions", "Per-sample concordance tables: proportions of genotypes called in eval",2+GenotypeType.values().length*GenotypeType.values().length);
        GATKReportTable concordanceCompProportions = new GATKReportTable("GenotypeConcordance_CompProportions", "Per-sample concordance tables: proportions of genotypes called in comp",2+GenotypeType.values().length*GenotypeType.values().length);
        GATKReportTable concordanceSummary = new GATKReportTable("GenotypeConcordance_Summary","Per-sample summary statistics: NRS, NRD, and OGC",2);
        GATKReportTable siteConcordance = new GATKReportTable("SiteConcordance_Summary","Site-level summary statistics",ConcordanceMetrics.SiteConcordanceType.values().length);
        if ( moltenize ) {
            concordanceCompProportions.addColumn("Sample","%s");
            concordanceCounts.addColumn("Sample","%s");
            concordanceEvalProportions.addColumn("Sample","%s");
            concordanceSummary.addColumn("Sample","%s");

            concordanceCompProportions.addColumn("Eval_Genotype","%s");
            concordanceCounts.addColumn("Eval_Genotype","%s");
            concordanceEvalProportions.addColumn("Eval_Genotype","%s");
            concordanceSummary.addColumn("Non-Reference_Discrepancy","%.3f");

            concordanceCompProportions.addColumn("Comp_Genotype","%s");
            concordanceCounts.addColumn("Comp_Genotype","%s");
            concordanceEvalProportions.addColumn("Comp_Genotype","%s");
            concordanceSummary.addColumn("Non-Reference_Sensitivity","%.3f");

            concordanceCompProportions.addColumn("Proportion","%.3f");
            concordanceCounts.addColumn("Count","%d");
            concordanceEvalProportions.addColumn("Proportion","%.3f");
            concordanceSummary.addColumn("Overall_Genotype_Concordance","%.3f");

            for ( Map.Entry<String,ConcordanceMetrics.GenotypeConcordanceTable> entry : metrics.getPerSampleGenotypeConcordance().entrySet() ) {
                ConcordanceMetrics.GenotypeConcordanceTable table = entry.getValue();
                for ( GenotypeType evalType : GenotypeType.values() ) {
                    for ( GenotypeType compType : GenotypeType.values() ) {
                        String rowKey = String.format("%s_%s_%s",entry.getKey(),evalType.toString(),compType.toString());
                        concordanceCounts.set(rowKey,"Sample",entry.getKey());
                        concordanceCounts.set(rowKey,"Eval_Genotype",evalType.toString());
                        concordanceCounts.set(rowKey,"Comp_Genotype",compType.toString());
                        int count = table.get(evalType, compType);
                        concordanceCounts.set(rowKey,"Count",count);
                        if ( evalType == GenotypeType.HET || evalType == GenotypeType.HOM_REF || evalType == GenotypeType.HOM_VAR) {
                            concordanceEvalProportions.set(rowKey,"Sample",entry.getKey());
                            concordanceEvalProportions.set(rowKey,"Eval_Genotype",evalType.toString());
                            concordanceEvalProportions.set(rowKey,"Comp_Genotype",compType.toString());
                            concordanceEvalProportions.set(rowKey,"Proportion",repairNaN(( (double) count)/table.getnEvalGenotypes(evalType)));
                        }
                        if ( compType == GenotypeType.HET || compType == GenotypeType.HOM_VAR || compType == GenotypeType.HOM_REF ) {
                            concordanceCompProportions.set(rowKey,"Sample",entry.getKey());
                            concordanceCompProportions.set(rowKey,"Eval_Genotype",evalType.toString());
                            concordanceCompProportions.set(rowKey,"Comp_Genotype",compType.toString());
                            concordanceCompProportions.set(rowKey,"Proportion",repairNaN(( (double) count)/table.getnCompGenotypes(compType)));
                        }
                    }
                }
                String mismatchKey = String.format("%s_%s",entry.getKey(),"Mismatching");
                concordanceCounts.set(mismatchKey,"Sample",entry.getKey());
                concordanceCounts.set(mismatchKey,"Eval_Genotype","Mismatching_Alleles");
                concordanceCounts.set(mismatchKey,"Comp_Genotype","Mismatching_Alleles");
                concordanceEvalProportions.set(mismatchKey,"Sample",entry.getKey());
                concordanceEvalProportions.set(mismatchKey,"Eval_Genotype","Mismatching_Alleles");
                concordanceEvalProportions.set(mismatchKey,"Comp_Genotype","Mismatching_Alleles");
                concordanceCompProportions.set(mismatchKey,"Sample",entry.getKey());
                concordanceCompProportions.set(mismatchKey,"Eval_Genotype","Mismatching_Alleles");
                concordanceCompProportions.set(mismatchKey,"Comp_Genotype","Mismatching_Alleles");
                concordanceEvalProportions.set(mismatchKey,"Proportion", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledEvalGenotypes()));
                concordanceCompProportions.set(mismatchKey,"Proportion", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledCompGenotypes()));
                concordanceCounts.set(mismatchKey,"Count",table.getnMismatchingAlt());
            }

            String sampleKey = "ALL";
            ConcordanceMetrics.GenotypeConcordanceTable table = metrics.getOverallGenotypeConcordance();
            for ( GenotypeType evalType : GenotypeType.values() ) {
                for ( GenotypeType compType : GenotypeType.values() ) {
                    String rowKey = String.format("%s_%s_%s",sampleKey,evalType.toString(),compType.toString());
                    concordanceCounts.set(rowKey,"Sample",sampleKey);
                    concordanceCounts.set(rowKey,"Eval_Genotype",evalType.toString());
                    concordanceCounts.set(rowKey,"Comp_Genotype",compType.toString());
                    int count = table.get(evalType, compType);
                    concordanceCounts.set(rowKey,"Count",count);
                    if ( evalType == GenotypeType.HET || evalType == GenotypeType.HOM_REF || evalType == GenotypeType.HOM_VAR) {
                        concordanceEvalProportions.set(rowKey,"Sample",sampleKey);
                        concordanceEvalProportions.set(rowKey,"Eval_Genotype",evalType.toString());
                        concordanceEvalProportions.set(rowKey,"Comp_Genotype",compType.toString());
                        concordanceEvalProportions.set(rowKey,"Proportion",repairNaN(( (double) count)/table.getnEvalGenotypes(evalType)));
                    }
                    if ( compType == GenotypeType.HET || compType == GenotypeType.HOM_VAR || compType == GenotypeType.HOM_REF ) {
                        concordanceCompProportions.set(rowKey,"Sample",sampleKey);
                        concordanceCompProportions.set(rowKey,"Eval_Genotype",evalType.toString());
                        concordanceCompProportions.set(rowKey,"Comp_Genotype",compType.toString());
                        concordanceCompProportions.set(rowKey,"Proportion",repairNaN(( (double) count)/table.getnCompGenotypes(compType)));
                    }
                }
            }
            String rowKey = String.format("%s_%s",sampleKey,"Mismatching");
            concordanceCounts.set(rowKey,"Sample",sampleKey);
            concordanceCounts.set(rowKey,"Eval_Genotype","Mismatching_Alleles");
            concordanceCounts.set(rowKey,"Comp_Genotype","Mismatching_Alleles");
            concordanceEvalProportions.set(rowKey,"Sample",sampleKey);
            concordanceEvalProportions.set(rowKey,"Eval_Genotype","Mismatching_Alleles");
            concordanceEvalProportions.set(rowKey,"Comp_Genotype","Mismatching_Alleles");
            concordanceCompProportions.set(rowKey,"Sample",sampleKey);
            concordanceCompProportions.set(rowKey,"Eval_Genotype","Mismatching_Alleles");
            concordanceCompProportions.set(rowKey,"Comp_Genotype","Mismatching_Alleles");
            concordanceEvalProportions.set(rowKey,"Proportion", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledEvalGenotypes()));
            concordanceCompProportions.set(rowKey,"Proportion", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledCompGenotypes()));
            concordanceCounts.set(rowKey,"Count",table.getnMismatchingAlt());

            for ( Map.Entry<String,Double> nrsEntry : metrics.getPerSampleNRS().entrySet() ) {
                concordanceSummary.set(nrsEntry.getKey(),"Sample",nrsEntry.getKey());
                concordanceSummary.set(nrsEntry.getKey(),"Non-Reference_Sensitivity",nrsEntry.getValue());
            }
            for ( Map.Entry<String,Double> nrdEntry : metrics.getPerSampleNRD().entrySet() ) {
                concordanceSummary.set(nrdEntry.getKey(),"Non-Reference_Discrepancy",nrdEntry.getValue());
            }
            for ( Map.Entry<String,Double> ogcEntry : metrics.getPerSampleOGC().entrySet() ) {
                concordanceSummary.set(ogcEntry.getKey(),"Overall_Genotype_Concordance",ogcEntry.getValue());
            }
            concordanceSummary.set("ALL_NRS_NRD","Sample","ALL");
            concordanceSummary.set("ALL_NRS_NRD","Non-Reference_Sensitivity",metrics.getOverallNRS());
            concordanceSummary.set("ALL_NRS_NRD","Non-Reference_Discrepancy",metrics.getOverallNRD());
            concordanceSummary.set("ALL_NRS_NRD","Overall_Genotype_Concordance",metrics.getOverallOGC());


            for (ConcordanceMetrics.SiteConcordanceType type : ConcordanceMetrics.SiteConcordanceType.values() ) {
                siteConcordance.addColumn(type.toString(),"%d");
            }

            for (ConcordanceMetrics.SiteConcordanceType type : ConcordanceMetrics.SiteConcordanceType.values() ) {
                siteConcordance.set("Comparison",type.toString(),metrics.getOverallSiteConcordance().get(type));
            }

        } else {
            concordanceCompProportions.addColumn("Sample","%s");
            concordanceCounts.addColumn("Sample","%s");
            concordanceEvalProportions.addColumn("Sample","%s");
            concordanceSummary.addColumn("Sample","%s");
            for ( GenotypeType evalType : GenotypeType.values() ) {
                for ( GenotypeType compType : GenotypeType.values() ) {
                    String colKey = String.format("%s_%s", evalType.toString(), compType.toString());
                    concordanceCounts.addColumn(colKey,"%d");
                    if ( evalType == GenotypeType.HET || evalType == GenotypeType.HOM_REF || evalType == GenotypeType.HOM_VAR)
                        concordanceEvalProportions.addColumn(colKey,"%.3f");
                    if ( compType == GenotypeType.HET || compType == GenotypeType.HOM_VAR || compType == GenotypeType.HOM_REF )
                        concordanceCompProportions.addColumn(colKey,"%.3f");
                }
            }
            concordanceEvalProportions.addColumn("Mismatching_Alleles","%.3f");
            concordanceCompProportions.addColumn("Mismatching_Alleles","%.3f");
            concordanceCounts.addColumn("Mismatching_Alleles","%d");
            concordanceSummary.addColumn("Non-Reference Sensitivity","%.3f");
            concordanceSummary.addColumn("Non-Reference Discrepancy","%.3f");
            concordanceSummary.addColumn("Overall_Genotype_Concordance","%.3f");
            for (ConcordanceMetrics.SiteConcordanceType type : ConcordanceMetrics.SiteConcordanceType.values() ) {
                siteConcordance.addColumn(type.toString(),"%d");
            }

            for ( Map.Entry<String,ConcordanceMetrics.GenotypeConcordanceTable> entry : metrics.getPerSampleGenotypeConcordance().entrySet() ) {
                ConcordanceMetrics.GenotypeConcordanceTable table = entry.getValue();
                concordanceEvalProportions.set(entry.getKey(),"Sample",entry.getKey());
                concordanceCompProportions.set(entry.getKey(),"Sample",entry.getKey());
                concordanceCounts.set(entry.getKey(),"Sample",entry.getKey());
                for ( GenotypeType evalType : GenotypeType.values() ) {
                    for ( GenotypeType compType : GenotypeType.values() ) {
                        String colKey = String.format("%s_%s",evalType.toString(),compType.toString());
                        int count = table.get(evalType, compType);
                        concordanceCounts.set(entry.getKey(),colKey,count);
                        if ( evalType == GenotypeType.HET || evalType == GenotypeType.HOM_REF || evalType == GenotypeType.HOM_VAR)
                            concordanceEvalProportions.set(entry.getKey(),colKey,repairNaN(( (double) count)/table.getnEvalGenotypes(evalType)));
                        if ( compType == GenotypeType.HET || compType == GenotypeType.HOM_VAR || compType == GenotypeType.HOM_REF )
                            concordanceCompProportions.set(entry.getKey(),colKey,repairNaN(( (double) count)/table.getnCompGenotypes(compType)));
                    }
                }
                concordanceEvalProportions.set(entry.getKey(),"Mismatching_Alleles", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledEvalGenotypes()));
                concordanceCompProportions.set(entry.getKey(),"Mismatching_Alleles", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledCompGenotypes()));
                concordanceCounts.set(entry.getKey(),"Mismatching_Alleles",table.getnMismatchingAlt());
            }

            String rowKey = "ALL";
            concordanceCompProportions.set(rowKey,"Sample",rowKey);
            concordanceEvalProportions.set(rowKey,"Sample",rowKey);
            concordanceCounts.set(rowKey,"Sample",rowKey);
            ConcordanceMetrics.GenotypeConcordanceTable table = metrics.getOverallGenotypeConcordance();
            for ( GenotypeType evalType : GenotypeType.values() ) {
                for ( GenotypeType compType : GenotypeType.values() ) {
                    String colKey = String.format("%s_%s",evalType.toString(),compType.toString());
                    int count = table.get(evalType,compType);
                    concordanceCounts.set(rowKey,colKey,count);
                    if ( evalType == GenotypeType.HET || evalType == GenotypeType.HOM_REF || evalType == GenotypeType.HOM_VAR)
                        concordanceEvalProportions.set(rowKey,colKey,repairNaN(( (double) count)/table.getnEvalGenotypes(evalType)));
                    if ( compType == GenotypeType.HET || compType == GenotypeType.HOM_VAR || compType == GenotypeType.HOM_REF )
                        concordanceCompProportions.set(rowKey,colKey,repairNaN(( (double) count)/table.getnCompGenotypes(compType)));
                }
            }
            concordanceEvalProportions.set(rowKey,"Mismatching_Alleles", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledEvalGenotypes()));
            concordanceCompProportions.set(rowKey,"Mismatching_Alleles", repairNaN(( (double) table.getnMismatchingAlt() )/table.getnCalledCompGenotypes()));
            concordanceCounts.set(rowKey,"Mismatching_Alleles",table.getnMismatchingAlt());

            for ( Map.Entry<String,Double> nrsEntry : metrics.getPerSampleNRS().entrySet() ) {
                concordanceSummary.set(nrsEntry.getKey(),"Sample",nrsEntry.getKey());
                concordanceSummary.set(nrsEntry.getKey(),"Non-Reference Sensitivity",nrsEntry.getValue());
            }
            for ( Map.Entry<String,Double> nrdEntry : metrics.getPerSampleNRD().entrySet() ) {
                concordanceSummary.set(nrdEntry.getKey(),"Non-Reference Discrepancy",nrdEntry.getValue());
            }
            for ( Map.Entry<String,Double> ogcEntry : metrics.getPerSampleOGC().entrySet() ) {
                concordanceSummary.set(ogcEntry.getKey(),"Overall_Genotype_Concordance",ogcEntry.getValue());
            }
            concordanceSummary.set("ALL","Sample","ALL");
            concordanceSummary.set("ALL","Non-Reference Sensitivity",metrics.getOverallNRS());
            concordanceSummary.set("ALL","Non-Reference Discrepancy",metrics.getOverallNRD());
            concordanceSummary.set("ALL","Overall_Genotype_Concordance",metrics.getOverallOGC());

            for (ConcordanceMetrics.SiteConcordanceType type : ConcordanceMetrics.SiteConcordanceType.values() ) {
                siteConcordance.set("Comparison",type.toString(),metrics.getOverallSiteConcordance().get(type));
            }
        }

        report.addTable(concordanceCompProportions);
        report.addTable(concordanceEvalProportions);
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.engine.report.GATKReportTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.