Example #1
0
def test_sample_idx_wrong_length():
    with assert_raises_message(
            ValueError,
            "sample_idx (10) must be the same length as data ({})".format(
                data.shape[0]),
    ):
        build_graph(data, graphtype="mnn", sample_idx=np.arange(10))
Example #2
0
def test_sample_idx_and_precomputed():
    build_graph(
        squareform(pdist(data)),
        n_pca=None,
        sample_idx=np.arange(10),
        precomputed="distance",
        decay=10,
    )
Example #3
0
def test_sample_idx_and_precomputed():
    with assert_raises_message(
            ValueError,
            "MNNGraph does not support precomputed values. Use `graphtype='exact'` and `sample_idx=None` or `precomputed=None`",
    ):
        build_graph(data,
                    n_pca=None,
                    sample_idx=np.arange(10),
                    precomputed="distance")
Example #4
0
def test_build_exact_with_sample_idx():
    with assert_raises_message(
            ValueError,
            "TraditionalGraph does not support batch correction. Use `graphtype='mnn'` or `sample_idx=None`",
    ):
        build_graph(data,
                    graphtype="exact",
                    sample_idx=np.arange(len(data)),
                    decay=10)
Example #5
0
def test_sample_idx_wrong_length():
    build_graph(data, graphtype="mnn", sample_idx=np.arange(10))
Example #6
0
def test_sample_idx_and_precomputed():
    build_graph(data, n_pca=None, sample_idx=np.arange(10), precomputed="distance")
Example #7
0
def test_build_knn_with_sample_idx():
    with assert_raises_message(
            ValueError,
            "kNNGraph does not support batch correction. Use `graphtype='mnn'` or `sample_idx=None`",
    ):
        build_graph(data, graphtype="knn", sample_idx=np.arange(len(data)))
Example #8
0
def test_build_knn_with_sample_idx():
    build_graph(data, graphtype='knn', sample_idx=np.arange(len(data)))
Example #9
0
def test_build_exact_with_sample_idx():
    build_graph(data,
                graphtype='exact',
                sample_idx=np.arange(len(data)),
                decay=10)