}
log.info(wfString);
log.info("Ext factor = " + extFactorValue);
Genome genome = loadGenome(genomeId);
if (genome == null) {
throw new PreprocessingException("Genome could not be loaded: " + genomeId);
}
// Multiple files allowed for count command (a tdf and a wig)
File tdfFile = null;
File wigFile = null;
boolean wigStdOut = false;
String[] files = ofile.split(",");
for(String fileTok: files){
if (fileTok.endsWith("wig")) {
wigFile = new File(fileTok);
} else if (fileTok.endsWith("tdf")) {
tdfFile = new File(fileTok);
}else if (fileTok.equals(STDOUT_FILE_STR)){
wigStdOut = true;
}
}
if (tdfFile != null && !tdfFile.getName().endsWith(".tdf")) {
tdfFile = new File(tdfFile.getAbsolutePath() + ".tdf");
}
try {
Preprocessor p = new Preprocessor(tdfFile, genome, windowFunctions, -1, null);
p.setSkipZeroes(true);
CoverageCounter counter = new CoverageCounter(ifile, p, windowSizeValue, extFactorValue, wigFile,
genome, queryString, minMapQuality, countFlags);
counter.setWriteStdOut(wigStdOut);
counter.setPreExtFactor(preExtFactorValue);
counter.setPosExtFactor(postExtFactorValue);
String prefix = FilenameUtils.getName(ifile);
String[] tracknames = counter.getTrackNames(prefix + " ");
p.setTrackParameters(TrackType.COVERAGE, trackLine, tracknames);
p.setSizeEstimate(((int) (genome.getNominalLength() / windowSizeValue)));
counter.parse();
p.finish();