Beispiel #1
0
def test_diversity_gini2(create_testfolder, metric):
    f = create_testfolder / "test.h5"
    vdj = ddl.read_h5(f)
    vdj.data['sample_id'] = 'sample_test'
    vdj.data['contig_QC_pass'] = '******'
    ddl.update_metadata(vdj,
                        retrieve=['sample_id', 'contig_QC_pass'],
                        split=False)
    ddl.tl.clone_diversity(vdj,
                           groupby='sample_id',
                           resample=True,
                           downsample=6,
                           key='sequence',
                           n_resample=5,
                           metric=metric)
    if metric == 'clone_network' or metric is None:
        assert not vdj.metadata.clone_network_cluster_size_gini.empty
        assert not vdj.metadata.clone_network_vertex_size_gini.empty
    if metric == 'clone_degree':
        assert not vdj.metadata.clone_degree.empty
        assert not vdj.metadata.clone_size_gini.empty
        assert not vdj.metadata.clone_degree_gini.empty
    if metric == 'clone_centrality':
        assert not vdj.metadata.clone_centrality.empty
        assert not vdj.metadata.clone_centrality_gini.empty
Beispiel #2
0
def test_diversity_rarefaction3(create_testfolder):
    f = create_testfolder / "test.h5"
    vdj = ddl.read_h5(f)
    vdj.data['sample_id'] = 'sample_test'
    vdj.data['contig_QC_pass'] = '******'
    ddl.update_metadata(vdj,
                        retrieve=['sample_id', 'contig_QC_pass'],
                        split=False)
    df = ddl.tl.clone_rarefaction(vdj, groupby='sample_id')
    assert isinstance(df, dict)
    p = ddl.pl.clone_rarefaction(vdj, color='sample_id')
    assert p is not None
Beispiel #3
0
def test_diversity2c(create_testfolder):
    f = create_testfolder / "test.h5"
    vdj = ddl.read_h5(f)
    vdj.data['sample_id'] = 'sample_test'
    vdj.data['contig_QC_pass'] = '******'
    ddl.update_metadata(vdj,
                        retrieve=['sample_id', 'contig_QC_pass'],
                        split=False)
    x = ddl.tl.clone_diversity(vdj,
                               groupby='sample_id',
                               key='sequence',
                               update_obs_meta=False)
    assert isinstance(x, pd.DataFrame)
Beispiel #4
0
def test_diversity2b(create_testfolder):
    f = create_testfolder / "test.h5"
    vdj = ddl.read_h5(f)
    vdj.data['sample_id'] = 'sample_test'
    vdj.data['contig_QC_pass'] = '******'
    ddl.update_metadata(vdj,
                        retrieve=['sample_id', 'contig_QC_pass'],
                        split=False)
    ddl.tl.clone_diversity(vdj,
                           groupby='sample_id',
                           use_contracted=True,
                           key='sequence')
    assert not vdj.metadata.clone_network_cluster_size_gini.empty
    assert not vdj.metadata.clone_network_vertex_size_gini.empty
Beispiel #5
0
def test_diversity2a(create_testfolder):
    f = create_testfolder / "test.h5"
    vdj = ddl.read_h5(f)
    vdj.data['sample_id'] = 'sample_test'
    vdj.data['contig_QC_pass'] = '******'
    ddl.update_metadata(
        vdj,
        retrieve=['sample_id', 'contig_QC_pass'],
        retrieve_mode=['merge and unique only', 'merge and unique only'])
    ddl.tl.clone_diversity(vdj,
                           groupby='sample_id',
                           reconstruct_network=False,
                           key='sequence')
    assert not vdj.metadata.clone_network_cluster_size_gini.empty
    assert not vdj.metadata.clone_network_vertex_size_gini.empty
Beispiel #6
0
def test_update_metadata():
    test = ddl.read_h5("tests/test2.h5")
    ddl.update_metadata(test, "sequence_id")
    test.write_h5("tests/test2.h5", compression="bzip2")
    print(test)
Beispiel #7
0
def test_update_metadata():
    test = ddl.read_h5("tests/test.h5")
    ddl.update_metadata(test, "sequence_id")
    print(test)