@@ -0,0 +1,1817 @@
+package fi.csc.chipster.tools.ngs;%0A%0Aimport java.io.File;%0A%0Aimport fi.csc.microarray.analyser.java.JavaAnalysisJobBase;%0Aimport fi.csc.microarray.client.visualisation.methods.gbrowser.stack.VcfLineParser;%0Aimport fi.csc.microarray.client.visualisation.methods.gbrowser.util.ChromosomeNormaliser;%0Aimport fi.csc.microarray.client.visualisation.methods.gbrowser.util.TsvSorter;%0Aimport fi.csc.microarray.messaging.JobState;%0A%0Apublic class SortVcf extends JavaAnalysisJobBase %7B%0A%0A%09public static final ChromosomeNormaliser CHROMOSOME_NORMALISER = new ChromosomeNormaliser() %7B%0A%0A%09%09public String normaliseChromosome(String chromosomeName) %7B%0A%0A%09%09%09// Leave prefix as it is%0A%09%09%09%0A%09%09%09// Remove postfix, if present%0A%09%09%09String SEPARATOR = %22.%22;%0A%09%09%09if (chromosomeName.contains(SEPARATOR)) %7B%0A%09%09%09%09chromosomeName = chromosomeName.substring(0, chromosomeName.indexOf(SEPARATOR));%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09return chromosomeName;%0A%09%09%7D%0A%09%7D;%0A%09%0A%09@Override%0A%09public String getSADL() %7B%0A%09%09return %09%22TOOL SortVcf.java: %5C%22Sort VCF%5C%22 (Sort a VCF file by chromosome and position.)%22 + %22%5Cn%22 +%0A%09%09%09%09%22INPUT unsorted.vcf: %5C%22VCF file%5C%22 TYPE GENERIC%22 + %22%5Cn%22 +%0A%09%09%09%09%22OUTPUT sorted.vcf: %5C%22Sorted VCF file%5C%22%22 + %22%5Cn%22; %0A%0A%09%7D%0A%09%0A%09%0A%09@Override%0A%09protected void execute() %7B %0A%09%09updateStateToClient(JobState.RUNNING, %22sorting%22);%0A%0A%0A%09%09try %7B%0A%09%09%09// files%0A%09%09%09File inputFile = new File(jobWorkDir, analysis.getInputFiles().get(0).getFileName()); %0A%09%09%09File outputFile = new File(jobWorkDir, analysis.getOutputFiles().get(0).getFileName().getID()); %0A%0A%09%09%09// run sort%0A%09%09%09new TsvSorter().sort(%0A%09%09%09%09%09inputFile, outputFile, CHROMOSOME_NORMALISER, %0A%09%09%09%09%09VcfLineParser.Column.CHROM.ordinal(), %0A%09%09%09%09%09VcfLineParser.Column.POS.ordinal(), new VcfLineParser());%0A%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09updateState(JobState.FAILED, e.getMessage());%0A%09%09%09return;%0A%09%09%7D%0A%0A%09%09updateStateToClient(JobState.RUNNING, %22sorting finished%22);%0A%09%7D%0A%7D%0A%0A

Add vcf sort tool.