Skip to content

Commit

Permalink
Update chunks writer
Browse files Browse the repository at this point in the history
  • Loading branch information
lukfor committed Jul 29, 2024
1 parent 4b0d191 commit 3b73ee2
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import genepi.imputationserver.steps.vcf.MinimalVariantContext;
import genepi.imputationserver.steps.vcf.VcfChunk;
import genepi.io.table.writer.CsvTableWriter;
import genepi.io.text.LineWriter;

import java.io.IOException;

public class ExcludedChunksWriter {

private LineWriter writer;
private CsvTableWriter writer;

private String filename;

Expand All @@ -18,12 +19,14 @@ public ExcludedChunksWriter(String filename) throws IOException {

public void write(VcfChunk chunk, double overlap, int countLowSamples) throws IOException {
if (writer == null) {
writer = new LineWriter(filename);
writer.write(
"#Chunk" + "\t" + "SNPs (#)" + "\t" + "Reference Overlap (%)" + "\t" + "Low Sample Call Rates (#)",
false);
writer = new CsvTableWriter(filename, '\t', false);
writer.setColumns(new String[]{"CHUNK", "SNPS", "REFERENCE_OVERLAP", "SAMPLES_LOW_CALL_RATE"});
}
writer.write(chunk.toString() + "\t" + chunk.overallSnpsChunk + "\t" + overlap + "\t" + countLowSamples);
writer.setString("CHUNK", chunk.toString());
writer.setInteger("SNPS", chunk.overallSnpsChunk);
writer.setDouble("REFERENCE_OVERLAP", overlap);
writer.setInteger("SAMPLES_LOW_CALL_RATE", countLowSamples);
writer.next();
}

public void close() throws IOException {
Expand Down

0 comments on commit 3b73ee2

Please sign in to comment.