maickrau / GraphAligner

MIT License
261 stars 32 forks source link

GraphAligner closes named pipe (feature request) #105

Open nrizzo opened 2 months ago

nrizzo commented 2 months ago

Hello!

GraphAligner is not nice to Unix named pipes for the input reads (see below). I think named pipe compatibility could be useful in pipelines that feed GraphAligner the reads and do not want to store them on disk, would you consider adding a flag parameter about it?

# shell 0
$ mkfifo test/fiforead.fa
$ cat test/read.fa > test/fiforead.fa
$ echo $?
141
# shell 1
$ GraphAligner -g test/graph.gfa -f test/fiforead.fa -a test/aln.gaf -x vg
GraphAligner Branch master commit daec67f67a2f50d648a6aa30cbbe5a2949583061 2024-01-19 10:52:13 +0200
GraphAligner Branch master commit daec67f67a2f50d648a6aa30cbbe5a2949583061 2024-01-19 10:52:13 +0200
Load graph from test/graph.gfa
Build alignment graph
Build minimizer seeder from the graph
Minimizer seeds, length 15, window size 20, density 10
Seed cluster size 1
Extend up to 5 seed clusters
Alignment bandwidth 10
Clip alignment ends with identity < 66%
X-drop DP score cutoff 14705
Backtrace from 10 highest scoring local maxima per cluster
write alignments to test/aln.gaf
Align
# I guess here SIGPIPE happens in shell 0

Execution proceeds as normal if I rerun command cat test/read.fa > test/fiforead.fa in the first shell. Culprits are the lines src/Aligner.cpp:810-818 opening and closing the read file, commenting out those lines fixes the problem.

~Nicola

caineblood commented 2 months ago

The above comment asking you to download a file is malware to steal your account; do not under any circumstances download or run it. The post needs to be removed. If you have attempted to run it please have your system cleaned and your account secured immediately.

nrizzo commented 3 weeks ago

Knowing that the incompatibility is in lines src/Aligner.cpp:810-818, a not-so-nice trick to make GraphAligner read the graph, index it, and wait for the reads, is

mkfifo test/fiforead.fa
GraphAligner -g test/graph.gfa -f test/fiforead.fa -a test/aln.gaf -x vg &
# give GraphAligner a file to open and close
echo > test/fiforead.fa &

# GraphAligner here reads and indexes the graph
sleep 10s
cat test/read.fa > test/fiforead.fa

A caveat is that command echo > test/fiforead.fa & terminates with a SIGPIPE error.