sidhomj / DeepTCR

Deep Learning Methods for Parsing T-Cell Receptor Sequencing (TCRSeq) Data
https://sidhomj.github.io/DeepTCR/
MIT License
113 stars 40 forks source link

'LabelEncoder' object has no attribute 'classes_' when loading own data #25

Closed GBeattie closed 4 years ago

GBeattie commented 4 years ago

Hey,

I've managed to load my own data, however having trouble training the VAE (which works on the training dataset).

Code so far:

from DeepTCR.DeepTCR import DeepTCR_U
import pandas as pd
import numpy as np
DeepTCR_input = pd.read_csv('/Users/gordonbeattie/Documents/Projects/Maria_2/TCR/DeepTCR/DeepTCR_input.tsv', sep= '\t')

alpha = np.genfromtxt(DeepTCR_input.TRA, dtype='str')
beta = np.genfromtxt(DeepTCR_input.TRB, dtype='str')
sample = np.genfromtxt(DeepTCR_input.sample_ID, dtype='str')

DTCRU.Load_Data(alpha_sequences=alpha,beta_sequences=beta, sample_labels=sample)

DTCRU.Train_VAE(Load_Prev_Data=False)

Which throws the following error: AttributeError: 'LabelEncoder' object has no attribute 'classes_'

Thanks in advance for any assistance!

sidhomj commented 4 years ago

So I tried to replicate this problem on my own. With the script below. One thing I noticed is the declaration of the DeepTCR object. I don't see where you create the DTCRU object. It seems like you may have had another object open that carried some parameters from another analysis?

from DeepTCR.DeepTCR import DeepTCR_U
import pandas as pd
import numpy as np
DTCRU = DeepTCR_U('name')
DTCRU.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)
beta = DTCRU.beta_sequences
sample = DTCRU.sample_id

DTCRU2 = DeepTCR_U('name2')
DTCRU2.Load_Data(beta_sequences=beta, sample_labels=sample)
DTCRU2.Train_VAE(Load_Prev_Data=False)
GBeattie commented 4 years ago

Thanks! yes that was the issue, I had the object open from the tutorial, working now.