<jupyter_start><jupyter_text>Calculate surface area<jupyter_code>amount_str = len(glob.glob("data/training/crystal_structs/*.pdb")) 
features_array = np.zeros((amount_str, 3))
surfaces = []
rsas = []

for file in glob.glob("data/training/crystal_structs/*.pdb"): 
    
    p = PDB.PDBParser(QUIET=True)
    s = p.get_structure(file, file) 
    
    structure = freesasa.Structure(file)
    result = freesasa.calc(structure)
    area_classes = freesasa.classifyResults(result, structure)
    
    # save this into numpy sheet result.totalArea() 
    surfaces.append(result.totalArea())
    
    rsa = 0
    for chain in s.get_chains():
        rsa += len([_ for _ in chain.get_residues() if PDB.is_aa(_)])
    
    # save into numpy sheet rsa
    rsas.append(rsa)
surfaces
rsas<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12531017369727046, 'fraction_numerical': 0.0024813895781637717, 'mean_word_length': 3.6379310344827585, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '82263', 'license': 'MIT', 'n_tokens_mistral': 300, 'n_tokens_neox': 291, 'n_words': 53, 'path': 'Calculate_surface.ipynb', 'repo_name': 'carolinelennartsson/cbh21-protein-solubility-challenge', 'size': '806'}