nanoporetech / megalodon

Megalodon is a research command line tool to extract high accuracy modified base and sequence variant calls from raw nanopore reads by anchoring the information rich basecalling neural network output to a reference genome/transriptome.
Other
197 stars 30 forks source link

pyguppyclient raised Except("Bad request") #44

Closed madnessfish closed 4 years ago

madnessfish commented 4 years ago

Hi there,

I have encountered some difficulties while using megalodon with rerio model for DRS reads. I am not sure if I have done something wrong. THank you so much!

Software Version Guppy Basecall Service Software, (C) Oxford Nanopore Technologies, Limited. Version 4.0.14+8d3226e, client-server API version 2.1.0 Megalodon version: 2.1.1

Command used megalodon /exeh_2/sin/data/nanopore/20200601_1610_X1_FAL11238_37c3c671/fast5_pass/FAL11238_pass_acd71f2d_21.fast5 --rna --guppy-server-path /exeh_2/sin/bin/ont-guppy-cpu/bin/guppy_basecall_server --guppy-params "-d /exeh_2/sin/bin/rerio/basecall_models/" --guppy-config res_rna2_r941_min_flipflop_v001.cfg --processes 20 --outputs mod_mappings --mappings-format bam --reference /exeh_2/sin/references/Homo_sapiens.GRCh38.dna_sm.primary_assembly.fa

Error raised [21:47:24] Loading guppy basecalling backend. Traceback (most recent call last): File "/exeh_2/sin/bin/miniconda3/envs/megalodon/bin/megalodon", line 11, in sys.exit(_main()) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/main.py", line 361, in _main megalodon._main(args) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/megalodon.py", line 1071, in _main with backends.ModelInfo(backend_params, args.processes) as model_info: File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/backends.py", line 418, in init self._load_pyguppy() File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/backends.py", line 409, in _load_pyguppy set_pyguppy_model_attributes() File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/backends.py", line 371, in set_pyguppy_model_attributes init_client.connect() File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/pyguppyclient/client.py", line 73, in connect config = self._load_config(self.config_name) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/pyguppyclient/client.py", line 95, in _load_config loaded_configs = {Config(c).name: Config(c) for c in self.get_configs()} File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/pyguppyclient/client.py", line 91, in get_configs res = self.send(SimpleRequestType.GET_CONFIGS) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/pyguppyclient/client.py", line 55, in send return simple_response(self.recv()) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/pyguppyclient/ipc.py", line 103, in simple_response raise Exception("Bad request") Exception: Bad request

marcus1487 commented 4 years ago

Guppy 4.0 introduced some breaking changes to the basecaller client API. Megalodon provides preliminary support via a pre-release of pyguppyclient package (see versions here). If you could install this pre-release by explicitly specifying this pre-release version you should be able to use Megalodon with Guppy 4.0+.

AAnnan commented 4 years ago

As explained by @marcus1487, and here, running this pip install git+https://github.com/nanoporetech/megalodon@guppy_client should get rid of your error.

madnessfish commented 4 years ago

Thank you so much @marcus1487 and @AAnnan . I have installed the pre-release of pyguppyclient package from source code. I have checked the installation and test case for pyguppyclient. Everything seems alright. However, a new problem arises while running megalodon.

Command megalodon /exeh_2/sin/data/nanopore/20200601_1610_X1_FAL11238_37c3c671/fast5_pass/FAL11238_pass_acd71f2d_21.fast5 --rna --guppy-server-path /exeh_2/sin/bin/ont-guppy-cpu/bin/guppy_basecall_server --guppy-params "-d /exeh_2/sin/bin/rerio/basecall_models/" --guppy-config res_rna2_r941_min_flipflop_v001.cfg --processes 20 --outputs mod_mappings --mappings-format bam --reference /exeh_2/sin/references/Homo_sapiens.GRCh38.dna_sm.primary_assembly.fa

[23:28:56] Loading guppy basecalling backend. Traceback (most recent call last): File "/exeh_2/sin/bin/miniconda3/envs/megalodon/bin/megalodon", line 11, in sys.exit(_main()) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/main.py", line 361, in _main megalodon._main(args) File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/megalodon.py", line 1071, in _main with backends.ModelInfo(backend_params, args.processes) as model_info: File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/backends.py", line 418, in init self._load_pyguppy() File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/backends.py", line 409, in _load_pyguppy set_pyguppy_model_attributes() File "/exeh_2/sin/bin/miniconda3/envs/megalodon/lib/python3.7/site-packages/megalodon/backends.py", line 369, in set_pyguppy_model_attributes retries=self.pyguppy_retries) TypeError: init() takes 1 positional argument but 2 were given

marcus1487 commented 4 years ago

This looks to be a change in the pyguppyclient interface. I would suggest for now that you downgrade to guppy 3.6.1. The method on the README (also suggested by @AAnnan) should work as this bypasses the pyguppyclient library, but has not been extensively tested either. An attempt to more completely address these issues should be included in the next release.

madnessfish commented 4 years ago

Thank you so much! The original problem is solved by the method on README!

I have encountered another problem regarding model selection. The megalodon README has mentioned, "no RNA modified base models are currently released for general use". I have tried to use the RNA model from rerio res_rna2_r941_min_flipflop_v001.cfg. However, it gives the following error.

ERROR: per_read_mods output requested, but specified model does not support calling modified bases.

Does this mean I have to use some DNA modification model for RNA direct seq modifications mapping? Any recommendation for RNA modification models?

marcus1487 commented 4 years ago

A DNA modification model will not work on RNA data. The signals are fundamentally different and thus not compatible. Megalodon is programmed to accept RNA modified base models, but a model to specifically detect RNA modified bases is not available at this time.

The Tombo package is the current recommendation for investigating RNA modified bases at this time, though this detection is not specific and the best results are generally obtained by comparison to a control sample.

It sounds as though the main issue in this thread has been addressed. If there are further issues please raise these in a new issue thread.

jon-xu commented 2 years ago

Hi Marcus, I met the same issue "per_read_mods output requested, but specified model does not support calling modified bases". We are trying to use megalodon to prepare the training data before we train the model using taiyaki. We are working on direct RNA samples and trying to detect pseudouridine modifications.

Do you have any advice how we should proceed, please? Thanks, Jon