Illumina / interop

C++ Library to parse Illumina InterOp files
http://illumina.github.io/interop/index.html
GNU General Public License v3.0
75 stars 26 forks source link

Extract metrics by cycle with python #265

Closed rpwang closed 3 years ago

rpwang commented 3 years ago

Hi,

I was wondering if it was possible to get some metrics out by each cycle using Python? I would like to extract datapoints similar from plot_by_cycle script.

Thanks rp

sklages commented 3 years ago

Well, you can use the new "simpified python interface" to read the imaging table ..

import interop as iop

run_metrics = iop.read(run_folder)

def read_imaging_table(run_metrics):
    ar = iop.imaging(run_metrics)
    df = pd.DataFrame(ar)

    # some values should be integers
    change_data_type = {
        'Lane'             : int,
        'Tile'             : int,
        'Tile Number'      : int,
        'Read'             : int,
        'Cycle'            : int,
        'Cycle Within Read': int,
        'Swath'            : int,
        'Surface'          : int
    }

    return df.astype(change_data_type)

and then plot the data accordingly. See http://illumina.github.io/interop/namespacecore.html#ab181cd004c7d8d415c5fb0b5a50f3dac

rpwang commented 3 years ago

Hi sklages,

This is what I need and thanks for the links to the docs!