LooseLab / readfish

CLI tool for flexible and fast adaptive sampling on ONT sequencers
https://looselab.github.io/readfish/
GNU General Public License v3.0
167 stars 31 forks source link

Readfish with Guppy 6.2.1 #207

Closed merfre closed 1 year ago

merfre commented 2 years ago

Hello,

Due to recent hardware upgrades we have had to update our Guppy version to 6.2.1 and we previously had readfish working with 6.1 by using the API branch as you previously recommended; however, now when we try to run readfish in a playback run there is an error:

sudo runuser -l minknow -c '/home/merfre/anaconda3/envs/readfish_api/bin/readfish targets --device MN17166 --experiment-name "RU Test basecall and map on new GPU" --toml /home/merfre/human_chr_selection.toml --log-file ru_adap_gpu_test.log'

2022-07-29 11:14:58,880 ru.ru_gen /home/merfre/anaconda3/envs/readfish_api/bin/readfish targets --device MN17166 --experiment-name RU Test basecall and map on new GPU --toml /home/merfre/human_chr_selection.toml --log-file ru_adap_gpu_test.log 2022-07-29 11:14:58,880 ru.ru_gen batch_size=512 2022-07-29 11:14:58,880 ru.ru_gen cache_size=512 2022-07-29 11:14:58,880 ru.ru_gen channels=[1, 512] 2022-07-29 11:14:58,880 ru.ru_gen chunk_log=None 2022-07-29 11:14:58,880 ru.ru_gen command=targets 2022-07-29 11:14:58,880 ru.ru_gen device=MN17166 2022-07-29 11:14:58,880 ru.ru_gen dry_run=False 2022-07-29 11:14:58,880 ru.ru_gen experiment_name=RU Test basecall and map on new GPU 2022-07-29 11:14:58,880 ru.ru_gen func=<function run at 0x7f9cec46cd40> 2022-07-29 11:14:58,880 ru.ru_gen host=127.0.0.1 2022-07-29 11:14:58,880 ru.ru_gen log_file=ru_adap_gpu_test.log 2022-07-29 11:14:58,880 ru.ru_gen log_format=%(asctime)s %(name)s %(message)s 2022-07-29 11:14:58,880 ru.ru_gen log_level=info 2022-07-29 11:14:58,880 ru.ru_gen paf_log=None 2022-07-29 11:14:58,880 ru.ru_gen port=None 2022-07-29 11:14:58,880 ru.ru_gen run_time=172800 2022-07-29 11:14:58,880 ru.ru_gen throttle=0.4 2022-07-29 11:14:58,880 ru.ru_gen toml=/home/merfre/human_chr_selection.toml 2022-07-29 11:14:58,880 ru.ru_gen unblock_duration=0.1 2022-07-29 11:14:58,880 ru.ru_gen workers=1 2022-07-29 11:14:58,883 ru.ru_gen Initialising minimap2 mapper 2022-07-29 11:15:03,522 ru.ru_gen Mapper initialised 2022-07-29 11:15:03,562 ru.ru_gen This experiment has 1 region on the flowcell 2022-07-29 11:15:03,562 ru.ru_gen Using reference: /home/merfre/human_reference.mmi 2022-07-29 11:15:10,613 ru.ru_gen Region 'select_chr_21_22' (control=False) has 2 contigs of which 2 are in the reference. There are 4 targets (including +/- strand) representing 3.04% of the reference. Reads will be unblocked when classed as single_off or multi_off; sequenced when classed as single_on or multi_on; and polled for more data when classed as no_map or no_seq. [guppy/error] basecall_service::BasecallClient::worker_loop: Connection error. [bad_reply] Could not interpret message from server for request: LOAD_CONFIG. Reply: INVALID_PROTOCOL [guppy/error] basecall_service::BasecallClient::worker_loop: Connection error. [bad_reply] Could not interpret message from server for request: LOAD_CONFIG. Reply: INVALID_PROTOCOL [guppy/error] basecall_service::BasecallClient::worker_loop: Connection error. [bad_reply] Could not interpret message from server for request: LOAD_CONFIG. Reply: INVALID_PROTOCOL [guppy/error] basecall_service::BasecallClient::worker_loop: Connection error. [bad_reply] Could not interpret message from server for request: LOAD_CONFIG. Reply: INVALID_PROTOCOL [guppy/error] basecall_service::BasecallClient::worker_loop: Connection error. [bad_reply] Could not interpret message from server for request: LOAD_CONFIG. Reply: INVALID_PROTOCOL [guppy/error] basecall_service::BasecallClient::worker_loop: Connection error. [bad_reply] Could not interpret message from server for request: LOAD_CONFIG. Reply: INVALID_PROTOCOL Traceback (most recent call last): File "/home/merfre/anaconda3/envs/readfish_api/bin/readfish", line 8, in sys.exit(main()) File "/home/merfre/anaconda3/envs/readfish_api/lib/python3.7/site-packages/ru/cli.py", line 43, in main args.func(parser, args) File "/home/merfre/anaconda3/envs/readfish_api/lib/python3.7/site-packages/ru/ru_gen.py", line 510, in run caller_kwargs=caller_kwargs, File "/home/merfre/anaconda3/envs/readfish_api/lib/python3.7/site-packages/ru/ru_gen.py", line 157, in simple_analysis config=caller_kwargs["config_name"], File "/home/merfre/anaconda3/envs/readfish_api/lib/python3.7/site-packages/ru/basecall.py", line 41, in init self.connect() File "/home/merfre/anaconda3/envs/readfish_api/lib/python3.7/site-packages/pyguppy_client_lib/pyclient.py", line 172, in connect raise exception_type(exception_message) RuntimeError: Server response not formatted correctly: <result.bad_reply: 14>

