use of ubic.gemma.core.util.concurrent.ParsingStreamConsumer in project Gemma by PavlidisLab.
the class SimpleFastaCmd method getSequencesFromFastaCmdOutput.
private Collection<BioSequence> getSequencesFromFastaCmdOutput(Process pr) throws IOException {
try (final InputStream is = new BufferedInputStream(pr.getInputStream());
InputStream err = pr.getErrorStream()) {
final FastaParser parser = new FastaParser();
ParsingStreamConsumer<BioSequence> sg = new ParsingStreamConsumer<>(parser, is);
GenericStreamConsumer gsc = new GenericStreamConsumer(err);
sg.start();
gsc.start();
try {
int exitVal = pr.waitFor();
// Makes sure results are flushed.
Thread.sleep(200);
SimpleFastaCmd.log.debug(// often nonzero if some sequences are not found.
"fastacmd exit value=" + exitVal);
return parser.getResults();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
Aggregations