コード例 #1
0
def main():

    focus_cxb, query_cxb, focus_mat, query_mat, markers, outfile, same_algorithm, same_data = parse_args(
    )
    query_id = "%s--%s" % (focus_mat, query_mat)

    focus_cxb = io.read_cell_x_branch(focus_cxb)
    query_cxb = io.read_cell_x_branch(query_cxb)
    focus_mat = io.read_feature_matrix(focus_mat)
    query_mat = io.read_feature_matrix(query_mat)
    markers = io.read_markers(markers)

    distance = dist.trajectory(focus_mat, query_mat, focus_cxb, query_cxb,
                               markers)

    n_genes_in_calc = []
    n_genes_in_markers = []
    for branch in markers.keys():
        n_genes_in_calc += [
            len(set(markers[branch]).intersection(query_mat.columns))
        ]
        n_genes_in_markers += [len(markers[branch])]

    import numpy as np
    with open(outfile, "a") as fout:
        fout.write(
            "%f\t%f\t%f\t%d\t%s\t%s\t%s\n" %
            (distance, np.min(n_genes_in_markers), np.min(n_genes_in_calc),
             len(markers.keys()), same_algorithm, same_data, query_id))
コード例 #2
0
ファイル: test_dist.py プロジェクト: maxgenettiUCSC/cytracepy
def test_trajectory_different_gt_zero():
    answer = trajectory(focus, query, focus_cxb, query_cxb, f_markers_dict)
    assert answer > 0
コード例 #3
0
ファイル: test_dist.py プロジェクト: maxgenettiUCSC/cytracepy
def test_trajectory_self_is_zero():
    answer = trajectory(focus, focus, focus_cxb, focus_cxb, f_markers_dict)
    assert answer == 0
コード例 #4
0
ファイル: test_dist.py プロジェクト: maxgenettiUCSC/cytracepy
def test_trajectory_different_markers_different():
    t1 = trajectory(query, focus, query_cxb, focus_cxb, q_markers_dict)
    t2 = trajectory(focus, query, focus_cxb, query_cxb, f_markers_dict)

    assert t1 != t2
コード例 #5
0
ファイル: test_dist.py プロジェクト: maxgenettiUCSC/cytracepy
def test_trajectory_symmetry():
    """Test for symmetry. Must have same markers.
    """
    t1 = trajectory(query, focus, query_cxb, focus_cxb, q_markers_dict)
    t2 = trajectory(focus, query, focus_cxb, query_cxb, q_markers_dict)
    assert t1 == t2