Search in sources :

Example 1 with GATKReportTable

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

the class GatkReportWriter method createTsvWriter.

public static GatkReportWriter createTsvWriter() {
    return new GatkReportWriter() {

        @Override
        public void print(GATKReport report, PrintStream out) {
            boolean firstTable = true;
            /* loop over each table */
            for (final GATKReportTable table : report.getTables()) {
                if (!firstTable)
                    out.println();
                firstTable = false;
                out.print("##Name\t");
                out.println(table.getTableName());
                out.print("##Description\t");
                out.println(table.getTableDescription());
                /* loop over each column */
                for (int j = 0; j < table.getNumColumns(); ++j) {
                    final GATKReportColumn col = table.getColumnInfo().get(j);
                    out.print(j == 0 ? "#" : "\t");
                    out.print(col.getColumnName());
                }
                out.println();
                /* loop over each row */
                for (int i = 0; i < table.getNumRows(); ++i) {
                    /* loop over each column */
                    for (int j = 0; j < table.getNumColumns(); ++j) {
                        final Object obj = table.get(i, j);
                        if (j > 0)
                            out.print("\t");
                        if (obj != null)
                            out.print(obj.toString());
                    }
                    out.println();
                }
            }
            out.flush();
        }
    };
}
Also used : GATKReport(org.broadinstitute.gatk.utils.report.GATKReport) PrintStream(java.io.PrintStream) GATKReportColumn(org.broadinstitute.gatk.utils.report.GATKReportColumn) GATKReportTable(org.broadinstitute.gatk.utils.report.GATKReportTable)

Example 2 with GATKReportTable

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

the class AbstractGroupBy method onTraversalDone.

@Override
public void onTraversalDone(final Map<Category, Long> counts) {
    final GATKReportTable table = createGATKReportTable();
    table.addColumn("COUNT");
    int nRows = 0;
    for (final Category cat : counts.keySet()) {
        for (int x = 0; x < cat.size(); ++x) {
            table.set(nRows, x, cat.get(x));
        }
        table.set(nRows, cat.size(), counts.get(cat));
        ++nRows;
    }
    final GatkReportWriter reportWriter = GatkReportWriter.createWriter(this.outputTableFormat);
    final GATKReport report = new GATKReport();
    report.addTable(table);
    reportWriter.print(report, this.out);
    this.out.flush();
    logger.info("TraversalDone");
}
Also used : GATKReport(org.broadinstitute.gatk.utils.report.GATKReport) Category(com.github.lindenb.jvarkit.gatk.Category) GatkReportWriter(com.github.lindenb.jvarkit.gatk.GatkReportWriter) GATKReportTable(org.broadinstitute.gatk.utils.report.GATKReportTable)

Example 3 with GATKReportTable

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

the class GroupByGenotypes method createGATKReportTable.

@Override
protected GATKReportTable createGATKReportTable() {
    final GATKReportTable table = new GATKReportTable("Singletons", "Singletons in " + variants.getSource(), 7);
    table.addColumn("SAMPLE_NAME");
    if (bychrom)
        table.addColumn("CHROM");
    if (byID)
        table.addColumn("IN_DBSNP");
    if (byType)
        table.addColumn("VARIANT_TYPE");
    if (byGenotypeType)
        table.addColumn("GENOTYPE_TYPE");
    if (byFilter)
        table.addColumn("VARIANT_FILTERED");
    if (byGFilter)
        table.addColumn("GENOTYPE_FILTERED");
    if (minGenotypeQuality >= 0)
        table.addColumn("GENOTYPE_QUAL_GE_" + this.minGenotypeQuality);
    if (byImpact)
        table.addColumn("IMPACT");
    return table;
}
Also used : GATKReportTable(org.broadinstitute.gatk.utils.report.GATKReportTable)

Aggregations

GATKReportTable (org.broadinstitute.gatk.utils.report.GATKReportTable)3 GATKReport (org.broadinstitute.gatk.utils.report.GATKReport)2 Category (com.github.lindenb.jvarkit.gatk.Category)1 GatkReportWriter (com.github.lindenb.jvarkit.gatk.GatkReportWriter)1 PrintStream (java.io.PrintStream)1 GATKReportColumn (org.broadinstitute.gatk.utils.report.GATKReportColumn)1