nanoporetech / minknow_api

Protobuf and gRPC specifications for the MinKNOW API
Other
50 stars 12 forks source link

How to set initial "bias_voltage" or adapt it during a run? #31

Closed neuropathbasel closed 2 years ago

neuropathbasel commented 2 years ago

Hi! I would like to set the bias voltage when launching a run from the API or - alternatively - use the option connection.device.set_bias_voltage(XXXX) for an ongoing run.

How can I do this? I have tried various ways but think I am not formatting my instruction properly. Any help or hint (in particular where to look into the code of the API) is highly appreciated.

neuropathbasel commented 2 years ago

I found this way, which works in a playback run: connection.device.set_bias_voltage(bias_voltage=-250.0) But I ideally, I would like to set it as I would set it in the MinkNOW UI. Any help is highly appreciated.

0x55555555 commented 2 years ago

Hello @neuropathbasel

The UI allows setting the inital bias voltage, this is the standard way to set this value. If you try to change the value during sequencing the sequencing script may override the settings.

Hope that helps,

image
0x55555555 commented 2 years ago

Sorry, just re reading, if you want to set this when starting an experiment, you can explore the start_protocol.py script, and pass an extra_arg:

--start_bias_voltage 250, for example:

> python start_protocol.py -- --start_bias_voltage 250

This should pass it as an additional argument to the sequencing script and set it as the UI would.

neuropathbasel commented 2 years ago

Hi George,

thanks a lot for your fast reply! This is what I am looking for. However, this seems to fail, and I can find anything like "start_bias_voltage" or "start-bias-voltage" in the python code in this repo.

I'm getting this, if I append --start_bias_voltage 250 to the other (working) parameters, the run won't start and I am getting:

usage:  [-h] [--host HOST] [--port PORT] [--no-tls] [--verbose]
        [--sample-id SAMPLE_ID] [--experiment-group EXPERIMENT_GROUP]
        [--position POSITION] [--flow-cell-id FLOW-CELL-ID] --kit KIT
        [--product-code PRODUCT_CODE] [--basecalling]
        [--basecall-config BASECALL_CONFIG] [--barcoding]
        [--barcode-kits BARCODE_KITS [BARCODE_KITS ...]] [--trim-barcodes]
        [--barcodes-both-ends] [--detect-mid-strand-barcodes]
        [--min-score MIN_SCORE] [--min-score-rear MIN_SCORE_REAR]
        [--min-score-mid MIN_SCORE_MID]
        [--alignment-reference ALIGNMENT_REFERENCE] [--bed-file BED_FILE]
        [--fastq] [--fastq-reads-per-file FASTQ_READS_PER_FILE] [--fast5]
        [--fast5-reads-per-file FAST5_READS_PER_FILE] [--bam]
        [--bam-reads-per-file BAM_READS_PER_FILE]
        [--read-until-reference READ_UNTIL_REFERENCE]
        [--read-until-bed-file READ_UNTIL_BED_FILE]
        [--read-until-filter {deplete,enrich}]
        [--experiment-duration EXPERIMENT_DURATION]
        [--no-active-channel-selection] [--mux-scan-period MUX_SCAN_PERIOD]
        [ARGS [ARGS ...]]
: error: unrecognized arguments: --start-bias-voltage

In analogy to other parameters, I have also changed the "_" to "-", i.e., --start-bias-voltage 250 with the same error as the result.

Am I missing something?

0x55555555 commented 2 years ago

@neuropathbasel what is your full command line - you need to pass this in as an "extra argument", its not one of the standard ones accepted by the example.

note the additional -- in my example above, and here:

>  python start_protocol.py --position "foo" --kit "bar" -- --start_bias_voltage 250

I have verified locally and I dont see the error you refer to, but without the extra -- the argument is passed to the exampel and generates the error you mention.

neuropathbasel commented 2 years ago

Thanks a lot! I had ignored the additional --. Sorry! It works now.