label_correction

In [ ]:

    import anndata as ad
    import ACTIONet as anet

In [ ]:

    %load_ext autoreload
    %autoreload 2
    %aimport ACTIONet

In [ ]:

    adata = ad.read_h5ad("../data/pfc5k_ACTIONet_v2_python.h5ad")

In [ ]:

    anet.pl.plot_ACTIONet(adata, "Celltype")

Out[ ]:

    <AxesSubplot:title={'center':'__annotations__'}, xlabel='actionet2d1', ylabel='actionet2d2'>

In [ ]:

    import numpy as np

    from random import sample
    l = adata.obs["Celltype"].copy()
    perm = sample(list(np.arange(adata.shape[0])), 3000)
    l[perm] = None

In [ ]:

    anet.pl.plot_ACTIONet(adata, l)

Out[ ]:

    <AxesSubplot:title={'center':'__annotations__'}, xlabel='actionet2d1', ylabel='actionet2d2'>

In [ ]:

    l2 = anet.po.cells.infer_missing_labels(adata, initial_labels=l, return_raw=True)

In [ ]:

    anet.pl.plot_ACTIONet(adata, l2)

Out[ ]:

    <AxesSubplot:title={'center':'__annotations__'}, xlabel='actionet2d1', ylabel='actionet2d2'>

In [ ]:

    l3 = anet.po.cells.correct_labels(adata, initial_labels="Celltype", return_raw=True)

In [ ]:

    anet.pl.plot_ACTIONet(adata, l3)

Out[ ]:

    <AxesSubplot:title={'center':'__annotations__'}, xlabel='actionet2d1', ylabel='actionet2d2'>