Run hHMM in tMAVEN script mode

The following is a script example for apply a hierarchical HMM (hHMM) in tMAVEN. The algorithm used is translated into Python from the MATLAB version described in: Hon, J., and Gonzalez, R.L., Jr., Bayesian-estimated hierarchical HMMs enable robust analysis of single-molecule kinetic heterogeneity. Biophysical Journal. 116, 1790-1802 (2019).

from tmaven.app import setup_maven

#### Analyze data with hHMM
## Make a new MAVEN instance
maven  = setup_maven(['--log_stdout'])

## Load data
maven.io.load_smdtmaven_hdf5('example_smd.hdf5','L1-tRNA')

## Turn on only the first 10 trajectorys
maven.data.flag_ons*=False
maven.data.flag_ons[:10]+=True

# Specify the model parameters
maven.prefs['modeler.hhmm.restarts'] = 4
maven.prefs['modeler.hhmm.maxiters'] = 100
maven.prefs['modeler.hhmm.tolerance'] = 1e-4


## Run 2xw hHMM
maven.modeler.run_fret_hhmm()


# Export
oname = 'result_hhmm.hdf5'
maven.modeler.export_result_to_hdf5(oname)

This script runs a two-level two-state hHMM. Integrating this into the tMAVEN GUI, along with interface options to specify and customize the tree structure of the hHMM applied to the data, is currently a work in progress.