minknow_api icon indicating copy to clipboard operation
minknow_api copied to clipboard

minknow_api.examples.manage_simulated_devices does not enable adding a Flongle

Open patbohn opened this issue 2 years ago • 2 comments

Hi,

First, I want to thank you for having this powerful API Open Source. It enables so many cool use cases! However, we realized that while it would be possible to replay previously recorded batch files from MinIon flow cells by addition of a simulated MinIon, there is currently no implementation to add a Flongle Adapter, and so batch files from Flongle sequencing runs cannot be replayed without having a real Minion + Flongle adapter plugged into the computer. Specifically, when attempting to replay a Flongle batch file on a Minion position, the error in the bream log is:

[bream4.toolkit.procedure_components.command.phase_management: 186] - 2023-11-23 11:06:14,919 -    ERROR - 
Traceback (most recent call last):
  File "C:\Program Files\OxfordNanopore\MinKNOW\conf\package\sequencing\sequencing.py", line 581, in <module>
    sys.exit(main(config=args.config))
  File "C:\Program Files\OxfordNanopore\MinKNOW\conf\package\sequencing\sequencing.py", line 515, in main
    setup_playback(device, settings["simulation"])
  File "C:\Program Files\OxfordNanopore\MinKNOW\ont-python\lib\site-packages\bream4\utility\simulation.py", line 49, in setup_playback
    device.connection.device.set_calibration(
  File "C:\Program Files\OxfordNanopore\MinKNOW\ont-python\lib\site-packages\minknow_api\device_service.py", line 610, in set_calibration
    return run_with_retry(self._stub.set_calibration,
  File "C:\Program Files\OxfordNanopore\MinKNOW\ont-python\lib\site-packages\minknow_api\device_service.py", line 97, in run_with_retry
    result = MessageWrapper(method(message, timeout=timeout), unwraps=unwraps)
  File "C:\Program Files\OxfordNanopore\MinKNOW\ont-python\lib\site-packages\grpc\_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "C:\Program Files\OxfordNanopore\MinKNOW\ont-python\lib\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.INVALID_ARGUMENT
	details = "last_channel must be 512"

Could you add the ability to add a simulated Flongle position?

Thank you in advance!

patbohn avatar Nov 23 '23 12:11 patbohn

For anyone who really wants to be able to replay Flongle data, the workaround I have been using is patching Minknow itself. In particular, inserting this code here to MinKNOW\ont-python\Lib\site-packages\bream4\utility\simulation.py at line 34.

    if len(calibration) < len(device.get_channel_list()):
        device.logger.info("Replaying Flongle data. Adding empty calibrations.")
        for channel in device.get_channel_list():
            if channel not in calibration:
                calibration[channel] = (0, 2048)

patbohn avatar Nov 05 '24 11:11 patbohn

Thanks man. You saved my life

For anyone who really wants to be able to replay Flongle data, the workaround I have been using is patching Minknow itself. In particular, inserting this code here to MinKNOW\ont-python\Lib\site-packages\bream4\utility\simulation.py at line 34.

if len(calibration) < len(device.get_channel_list()):
    device.logger.info("Replaying Flongle data. Adding empty calibrations.")
    for channel in device.get_channel_list():
        if channel not in calibration:
            calibration[channel] = (0, 2048)

Strexas avatar Jun 03 '25 10:06 Strexas