biopython 1.78 MarkovModel.train_visible() training_data 是什么类型?

What type is biopython 1.78 MarkovModel.train_visible() training_data?

我想使用 biopython 的 Bio.MarkovModel.train_visible() 训练核苷酸序列的二阶马尔可夫模型。即alphabet=["A","T","G","C"], states=["AA","AT","TT"...]

但是,我得到一个错误:

    474     states_indexes = itemindex(states)
    475     outputs_indexes = itemindex(alphabet)
--> 476     for toutputs, tstates in training_data:
    477         if len(tstates) != len(toutputs):
    478             raise ValueError("states and outputs not aligned")
 ValueError: too many values to unpack (expected 2)

表示可能我给 我试过将我的 training_data 作为一对列表给出:

training_data=(['A','T'...],['AA','AT'...])

以及此列表对的压缩列表:

training_data=[('A','AA'),('T','AT')...]

但无济于事。 training_set 的正确格式是什么? 谢谢!

有关预期输入的示例,请参阅文件 test_MarkovModel.py

>>> from Bio import MarkovModel

>>> states = ["0", "1", "2", "3"]
>>> alphabet = ["A", "C", "G", "T"]
>>> training_data = [
            ("AACCCGGGTTTTTTT", "001112223333333"),
            ("ACCGTTTTTTT", "01123333333"),
            ("ACGGGTTTTTT", "01222333333"),
            ("ACCGTTTTTTTT", "011233333333"),
            ]
>>> markov_model = MarkovModel.train_visible(states, alphabet, training_data)
>>> states = MarkovModel.find_states(markov_model, "AACGTT")
>>> print(states)
[(['0', '0', '1', '2', '3', '3'], 0.008212890625000005)]