Skip to content

Fix redirecting stdout for tblastx and tblastn

Workum, Dirk-Jan van requested to merge fix_blast_output_file into develop

We discovered that something goes wrong when running tblastn with pantools. Specifically, this error message will be thrown:

% pantools blast tmp_DB tmp.pep.fa --mode=TBLASTN --minimum-identity=55 --alignment-threshold=55 
16:12:16 [INFO ] PanTools version 4.3.1, abbrev. commit ID 6c9afe5
16:12:16 [INFO ] Usage: pantools blast tmp_DB tmp.pep.fa --mode=TBLASTN --minimum-identity=55 --alignment-threshold=55
16:12:17 [INFO ] Run BLAST against the pangenome.
16:12:22 [INFO ] --alignment-threshold set to 55% of the original query length
16:12:22 [INFO ] --minimum-identity set to 55%
 Retrieving phasing information: 4/4
16:12:22 [INFO ] No phased genomes are present.
16:12:22 [INFO ] No (correct) BLAST databases available, building them now.
Preparing genome input: 416:12:22 [INFO ] Building BLAST genome database.
16:12:22 [INFO ] Building BLAST protein database.
16:12:23 [INFO ] Created a BLAST nucleotide and protein database:
16:12:23 [INFO ]  tmp_DB/BLAST/genome_db/
16:12:23 [INFO ]  tmp_DB/BLAST/protein_db/
16:12:23 [INFO ] Using TBLASTN. Protein -> Six nucleotide frames.
16:12:23 [INFO ] TBLASTNing: sequence 1/2
java.nio.file.NoSuchFileException: tmp_DB/BLAST_OUT
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.Files.newByteChannel(Files.java:361)
	at java.nio.file.Files.newByteChannel(Files.java:407)
	at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
	at java.nio.file.Files.newInputStream(Files.java:152)
	at java.nio.file.Files.newBufferedReader(Files.java:2784)
	at java.nio.file.Files.newBufferedReader(Files.java:2816)
	at nl.wur.bif.pantools.utils.Utils.countLinesInFile(Utils.java:1612)
	at nl.wur.bif.pantools.analysis.blast.Blast.runBlast(Blast.java:543)
	at nl.wur.bif.pantools.analysis.blast.Blast.blast(Blast.java:53)
	at nl.wur.bif.pantools.analysis.blast.BlastCLI.call(BlastCLI.java:67)
	at nl.wur.bif.pantools.analysis.blast.BlastCLI.call(BlastCLI.java:28)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at nl.wur.bif.pantools.Pantools.executionStrategy(Pantools.java:248)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at nl.wur.bif.pantools.Pantools.main(Pantools.java:210)
16:12:24 [INFO ] Sequence 1. Analyzing 0 hits.
java.lang.RuntimeException: tmp_DB/BLAST_OUT (No such file or directory)
	at nl.wur.bif.pantools.analysis.blast.Blast.runBlast(Blast.java:603)
	at nl.wur.bif.pantools.analysis.blast.Blast.blast(Blast.java:53)
	at nl.wur.bif.pantools.analysis.blast.BlastCLI.call(BlastCLI.java:67)
	at nl.wur.bif.pantools.analysis.blast.BlastCLI.call(BlastCLI.java:28)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at nl.wur.bif.pantools.Pantools.executionStrategy(Pantools.java:248)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at nl.wur.bif.pantools.Pantools.main(Pantools.java:210)
16:12:24 [INFO ] Run time: 8.787s

Looking into the code, it appears that specifically for tblastn and tblastx it says >1 instead of 1> for redirecting the output. This causes the actual output file to never be written to.

Merge request reports