use of org.broad.igv.bbfile.BBFileReader in project jvarkit by lindenb.
the class Biostar105754 method doWork.
@Override
public int doWork(final List<String> args) {
if (this.bigWigFile == null) {
LOG.error("Big wig file undefined option");
return -1;
}
try {
LOG.info("Opening " + this.bigWigFile);
this.bbFileReader = new BBFileReader(this.bigWigFile);
if (!this.bbFileReader.isBigWigFile()) {
LOG.error("File " + this.bigWigFile + " is not a bigwig file");
return -1;
}
this.out = super.openFileOrStdoutAsPrintWriter(outputFile);
if (args.isEmpty()) {
final BufferedReader r = IOUtils.openStdinForBufferedReader();
run(r);
CloserUtil.close(r);
} else {
for (final String filename : args) {
final BufferedReader r = IOUtils.openURIForBufferedReading(filename);
run(r);
CloserUtil.close(r);
}
}
this.out.flush();
this.out.close();
return RETURN_OK;
} catch (final Exception err) {
LOG.error(err);
return -1;
} finally {
CloserUtil.close(bbFileReader);
CloserUtil.close(this.out);
bbFileReader = null;
this.out = null;
}
}
Aggregations