rrwick / Deepbinner

a signal-level demultiplexer for Oxford Nanopore reads
GNU General Public License v3.0
124 stars 23 forks source link

deepbinner realtime does not quit after sleep 5 #18

Open thsyd opened 5 years ago

thsyd commented 5 years ago

Hi, I hope this has an obvious answer. I cannot figure out how to get deepbinner to exit its "waiting for new files" mode to continue a bash script/job that I submit to a HPC.

I transfer fast5 files in bulk (not real time) to a HPC and want to run deepbinner -> albacore -> porechop (trim only). So for fast5 / non basecalled reads deepbinner realtime is the correct approach, right?

Following @rrwick examples (thank you so much for your generosity) i do

where the variables fast5dirs is an array of foldernames and NPROCS is number of processes

mkdir demultiplexed_fast5s
for fast5 in ${fast5dirs[*]}; do
     deepbinner realtime --omp_num_threads $NPROCS --in_dir $fast5 --out_dir demultiplexed_fast5s $librarytype
done

and from here let albacore cycle though the barcodeXX folders in the demultiplexed_fast5s folder.

In @rrwick s examples a Ctrl+C is needed from the user to end the deepbinner realtime program. But I cannot figure out how to get this into my bash script. It might be something with the commands trap break INT (https://www.unix.com/shell-programming-and-scripting/147781-doing-tail-script-then-return-back-continue-script.html) and then perhaps sending a SIGINT ? However I am not at a skill level to get this to work. Has anyone else got a solution working?

Edits: correct display of code block.

ttubb commented 5 years ago

Hi, i'm having a very similar problem caused by the need to manually interrupt the program. For the time being, i use a crude alteration in deepbinners realtime.py script. I changed this section

                else:
                    print('\nWaiting for new fast5 files (Ctrl-C to stop)', end='',
                         flush=True)
                    waiting = True
            time.sleep(5)

to look like this:

                else:
                    print('\nAll fast5 files processed, exiting')
                    quit()
            time.sleep(5)

This lets me use deepbinner as part of a CWL-Workflow. Note that doing this will make the script useless for the intended "realtime" application where seqencing is still taking place during the execution of deepbinner. Hope it helps!

elhumble commented 5 years ago

Hi, I am having the same problem. I transfer my data to a server where I am running deepbinner through a jobscript. I am using deepbinner realtime as my files are not basecalled. However I am stuck on "waiting for new files" and cannot get deepbinner to exit without deleting the job.

Is there a simple way around this without altering the realtime.py script?

At the moment I am thinking about basecalling first and then running deepbinner classify and bin.

charlottewright commented 4 years ago

Thank you @ttubb - your fix worked for me when I was having a similar issue.