Our toml file for this playback run:

[caller_settings] config_name = "dna_r9.4.1_450bps_fast" host = "ipc:///tmp/.guppy" port = 5557

[conditions] reference = "/home/merfre/human_reference.mmi"

[conditions.0] name = "select_chr_21_22" control = false min_chunks = 0 max_chunks = inf targets = ["CM000683.2", "CM000684.2"] single_on = "stop_receiving" multi_on = "stop_receiving" single_off = "unblock" multi_off = "unblock" no_seq = "proceed" no_map = "proceed"

Readfish connects to minknow (shown in the system messages for the minknow GUI), but from this error it seems unable to connect to our basecaller server. We used this to start up our basecalling server:

sudo runuser -l minknow -c '/usr/bin/guppy_basecall_server --log_path guppy.log --config dna_r9.4.1_450bps_fast.cfg --port /tmp/.guppy/5557 --device cuda:0 --gpu_runners_per_device 8 --num_callers 4 --chunks_per_runner 1024 --chunk_size 1000'

ONT Guppy basecall server software version 6.2.1+6588110a6, client-server API version 11.0.0, minimap2 version 2.22-r1101 log path: guppy.log chunk size: 1000 chunks per runner: 1024 max queued reads: 2000 num basecallers: 4 num socket threads: 2 max returned events: 50000 gpu device: cuda:0 kernel path: runners per device: 8 Use of this software is permitted solely under the terms of the end user license agreement (EULA).By running, copying or accessing this software, you are demonstrating your acceptance of the EULA. The EULA may be found in /opt/ont/guppy/bin

Config loaded: config file: /opt/ont/guppy/data/dna_r9.4.1_450bps_fast.cfg model file: /opt/ont/guppy/data/template_r9.4.1_450bps_fast.jsn model version id 2021-05-17_dna_r9.4.1_minion_96_29d8704b adapter scaler model file: None Starting server on port: ipc:///tmp/.guppy/5557

We tried different configuration files, different basecalling parameters, etc. and all produced this error with readfish. I was just wondering whether there is a branch under development that works with Guppy 6.2.1?

merfre commented 2 years ago

Any word on this error?

dawnmy commented 1 year ago

I had the same issue. And was able to solve it by installing the dependencies and readfish under user minknow

pip install git+https://github.com/nanoporetech/read_until_api@v3.0.0
pip install git+https://github.com/LooseLab/readfish@issue187
# Install ont_pyguppy_client_lib that matches your guppy server version. E.G.
pip install ont_pyguppy_client_lib==6.1.5

Then run readfish with user minknow You could have a try as well.

Adoni5 commented 1 year ago

Hey @merfre - @dawnmy is correct! There are two issues with running guppy on non ONT computers. The first is the permissions - guppy doesn't like talking to anything not running as the minknow user.

However the fact that you had it previously working suggests that you had that sorted. In which case this is the second issue - that your installed version of ont-pyguppy-client-lib now no longer matches the upgraded version of guppy_basecall_server.

This is described in more detail here

I'm going to close this as completed - but please reopen if you need more help. Thanks, Rory