from pymol import cmd, stored
import matplotlib.pyplot as plt
import os

def calculate_average_sasa():
    sasa_files = os.listdir('sasa_pdbs/') # gets filenames in sasa files directory    
    average_sasa = {} # dictionary mapping residue name to average sasa 

    ############################################################################

    ############################################################################
    plt.bar(average_sasa.keys(), average_sasa.values())
    plt.xlabel('Amino Acid Residue Type')
    plt.ylabel('Average SASA')
    plt.title('Average Solvent Accessible Surface Area (SASA) for each Amino Acid Residue Type')
    plt.xticks(rotation=45)
    plt.tight_layout()
    plt.show()


cmd.extend('calculate_average_sasa', calculate_average_sasa)