Search in sources :

Example 1 with GATKReportColumn

use of org.broadinstitute.gatk.utils.report.GATKReportColumn 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)

Aggregations

PrintStream (java.io.PrintStream)1 GATKReport (org.broadinstitute.gatk.utils.report.GATKReport)1 GATKReportColumn (org.broadinstitute.gatk.utils.report.GATKReportColumn)1 GATKReportTable (org.broadinstitute.gatk.utils.report.GATKReportTable)1