Esempio n. 1
0
def process(model_file, sequence_file, window_size):
    model = json.loads(model_file.read())
    model_file.close()

    header, sequence = utils.load(sequence_file)
    sequence_file.close()

    print(header)
    hmm = HMM(**model['model'])

    subsequences = utils.prepare_subsequences(sequence, window_size)

    decoded = ''
    for seq in subsequences:
        decoded += ''.join(hmm.decode(seq)[1])
        print('{} / {}'.format(len(decoded), 3 * len(sequence)), file=sys.stderr)

    lines = utils.prepare_subsequences(decoded, 80)
    for l in lines:
        print(l)