nanoporetech / minknow_api

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

How to get alignment info which is used in latest version of Minknow for visualzation of guppy real time alignment #10

Open alartin opened 4 years ago

alartin commented 4 years ago

Hi, I would like to retrieve more info like alignemnt info as the visualization of guppy alignment in latest version of Minknow via minknow_api. I assume ideally that the design of Minknow follows the SoC (Separation of Concern) which makes Minknow GUI also access data via minknow_api, kind of 'eat your own dog food'. While I couldn't find such info in the code, maybe I miss something. Could someone help me on that? BTW, I am working on the integration some metrics to our own application and thanks a lot in advance.

0x55555555 commented 4 years ago

Hi @alartin ,

The method to stream acquisition output is: https://github.com/nanoporetech/minknow_api/blob/master/proto/minknow_api/statistics.proto#L26,

To get information about alignments, you specifically need to setup split in the request so that alignment_reference = true - this will provide separate stream information about each alignment reference.

Something like:


stream = device.rpc.statistics.stream_acquisition_output(
    acquisition_run_id=run_id,
    data_selection=DataSelection(step=60),
    split=AcquisitionOutputSplit(alignment_reference=True)
)

for filter_groups in stream:
    for filter_group in filter_groups.buckets:
        print("info for %s" % filter_group.filtering)

        for bucket in filter_group.buckets:
            print("info for experiment time %s seconds" % bucket.bucket)
            print("passed reads aligned: %s" % bucket.yield_summary.basecalled_pass_read_count)

We will look at formalising this into an example for a future release.

alartin commented 4 years ago

Hi @jorj1988 , Thanks for quick response. I will figure it out about your code and am looking forward to more examples, test data sets, docs about the api. One more thing I would like to know is that if there is any mock server instance can be used for all the functions without any live device considering the cost. Thanks!

alartin commented 4 years ago

@jorj1988 , I have another question which is not related to this issue but is in my mind for quite a while. When we sequence our pooled/mixed samples with barcodes, I wonder how can we link sample ids rather than just barcode name/id after guppy demultiplexing. Is there any way to let lab techinican to input sample ids (might be generated by external LIMS) and corressponding barcodes relation so that sample ids can be used in downstream analysis. Maintaining such meta info outside is not straightforward. Thanks!

0x55555555 commented 4 years ago

@alartin,

On the first question - take a look at the tests in the repo: https://github.com/nanoporetech/minknow_api/blob/master/python/test/example_tests/test_minknow_server.py - they boot up a python mock server.

On the second issue - were looking at this for a future release, it should be possible soon.

Thanks,