#!/usr/bin/env python

"""
Get the conservation scores for the test data.
"""

import pandas as pd
from utils import get_cons_scores


#
# Load the submission data
#
submission_file = 'data/5_saturation_mutagenesis_SubmissionTemplate_01.txt'
print('Loading {}'.format(submission_file))
submission = pd.read_csv(submission_file, sep='\t').rename(columns={'Chrom': '#Chrom'})
print(submission.sample(6))


#
# Get the conservation scores
#
print('Getting conservation scores.')
ph_scores, php_scores, gerpn_scores, gerprs_scores = get_cons_scores(submission)
submission['phastCon'] = ph_scores
submission['phyloP'] = php_scores
submission['GerpN'] = gerpn_scores
submission['GerpRS'] = gerprs_scores


#
# Save the scores
#
cons_file = 'data/submission-with-cons.tsv'
print('Saving conservation scores to {}'.format(cons_file))
submission.rename(columns={'#Chrom': 'Chrom'}).to_csv(cons_file , sep='\t', index=False)
