Closed Richie-rider closed 2 weeks ago
Hi,
Hope this helps, Cheers,
Hello! Can you provide the command line code?Thank you very much.
Hi, scripts were run in python IDEs and thus command line code is not available.
Thank you for greate work! I want to use TADA for predictiong AD in the protein of arabidopsis thaliana that possibly function as a co-activatior. However, I don't know how I prepare activation score needed for prediction.py script. I would be happy if you could tell me。
Best regards
Hi, Thanks for your interest! You do not need the activation score to make predictions. We included the activation score as a column in the predictions.py script because we also evaluated the performance of our independent dataset. You can adjust the script according to your data; here is the script using two input columns, labels and sequences.
from Preprocessing import scale_features_predict
from Preprocessing import create_features
from Preprocessing import split_seq
from Model import create_model
import csv
import pandas as pd
import numpy as np
from pickle import dump, load
np.random.seed(1258) # for reproducibility
save_file_path = '../data/predictions/'
if not os.path.exists(save_file_path):
os.mkdir(save_file_path)
with open(save_file_path + 'Evolution_dataset.csv', 'r') as csv_file:
csv_reader = csv.reader(csv_file)
data = []
for i in csv_reader:
data.append([i[0], i[1]])
data.pop(0)
labels = [i[0] for i in data]
sequences = [i[1] for i in data]
'''
Calculate features
'''
# Defines the sequence window size and steps (stride length). Change values if needed.
SEQUENCE_WINDOW = 5
STEPS = 1
LENGTH = 40
features = create_features(sequences, SEQUENCE_WINDOW, STEPS)
features_scaled = scale_features_predict(features)
# Save the features
dump(features_scaled, open(save_file_path + 'features_scaled.pkl', 'wb'))
#When features are already generated - uncomment if needed
#features_scaled = load(open(save_file_path + 'features_TFvalidation.pkl', 'rb'))
'''
Load model
'''
model = create_model(SHAPE = (36, 42))
print('\x1b[2K\tModel created')
model_weights_path = '../data/model-results-notest/checkpoints/'
model.load_weights(model_weights_path + 'tada.14-0.02.hdf5')
print('\x1b[2K\tWeights loaded')
#Make classification predictions
predictions = model.predict(features_scaled)
'''
Save data
'''
data = list(zip(labels, sequences, list(predictions[:,0])))
data = pd.DataFrame(data)
data.columns = ["labels", "sequences", "predictions"]
data.to_csv(save_file_path + "Predictions.csv")
thank you very much!!