aggregate_by_aa=True, aa_column_beta=0, count_column=1, v_beta_column=2, j_beta_column=3) AUC = [] Class = [] Method = [] folds = 100 seeds = np.array(range(folds)) for i in range(folds): np.random.seed(seeds[i]) DTCRS.Get_Train_Valid_Test() DTCRS.Train(graph_seed=graph_seed) DTCRS.AUC_Curve(plot=False) AUC.extend(DTCRS.AUC_DF['AUC'].tolist()) Class.extend(DTCRS.AUC_DF['Class'].tolist()) Method.extend(['Sup-Seq-VDJ'] * len(DTCRS.AUC_DF)) df_s = pd.DataFrame() df_s['Class'] = Class df_s['AUC'] = AUC df_s['Method'] = Method df_s['Type'] = 'Supervised' df_comp = pd.concat((df_u, df_s), axis=0) dir_results = 'Sup_V_Unsup_Results' if not os.path.exists(dir_results): os.makedirs(dir_results)
"""Figure 2B""" """This script is used to create the ROC curves for assessing the ability of supervised sequence classifier to correctly predict the antigen-specificity of the 9 murine antigens in the manuscript..""" from DeepTCR.DeepTCR import DeepTCR_SS #Run Supervised Sequence Classifier DTCRS = DeepTCR_SS('Sequence_C') DTCRS.Get_Data(directory='../../Data/Murine_Antigens', Load_Prev_Data=False, aggregate_by_aa=True, aa_column_beta=0, count_column=1, v_beta_column=2, j_beta_column=3) DTCRS.Monte_Carlo_CrossVal(folds=10) DTCRS.AUC_Curve()
from DeepTCR.DeepTCR import DeepTCR_SS, DeepTCR_WF #Train Sequence Classifier DTCR_SS = DeepTCR_SS('Rudqvist') DTCR_SS.Get_Data(directory='../../Data/Rudqvist', Load_Prev_Data=False, aggregate_by_aa=True, aa_column_beta=1, count_column=2, v_beta_column=7, d_beta_column=14, j_beta_column=21) DTCR_SS.Monte_Carlo_CrossVal(folds=100, test_size=0.25) DTCR_SS.AUC_Curve() #Train Repertoire Classifier without on-graph clustering DTCR_WF = DeepTCR_WF('Rudqvist') DTCR_WF.Get_Data(directory='../../Data/Rudqvist', Load_Prev_Data=False, aggregate_by_aa=True, aa_column_beta=1, count_column=2, v_beta_column=7, d_beta_column=14, j_beta_column=21) DTCR_WF.Monte_Carlo_CrossVal(folds=100, LOO=4, epochs_min=50) DTCR_WF.AUC_Curve() #Train Repertoire Classifier with on-graph clustering
of supervised sequence classifier to correctly predict the antigen-specificity of the 9 murine antigens in the manuscript..""" from DeepTCR.DeepTCR import DeepTCR_SS import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rc('font', family='Arial') #Run Supervised Sequence Classifier DTCRS = DeepTCR_SS('Sequence_C', device=2) DTCRS.Get_Data(directory='../../../Data/Murine_Antigens', Load_Prev_Data=False, aggregate_by_aa=True, aa_column_beta=0, count_column=1, v_beta_column=2, j_beta_column=3) folds = 10 seeds = np.array(range(folds)) graph_seed = 0 DTCRS.Monte_Carlo_CrossVal(folds=folds, seeds=seeds, graph_seed=graph_seed) DTCRS.AUC_Curve(xlabel_size=24, ylabel_size=24, xtick_size=18, ytick_size=18, legend_font_size=14, frameon=False, diag_line=False)
folds = 100 LOO = 4 epochs_min = 100 #Train Sequence Classifier DTCR_SS = DeepTCR_SS('Rudqvist_SS') DTCR_SS.Get_Data(directory='../../Data/Rudqvist', Load_Prev_Data=False, aa_column_beta=1, count_column=2, v_beta_column=7, d_beta_column=14, j_beta_column=21) DTCR_SS.Monte_Carlo_CrossVal(folds=folds, test_size=0.25) DTCR_SS.AUC_Curve(filename='AUC.eps') #Train Repertoire Classifier without on-graph clustering DTCR_WF = DeepTCR_WF('Rudqvist_WF') DTCR_WF.Get_Data(directory='../../Data/Rudqvist', Load_Prev_Data=False, aa_column_beta=1, count_column=2, v_beta_column=7, d_beta_column=14, j_beta_column=21) DTCR_WF.Monte_Carlo_CrossVal(folds=folds, LOO=LOO, epochs_min=epochs_min) DTCR_WF.AUC_Curve(filename='Rep_AUC.eps') #Train Repertoire Classifier with on-graph clustering