<jupyter_start><jupyter_text><jupyter_code># Need to reassess function arguments
def chimerax_commands(filename, del_chain, output_filename):
    '''Generate chimerax commands for analysis of Biostructmap data file

    applies electrostatic molecular view, colours bfactor with rainbow palette
    and saves 3 screenshots of the front, side and top of the protein.

    Args:
        filename: file path to biostructmap.pdb data.
        del_chain: chains to be deleted from structure.
        output_filename: filneame of images.
    Returns:
        str: A string of commands to write to script file.
    '''
    # need to redo camera and model matrix coordinates when using new ref pdb

    chimerax_str = (f'close\n'
                    f'log clear\n'
                    f'cd C:\\Users\\talga\\OneDrive\\Documents\\Honours\\Honours_Project\\Project_Data\\Biostructnap_pdb_files_swissmodel\n' # pdb file location
                    f'open {filename}\n'
                    f'delete /{del_chain}\n'
                    f'coulombic\n'
                    f'set bgColor white\n'
                    f'color bfactor protein range 0,15 palette rainbow\n'
                    f'view matrix camera -0.20034,-0.031773,0.97921,849.6,-0.97916,0.040513,-0.19902,61.399,-0.033348,-0.99867,-0.039227,178.01\n'
                    f'view matrix model #1,1,0,0,0,0,1,0,0,0,0,1,0,#1.1,1,0,0,0,0,1,0,0,0,0,1,0,#1.2,1,0,0,0,0,1,0,0,0,0,1,0,#1.3,1,0,0,0,0,1,0,0,0,0,1,0\n'
                    f'save C:\\Users\\talga\\Desktop\\{output_filename}(front).png supersample 3\n'
                    f'turn 90,0,0\n'
                    f'save C:\\Users\\talga\\Desktop\\{output_filename}(top).png supersample 3\n'
                    f'view matrix camera 0.66935,0.042026,0.74176,704.86,-0.74282,0.018899,0.66923,638.11,0.014106,-0.99893,0.043868,233.55\n'
                    f'view matrix model #1,1,0,0,0,0,1,0,0,0,0,1,0,#1.1,1,0,0,0,0,1,0,0,0,0,1,0,#1.2,1,0,0,0,0,1,0,0,0,0,1,0,#1.3,1,0,0,0,0,1,0,0,0,0,1,0\n'
                    f'save C:\\Users\\talga\\Desktop\\{output_filename}(side).png supersample 3\n'
                    )
    return chimerax_str

data_files = ['01biostructmap_diversity_dec_2019(21.12.2019-31.12.2019).pdb', 
              '02biostructmap_diversity_jan_2020.pdb', 
              '03biostructmap_diversity_feb_2020.pdb',
              '04biostructmap_diversity_mar_2020.pdb',
              '05biostructmap_diversity_apr_2020.pdb',
              '06biostructmap_diversity_may_2020.pdb',
              '07biostructmap_diversity_jun_2020.pdb',
              '08biostructmap_diversity_jul_2020.pdb',
              '09biostructmap_diversity_aug_2020.pdb',
              '10biostructmap_diversity_sep_2020.pdb',
              '11biostructmap_diversity_oct_2020.pdb',
              '12biostructmap_diversity_nov_2020.pdb',
              '13biostructmap_diversity_dec_2020.pdb',
              '14biostructmap_diversity_jan_2021.pdb',
              '15biostructmap_diversity_feb_2021.pdb',
              '16biostructmap_diversity_mar_2021.pdb',
              '17biostructmap_diversity_apr_2021.pdb',
              '18biostructmap_diversity_may_2021.pdb',
              '19biostructmap_diversity_jun_2021.pdb',]

with open('./create_chimerax_images.cxc', 'w') as f:
        for data_file in data_files:
            out_filename_prefix = data_file.replace('.pdb', '')
            f.write(chimerax_commands(data_file, 'D', out_filename_prefix))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12788018433179724, 'fraction_numerical': 0.11405529953917051, 'mean_word_length': 2.4904522613065327, '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': '401924', 'license': 'MIT', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1286, 'n_words': 173, 'path': 'chimerax_script.ipynb', 'repo_name': 'talgalper/Honours-2021', 'size': '3472'}