Пример #1
0
 def __init__(self, *args):
     unittest.TestCase.__init__(self, *args)
     fname = "data/test_data/sequences/alignment.fa"
     dl = DataLoader()
     _, self.seq_x, self.ann_x, self.seq_y, self.ann_y = dl.loadSequence(fname)
     self.seq_xs = Fasta.alnToSeq(self.seq_x)
     self.seq_ys = Fasta.alnToSeq(self.seq_y)
Пример #2
0
 def __init__(self, *args):
     unittest.TestCase.__init__(self, *args)
     fname = "data/test_data/sequences/alignment.fa"
     dl = DataLoader()
     _, self.seq_x, self.ann_x, self.seq_y, self.ann_y = dl.loadSequence(
         fname)
     self.seq_xs = Fasta.alnToSeq(self.seq_x)
     self.seq_ys = Fasta.alnToSeq(self.seq_y)
Пример #3
0
def main(preparer_index):
    path_to_data = "data/"
    dp = config.preparers[preparer_index][0](constants.window_size)
    clf_fname = 'data/clf/{}{}{}.clf'.format(
        PairClassifier.get_name(),
        config.preparers[preparer_index][2],
        constants.window_size,
    )
    idp = config.preparers[preparer_index][1](0, constants.window_size)
    iclf_fname = 'data/clf/{}{}{}{}.clf'.format(
        PairClassifier.get_name(),
        config.preparers[preparer_index][2],
        constants.window_size,
        '_indel',
    )
    dl = DataLoader()
    # _, s_x, a_x, s_y, a_y = dl.loadSequence(
    #     path.join(path_to_data, 'sequences/train_sequences/simulated_alignment0.fa'),
    # )

    # x, y, _ = dp.prepare_training_data(s_x, a_x, s_y, a_y)
    # ix, iy, _ = idp.prepare_training_data(s_x, a_x, s_y, a_y)

    # c.fit(x, y)
    # ic.fit(ix, iy)

    _, s_x, a_x, s_y, a_y = dl.loadSequence(
        path.join(
            path_to_data,
            'sequences/model_train_seq/simulated/simulated_alignment.fa'))
    px, py, _ = dp.prepare_training_data(s_x, a_x, s_y, a_y)
    ipx, ipy, _ = idp.prepare_training_data(s_x, a_x, s_y, a_y)

    # plot(*compute_01graph_data(c, x, y))
    # plot(*compute_01graph_data(ic, ix, iy))

    # plot(*compute_01graph_data(c, px, py))
    # plot(*compute_01graph_data(ic, ipx, ipy))
    plot_clf(dp, px, py, clf_fname)
    plt.savefig(path.splitext(clf_fname)[0] + "_test" + pic_suffix,
                transparent=True,
                bbox_inches='tight')
    plot_clf(idp, ipx, ipy, iclf_fname)
    plt.savefig(path.splitext(iclf_fname)[0] + "_test" + pic_suffix,
                transparent=True,
                bbox_inches='tight')
    plt.show()
Пример #4
0
def main(preparer_index):
    path_to_data = "data/"
    dp = config.preparers[preparer_index][0](constants.window_size)
    clf_fname = 'data/clf/{}{}{}.clf'.format(
        PairClassifier.get_name(),
        config.preparers[preparer_index][2],
        constants.window_size,
    )
    idp = config.preparers[preparer_index][1](0, constants.window_size)
    iclf_fname = 'data/clf/{}{}{}{}.clf'.format(
        PairClassifier.get_name(),
        config.preparers[preparer_index][2],
        constants.window_size,
        '_indel',
    )
    dl = DataLoader()
    # _, s_x, a_x, s_y, a_y = dl.loadSequence(
    #     path.join(path_to_data, 'sequences/train_sequences/simulated_alignment0.fa'),
    # )

    # x, y, _ = dp.prepare_training_data(s_x, a_x, s_y, a_y)
    # ix, iy, _ = idp.prepare_training_data(s_x, a_x, s_y, a_y)

    # c.fit(x, y)
    # ic.fit(ix, iy)

    _, s_x, a_x, s_y, a_y = dl.loadSequence(
        path.join(path_to_data, 'sequences/model_train_seq/simulated/simulated_alignment.fa')
    )
    px, py, _ = dp.prepare_training_data(s_x, a_x, s_y, a_y)
    ipx, ipy, _ = idp.prepare_training_data(s_x, a_x, s_y, a_y)

    # plot(*compute_01graph_data(c, x, y))
    # plot(*compute_01graph_data(ic, ix, iy))

    # plot(*compute_01graph_data(c, px, py))
    # plot(*compute_01graph_data(ic, ipx, ipy))
    plot_clf(dp, px, py, clf_fname)
    plt.savefig(
        path.splitext(clf_fname)[0] + "_test" + pic_suffix, transparent=True, bbox_inches='tight'
    )
    plot_clf(idp, ipx, ipy, iclf_fname)
    plt.savefig(
        path.splitext(iclf_fname)[0] + "_test" + pic_suffix, transparent=True, bbox_inches='tight'
    )
    plt.show()