text_html_output_1.png text_plain_output_1.png
import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import warnings

import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.spatial.distance import squareform
from scipy.cluster.hierarchy import dendrogram, linkage
import warnings
warnings.filterwarnings('ignore')
from scipy.cluster.hierarchy import dendrogram
from sklearn.cluster import AgglomerativeClustering
from matplotlib import pyplot as plt
pro = pd.read_csv('/kaggle/input/amp-parkinsons-disease-progression-prediction/train_proteins.csv')
train = pd.read_csv('/kaggle/input/amp-parkinsons-disease-progression-prediction/train_clinical_data.csv')
test_proteins = pd.read_csv('/kaggle/input/amp-parkinsons-disease-progression-prediction/example_test_files/test_proteins.csv')
pro1 = pro.pivot(index=['visit_id', 'visit_month', 'patient_id'], columns='UniProt', values='NPX').reset_index().rename_axis(None, axis=1)
pro3 = pro1.dropna(thresh=1000, axis=1)
FEATURES_ALL = pro3.iloc[:, 3:].columns.tolist()
pro4 = pro3.dropna()
pro5 = pro4.copy()
for i in FEATURES_ALL:
    pro5.loc[:, i] = (pro4.loc[:, i] - pro4.loc[:, i].mean(axis=0)) / pro4.loc[:, i].std(axis=0)
pro6 = train.merge(pro5, how='left', on='visit_id').dropna(subset=['Q92823']).rename(columns={'patient_id_x': 'patient_id', 'visit_month_x': 'visit_month'})
pro6
pro7 = pro6[pro6['visit_month'] <= 36]
FEATURES_PPI = ['O00584', 'O14773', 'O60888', 'O94919', 'P00441', 'P00734', 'P00736', 'P00738', 'P00746', 'P00747', 'P00748', 'P00751', 'P01008', 'P01009', 'P01011', 'P01023', 'P01024', 'P01033', 'P01344', 'P01621', 'P01717', 'P01834', 'P01857', 'P01859', 'P01860', 'P01876', 'P01877', 'P02452', 'P02652', 'P02656', 'P02679', 'P02747', 'P02749', 'P02750', 'P02751', 'P02753', 'P02760', 'P02763', 'P02765', 'P02766', 'P02768', 'P02787', 'P02790', 'P04004', 'P04156', 'P04180', 'P04196', 'P04207', 'P04211', 'P04216', 'P04217', 'P04275', 'P04433', 'P05067', 'P05090', 'P05155', 'P05156', 'P05546', 'P06681', 'P06727', 'P07195', 'P07225', 'P07339', 'P07711', 'P07858', 'P07998', 'P08294', 'P08493', 'P08697', 'P09486', 'P10451', 'P10643', 'P13521', 'P13611', 'P16070', 'P18065', 'P19652', 'P19823', 'P24592', 'P25311', 'P35542', 'P36222', 'P39060', 'P40925', 'P41222', 'P43251', 'P43652', 'P49908', 'P51884', 'P54289', 'P61626', 'P80748', 'P98160', 'Q13283', 'Q13451', 'Q14118', 'Q14508', 'Q14515', 'Q14624', 'Q16270', 'Q16610', 'Q6UXB8', 'Q7Z5P9', 'Q8IWV7', 'Q8N2S1', 'Q8NBJ4', 'Q92520', 'Q92876', 'Q96PD5', 'Q9BY67', 'Q9NQ79', 'Q9Y646', 'Q9Y6R7']
SUPPLYMENT_FEATURE = ['P00450', 'P10451', 'P01033', 'P01008', 'P02647', 'P01024', 'Q92876']
FEATURES_PPI = list(set(SUPPLYMENT_FEATURE) | set(FEATURES_PPI))
print(len(FEATURES_PPI))
data = pro7[FEATURES_PPI]
corr = data.corr()
corr
adjoint = corr
adjoint