<jupyter_start><jupyter_text>Disruptive Interactions For Each PatientFor each patient, disruptive predicted interactions will be displayed.**Example*** `TCGA-XXXX-XXXX-XX`:<jupyter_code>import os
import os.path as op

os.chdir('../')

# os.listdir()
from helpers.helpers_analysis.interactions_per_patient import InteractionsPerPatient
from helpers.helpers_analysis.get_patient_protein_to_mutations_dict import get_patient_protein_to_mutations_dict

BRCA_PREDICTION_ID = "632d9021/"
BRCA_PREDICTIONS_COMMON_PATH = "../data/predictions_datasets/brca_prediction_2021-10-26/" + BRCA_PREDICTION_ID
PREDICTION_BRCA_REDUCED_PATH = BRCA_PREDICTIONS_COMMON_PATH + "predictions_soft_2021-10-26.csv"

ESCA_PREDICTION_ID = "e07649d3/"
ESCA_PREDICTIONS_COMMON_PATH = "../data/predictions_datasets/esca_prediction_2021-11-02/" + ESCA_PREDICTION_ID
PREDICTION_ESCA_REDUCED_PATH = ESCA_PREDICTIONS_COMMON_PATH + "predictions_soft_2021-11-02.csv"

OV_PREDICTION_ID = "858bbf95/"
OV_PREDICTIONS_COMMON_PATH = "../data/predictions_datasets/ov_prediction_2021-10-26/" + OV_PREDICTION_ID
PREDICTION_OV_REDUCED_PATH = OV_PREDICTIONS_COMMON_PATH + "predictions_soft_2021-10-26.csv"

SNV_COMMON_PATH = "C:/Users/ibrah/Desktop/SNV_data/SNV_datasets/"
BRCA_SNV_PATH = op.join(SNV_COMMON_PATH, "SNV_BRCA_hg38_2021-09-22.csv")
ESCA_SNV_PATH = op.join(SNV_COMMON_PATH, "SNV_ESCA_hg38_2021-09-22.csv")
OV_SNV_PATH = op.join(SNV_COMMON_PATH, "SNV_OV_hg38_2021-09-22.csv")

# Reflect changes in the modules immediately.
%load_ext autoreload
%autoreload 2<jupyter_output><empty_output><jupyter_text>BRCA  Instantiate the Class `InteractionsPerPatient`<jupyter_code>brca_interactions_per_patient = InteractionsPerPatient(
    tcga="BRCA",
    prediction_data_path=PREDICTION_BRCA_REDUCED_PATH,
    tcga_snv_path=BRCA_SNV_PATH,
    identifier="uniprot",
    verbose=False,
)
brca_interactions_per_patient.print_disruptive_interactions_per_patient()
brca_interactions_per_patient.construct_analysis_table()
brca_interactions_per_patient.analysis_table.head()
df = brca_interactions_per_patient.analysis_table.copy()
df[df["PROTEIN_GENE"].str.contains("UBA6")]
brca_interactions_per_patient.extract(folder="dev")<jupyter_output>2021-11-02 12:00:56 |[33m WARNING  [0m| helpers.helpers_analysis.interactions_per_patient | File dev\BRCA_patient_interactions_analysis_table_2021-11-02.xlsx is already exist.<jupyter_text>ESCA  Instantiate the Class `InteractionsPerPatient`<jupyter_code>esca_interactions_per_patient = InteractionsPerPatient(
    tcga="ESCA",
    prediction_data_path=PREDICTION_ESCA_REDUCED_PATH,
    tcga_snv_path=ESCA_SNV_PATH,
    identifier="uniprot",
    verbose=False,
)
esca_interactions_per_patient.print_disruptive_interactions_per_patient()
esca_interactions_per_patient.construct_analysis_table()
esca_interactions_per_patient.analysis_table.head()
esca_interactions_per_patient.extract(folder="dev")<jupyter_output>2021-11-02 12:05:26 |[32m INFO     [0m| helpers.helpers_analysis.interactions_per_patient | dev\ESCA_patient_interactions_analysis_table_2021-11-02.xlsx is exported.<jupyter_text>OV  Instantiate the Class `InteractionsPerPatient`<jupyter_code>ov_interactions_per_patient = InteractionsPerPatient(
    tcga="OV",
    prediction_data_path=PREDICTION_OV_REDUCED_PATH,
    tcga_snv_path=OV_SNV_PATH,
    identifier="uniprot",
    verbose=False,
)
ov_interactions_per_patient.print_disruptive_interactions_per_patient()
ov_interactions_per_patient.construct_analysis_table()
ov_interactions_per_patient.analysis_table.head()
ov_interactions_per_patient.extract(folder="dev")<jupyter_output>2021-11-02 12:07:16 |[32m INFO     [0m| helpers.helpers_analysis.interactions_per_patient | dev\OV_patient_interactions_analysis_table_2021-11-02.xlsx is exported.<jupyter_text>---<jupyter_code>brca_interactions_per_patient.analysis_table[
    brca_interactions_per_patient.analysis_table["PROTEIN_GENE"].str.contains("UBA6")
]
ov_interactions_per_patient.analysis_table.sample()
ov_interactions_per_patient.get_disruptive_interactors("Q9NQ66", "E539K")
ov_prediction_data = ov_interactions_per_patient.prediction_data
ov_prediction_data[
    (ov_prediction_data["UniProt_ID"] == "Q9NQ66") &
    (ov_prediction_data["Mutation"] == "E539K")
]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09587435536802626, 'fraction_numerical': 0.04360056258790436, 'mean_word_length': 9.407317073170733, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '232869', 'license': 'MIT', 'n_tokens_mistral': 1756, 'n_tokens_neox': 1627, 'n_words': 151, 'path': 'src/dev/fixed/disruptive_interactions_per_patient-fix1.ipynb', 'repo_name': 'ibrahimberb/Predicting-Mutation-Effects', 'size': '4266'}