<jupyter_start><jupyter_text>*Graph-Sparse* Logistic Regression for sparse recovery of the dysregulated pathways in a synthetic dataset<jupyter_code>%pylab inline
import sys
import pickle
import pandas as pd
import networkx as nx

# Use the following lines to test the basic functionality of the package if developing locally: 
import sys
sys.path.insert(0, "/Users/alex/Documents/OmicsIntegrator2/src")
from graph import *
from gsslr import gsslr

# import OmicsIntegrator as oi

from matplotlib_venn import venn3, venn3_circles, venn2

repo_path = '/Users/alex/Documents/gslr/'
data_path = repo_path + 'experiments/generated_data/3/'
KEGG_path = repo_path + 'experiments/KEGG/KEGG_df.filtered.with_correlates.pickle'
interactome_path = repo_path + 'experiments/algorithms/pcsf/inbiomap_temp.tsv'

pathway_id = 'hsa04110'<jupyter_output>Populating the interactive namespace from numpy and matplotlib<jupyter_text>I. Load Dataset *Index -> class label, column header -> gene symbol*<jupyter_code>dataset = pd.read_csv(data_path + pathway_id + '_inbiomap_exp.csv', index_col=0)
dataset.head()<jupyter_output><empty_output><jupyter_text>II. Prepare interactome<jupyter_code>graph = Graph(interactome_path, {'a':100000000})<jupyter_output>06:25:31 - Graph: INFO - Duplicated edges in the interactome file (we'll keep the max cost):
06:25:31 - Graph: INFO - []<jupyter_text>III. Graph-Sparse Logistic Regression<jupyter_code>class_networks, W_hat, losses = gsslr(graph, dataset)
class_networks
get_networkx_graph_as_dataframe_of_nodes(class_networks[0])
plt.plot(losses)
plt.yscale('log')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09603469640644362, 'fraction_numerical': 0.021065675340768277, 'mean_word_length': 7.197969543147208, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '522902', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 593, 'n_tokens_neox': 562, 'n_words': 129, 'path': 'example/GSLR.ipynb', 'repo_name': 'clemenshug/OmicsIntegrator2', 'size': '1614'}