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 using guppy 6 and minknow 5 branch #201

Closed neavemj closed 11 months ago

neavemj commented 2 years ago

Good afternoon, thanks for all your hard work on this software!

I'm having some trouble getting readfish to connect with my new setup using guppy 6 and minknow 5. I am running the latest software versions that come automatically with 'sudo apt install minion-nc'; guppy 6.1.5 and minknow-core-minion-nc 5.1.0. Then I installed the GPU version of guppy using the instructions from ONT.

I've tried a lot of variations but my basic Readfish install is:

conda create -n readfish python=3.9
pip install git+https://github.com/nanoporetech/read_until_api@v3.0.0

pip install git+https://github.com/LooseLab/readfish@guppy_6_minknow_5

pip install ont_pyguppy_client_lib==6.1.5

I run my GPU guppy like so:

/home/minion_linux/software/ont-guppy/bin/guppy_basecall_server --log_path . --config dna_r9.4.1_450bps_fast.cfg --num_callers 1 --cpu_threads_per_caller 14 --port 5557 --ipc_threads 3 -x cuda:all

The server starts fine and connects to MinKNOW. Using the details in the terminal, I changed my TOML file to:

[caller_settings]
config_name = "dna_r9.4.1_450bps_fast"
host = "ipc:///home/minion_linux/data/1.readfish_test"
port = 5557

[conditions]
reference = "/home/minion_linux/data/1.readfish_test/GRCh38_latest_genomic.mmi"

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

Then run readfish like so:

readfish targets --device MN40294 --experiment-name "RU Test basecall and map" --toml "/home/minion_linux/data/1.readfish_test/human_chr_selection.toml"
2022-06-13 16:00:20,234 ru.ru_gen /home/minion_linux/miniconda3/envs/readfish/bin/readfish targets --device MN40294 --experiment-name RU Test basecall and map --toml /home/minion_linux/data/1.readfish_test/human_chr_selection.toml
2022-06-13 16:00:20,234 ru.ru_gen batch_size=512
2022-06-13 16:00:20,234 ru.ru_gen cache_size=512
2022-06-13 16:00:20,234 ru.ru_gen channels=[1, 512]
2022-06-13 16:00:20,234 ru.ru_gen chunk_log=None
2022-06-13 16:00:20,234 ru.ru_gen command=targets
2022-06-13 16:00:20,234 ru.ru_gen device=MN40294
2022-06-13 16:00:20,234 ru.ru_gen dry_run=False
2022-06-13 16:00:20,234 ru.ru_gen experiment_name=RU Test basecall and map
2022-06-13 16:00:20,234 ru.ru_gen func=<function run at 0x7f7a93116040>
2022-06-13 16:00:20,234 ru.ru_gen host=127.0.0.1
2022-06-13 16:00:20,234 ru.ru_gen log_file=None
2022-06-13 16:00:20,234 ru.ru_gen log_format=%(asctime)s %(name)s %(message)s
2022-06-13 16:00:20,234 ru.ru_gen log_level=info
2022-06-13 16:00:20,234 ru.ru_gen paf_log=None
2022-06-13 16:00:20,234 ru.ru_gen port=9501
2022-06-13 16:00:20,234 ru.ru_gen run_time=172800
2022-06-13 16:00:20,235 ru.ru_gen throttle=0.4
2022-06-13 16:00:20,235 ru.ru_gen toml=/home/minion_linux/data/1.readfish_test/human_chr_selection.toml
2022-06-13 16:00:20,235 ru.ru_gen unblock_duration=0.1
2022-06-13 16:00:20,235 ru.ru_gen workers=1
Traceback (most recent call last):
File "/home/minion_linux/miniconda3/envs/readfish/bin/readfish", line 8, in <module>
    sys.exit(main())
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/ru/cli.py", line 43, in main
    args.func(parser, args)
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/ru/ru_gen.py", line 476, in run
    position = get_device(args.device, host=args.host, port=args.port)
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/ru/utils.py", line 918, in get_device
    manager = Manager(host=host, port=port)
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/minknow_api/manager.py", line 155, in __init__
    version_info = self.rpc.get_version_info()
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/minknow_api/manager_service.py", line 422, in get_version_info
    return run_with_retry(self._stub.get_version_info,
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/minknow_api/manager_service.py", line 85, in run_with_retry
    result = MessageWrapper(method(message, timeout=timeout), unwraps=unwraps)
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/home/minion_linux/miniconda3/envs/readfish/lib/python3.9/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.UNAVAILABLE
    details = "failed to connect to all addresses"
    debug_error_string = "{"created":"@1655128820.237636099","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3217,"referenced_errors":[{"created":"@1655128820.237635825","description":"failed to connect to all addresses","file":"src/core/lib/transport/error_utils.cc","file_line":165,"grpc_status":14}]}"
>

Note that I get this same error using the 'unblock all' command, or if I use the TOML details in issue #170, or if I use guppy version 6.0.7. Something just seems to be stuck in getting readfish to make the connection.

Thanks again for your work on this and any ideas would be greatly appreciated.

Matt.

alexomics commented 2 years ago

Hi Matt, This branch is a little bit of a work-in-progress. There are some changes that I have made in the course of getting this working (but may not be permanent).

  1. You need to provide the --port 9502 option to readfish targets as MinKNOW now only use the secure port
  2. You may need to add the align_ref field to the caller_settings table in the TOML:
    [caller_settings]
    config_name = "dna_r9.4.1_450bps_fast"
    host = "ipc:///home/minion_linux/data/1.readfish_test"
    port = 5557
    align_ref = "/full/path/to/minimap2.mmi"

Currently this branch is geared towards PromethION, please let us know if you run into any other issues.

neavemj commented 2 years ago

Wow, thanks for the super fast reply! It works!

I'll have a bit more of a play with the target function and will let you know if I get any more errors.

Thanks again,

Matt.

mattloose commented 2 years ago

Matt - this version of the code is specifically for the promethION - it looks as though you are not - @alexomics could you recommend a more standard branch for Matt?

alexomics commented 2 years ago

@neavemj Sorry for the delay. As Matt Loose mentioned, this branch is aimed at PromethION. You may be able to use the code that is currently at #187.

pip uninstall readfish
pip install git+https://github.com/LooseLab/readfish@issue187

The difference here is how we align the data.

neavemj commented 2 years ago

Ah ok, thanks Alex and Matt!

I have been running the "guppy_6_minknow_5" code and it seems to be working well. I can get good unblocking rates and have been getting good enrichment stats based on the example playback dataset and a little test run.

Um, do you think the difference in alignment settings will have a big effect? It does seem to be working well so I'm a little hesitant to change.

Cheers,

Matt.

neavemj commented 2 years ago

Oh, I should add, I did need to run the command as the 'minknow' user as per comment #187.

sudo runuser -l minknow -c '/home/minion_linux/miniconda3/envs/readfish/bin/readfish targets --device MN40294 --experiment-name "Readfish mock run1" --toml "/home/minion_linux/data/2.readfish_mock_run1/mock_enrich_control.toml" --log-file ru_mock1.log --port 9502'

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

mattloose commented 11 months ago

A note - we have provided new more extensive documentation available at:

https://looselab.github.io/readfish/

Which should help resolve these issues in future.