Using InterOp in Python

Let's learn by example. Throughout this tutorial, we'll walk you through the steps necessary to produce the metrics in various ways found in SAV.


If you do not have the Python InterOp library installed, then you can do the following:

$ pip install interop

Older versions (prior to 1.1.3) can be installed using:

$ pip install -f interop
$ pip install -f interop

Note, only Python versions 3.6 to 3.11 are currently supported as binary builds. Other Python versions must be built from source.

You can then test the install as follows:

$ python -m interop --test

If you see this error:

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa

Then upgrade numpy and try again.

New simplified interface

  from interop import *
  ar = imaging("path/to/run_folder")

See new interop.core wrapper for the simplified interface

Tips & Tricks

  1. To see which methods/fields are available:

    $ dir(python_swig_object_instance)

Introduction to the API

The following is a list of all modulates available in the Python API:

from interop import py_interop_run
from interop import py_interop_metrics
from interop import py_interop_plot
from interop import py_interop_comm
from interop import py_interop_table
from interop import py_interop_run_metrics


This module includes all the C++ classes, exceptions and enums available in


Basic Types

Many of the underlying data structures for InterOp use the std::vector class. These are some basic types made available to Python.

  • string_vector
  • ulong_vector
  • ushort_vector
  • uint_vector
  • float_vector
  • bool_vector
  • uchar_vector
  • read_info_vector


1 from interop import py_interop_run
3 run_info =
6 print("Number of cycles %d" % run_info.total_cycles()

See also:


1 from interop import py_interop_run
2 run_info =
3 try:
5 except py_interop_run.xml_file_not_found_exception as ex:
6  print(ex)

See also:


  • py_interop_run.to_string_XX
  • py_interop_run.parse_XX

where XX can be

  • illumina::interop::constants::metric_type
  • metric_group
  • tile_naming_method
  • dna_bases
  • surface_type
  • instrument_type
  • metric_base_type
  • plot_colors
  • bar_plot_options
  • metric_data
  • metric_feature_type
1 > from interop import py_interop_run
2 > print py_interop_run.FWHM
3 1
4 > print py_interop_run.to_string_metric_type(1)
6 > print py_interop_run.parse_metric_type("FWHM")
7 1
8 > names = py_interop_run.string_vector()
9 > py_interop_run.list_metric_type(names)
10 > print [names[i] for i in range(len(names))]
11 ['Intensity', 'FWHM', 'BasePercent', 'PercentNoCall', 'Q20Percent', 'Q30Percent', 'AccumPercentQ20', 'AccumPercentQ30', 'QScore', 'Clusters', 'ClustersPF', 'ClusterCount', 'ClusterCountPF', 'ErrorRate', 'PercentPhasing', 'PercentPrephasing', 'PercentAligned', 'Phasing', 'PrePhasing', 'CorrectedIntensity', 'CalledIntensity', 'SignalToNoise', 'OccupiedCountK', 'PercentOccupied', 'PercentPF', 'MinContrast', 'MaxContrast', 'SubtilePFPercent', 'SubtileClustersPF', 'SubtileDensityPF', 'SubtileFwhm', 'SubtileQ30Percent', 'SubtileDensity', 'SubtileClusters', 'DistortionByTile', 'EventByCycle', 'EventByType', 'MaxResidualR', 'Theta', 'ThetaZ', 'PercentDemultiplexed', 'MetricTypeCount', 'UnknownMetricType']

See also: