data = pd.read_csv('/Users/Frankie/Documents/Dissertation/Data/pancreatic/24hProbeExpressionValues.csv')
data[:5]

"""
Explanation: Read in the data..
End of explanation
"""


data = data.T

"""
Explanation: The columns are the instances and rows the features so we need to transpose the dataset.
End of explanation
"""


label = pd.read_csv('/Users/Frankie/Documents/Dissertation/Data/pancreatic/24hTargets.csv')

label[:5]

"""
Explanation: Read in the labels...
End of explanation
"""


label = label[['FileName', 'OAC']]
label[:5]

"""
Explanation: We are using the OAC labeling...
End of explanation
"""


joined_tables = label.join(data, on='FileName', how = 'outer')
joined_tables = joined_tables[pd.notnull(joined_tables['Probe1'])]
joined_tables['label'] = np.where(joined_tables['OAC']=='Mild', 0, 1)
joined_tables[:5]

"""
Explanation: Join the data and labels on the FileName, remove any null rows and create a label column with 0s and 1s.
End of explanation
"""


joined_tables.drop(['FileName','OAC'], axis=1).to_csv("/Users/Frankie/Desktop/pancreatic.csv",index=False)

"""
Explanation: Drop the FileName and OAC columns and export as a CSV file.
End of explanation
"""


