Hi,
I would like to use minimap2 to map incoming nanopore reads in realtime. Do you know whether it is possible to use minimap2 with stdin or with a growing file of reads?
Thanks!
whether it is possible to use minimap2 with stdin
Yes. Use - as the input file name, or a named pipe. You can also use the C or the python APIs. That will give you more control.
Unfortunately this is not working. I tried the following:
jsa.np.npreader -realtime -folder /workspace/pass/0 -output - | jsa.np.filter -input - -lenMin 5000 -qualMin 12 -output - | minimap2 -ax map-ont ref_seeds.mmi - > test_stdin.sam
If I replace minimap2 by bwa mem, however, it is working.
That is the design and it is working for me. If it is not working for you, it should be a bug. What's output?
As output I get a sam file containing only the header section
What's the stderr output?
I can't fix the issue unless I reproduce it on my side.
I only get:
[M::main::0.0641.01] loaded/built the index for 2300 target sequence(s)
[M::mm_mapopt_update::0.0740.97] mid_occ = 5
[M::mm_idx_stat] kmer size: 15; skip: 10; is_hpc: 0; #seq: 2300
[M::mm_idx_stat::0.082*0.98] distinct minimizers: 403396 (95.97% are singletons); average occurrences: 1.045; average spacing: 5.456
so no real errors. I seems like it doesn't see that there are reads coming in?
Minimap2 reads a batch of input and then processes together. It is still running and waiting for your input. You may use a small batch size with "-K", but the more efficient solution is to use the C or the Python APIs.
Thanks, it is indeed working with a smaller K!
@lcmmichielsen do you know how many reads per second are produced, and what their average length is? That would help you to choose -K the minimum bp total of reads before mapping is performed.
Thanks for the tip, I should ask my supervisor for that, but it will be really useful. Now I am working with a really small test set just to check whether the program is working, so therefore the default K was too big I guess.
Most helpful comment
Minimap2 reads a batch of input and then processes together. It is still running and waiting for your input. You may use a small batch size with "-K", but the more efficient solution is to use the C or the Python APIs.