Ejemplo n.º 1
0
def test_run_outliers_comps():
    with open("tests/pidgin_example.pickle", "rb") as fh:
        df, annotations, outliers, fractable, qvalues = pickle.load(fh)

    test_outliers, test_qvals = bsh.deva(df, annotations)
    assert sum(
        annotations.columns.sort_values() != test_qvals.comps.sort_values()
    ) == 0
Ejemplo n.º 2
0
def test_run_outliers_fracTable():
    with open("tests/pidgin_example.pickle", "rb") as fh:
        df, annotations, outliers, fractable, qvalues = pickle.load(fh)

    test_outliers, test_qvals = bsh.deva(df, annotations)
    fractable = fractable.sort_index().sort_index(axis=1)
    test_outliers.frac_table = test_outliers.frac_table.sort_index(
    ).sort_index(axis=1)
    assert fractable.equals(test_outliers.frac_table)
Ejemplo n.º 3
0
def test_run_outliers_qvals():
    with open("tests/pidgin_example.pickle", "rb") as fh:
        df, annotations, outliers, fractable, qvalues = pickle.load(fh)

    _, test_qvals = bsh.deva(df, annotations)
    test_qvals.df = test_qvals.df.sort_index().sort_index(axis=1)
    qvalues = qvalues.sort_index().sort_index(axis=1)

    assert qvalues.equals(test_qvals.df)
Ejemplo n.º 4
0
#https://towardsdatascience.com/how-to-program-umap-from-scratch-e6eff67f55fe
from umap import UMAP
plt.figure(figsize=(20,15))
model = UMAP(n_neighbors = 15, min_dist = 0.25, n_components = 2, verbose = True)
umap = model.fit_transform(X_train)
plt.scatter(umap[:, 0], umap[:, 1], c = y_train.astype(int), cmap = 'tab10', s = 50)

#https://github.com/ruggleslab/blackSheep
import blacksheep
annotations = blacksheep.binarize_annotations(sample_labels)

# Run outliers comparative analysis
outliers, qvalues = blacksheep.deva(
    values, annotations,
    save_outlier_table=True,
    save_qvalues=True,
    save_comparison_summaries=True
)

# Pull out results
qvalues_table = qvalues.df
vis_table = outliers.frac_table

# Make heatmaps for significant genes
for col in annotations.columns:
    axs = blacksheep.plot_heatmap(annotations, qvalues_table, col, vis_table, savefig=True)
#https://github.com/ruggleslab/blacksheep_supp/blob/dev/vignettes/running_outliers.ipynb
# Normalize values
phospho = blacksheep.read_in_values('') #Fill in file here
protein = blacksheep.read_in_values('') #Fill in file here