iphasimulator.pha_filepath_manager ================================== .. py:module:: iphasimulator.pha_filepath_manager .. autoapi-nested-parse:: PHA structure database management. This module provides lightweight management classes for a PHA-specific structure database. Classes ------- PHAFileManager Handles directory creation, filepath construction and simple file lookup. PHAResidueCodeManager Handles the residue code registry stored in residue_codes.csv. .. rubric:: Notes This module should not contain chemistry-building logic. Parameterisation, prepin generation and polymer construction should live in the polymer builder layer. Classes ------- .. autoapisummary:: iphasimulator.pha_filepath_manager.PHAFileManager iphasimulator.pha_filepath_manager.PHAResidueCodeManager Module Contents --------------- .. py:class:: PHAFileManager(root_dir='structure_database') Manage paths for a PHA structure database. .. py:attribute:: root_dir .. py:attribute:: PHA_types_dir .. py:attribute:: built_PHAs_dir .. py:attribute:: PHA_melts_dir .. py:attribute:: dry_PHAs_dir .. py:attribute:: solvated_PHAs_dir .. py:attribute:: solvated_ions_PHAs_dir .. py:attribute:: temp_dir .. py:attribute:: residue_codes_csv .. py:attribute:: polymer_smiles_csv .. py:method:: get_root_dir() .. py:method:: get_temp_dir() .. py:method:: get_residue_codes_csv() .. py:method:: get_polymer_smiles_csv() .. py:method:: get_PHA_type_dir(PHA_type) .. py:method:: create_PHA_type_dir(PHA_type) .. py:method:: get_PHA_input_dir(PHA_type) .. py:method:: get_PHA_trimer_dir(PHA_type) .. py:method:: get_PHA_monomer_units_dir(PHA_type) .. py:method:: get_PHA_leap_template_dir(PHA_type) .. py:method:: get_PHA_monomer_unit_files(PHA_type) .. py:method:: get_built_PHA_name(PHA_type, length) .. py:method:: parse_built_PHA_name(polymer_name) .. py:method:: get_built_PHA_dir(PHA_type, length) .. py:method:: create_built_PHA_dir(PHA_type, length) .. py:method:: get_built_PHA_leap_dir(PHA_type, length) .. py:method:: get_built_PHA_amber_dir(PHA_type, length) .. py:method:: get_built_PHA_gromacs_dir(PHA_type, length) .. py:method:: get_built_PHA_amber_files(polymer_name) .. py:method:: get_dry_PHAs_dir() .. py:method:: get_dry_PHA_system_name(polymer_name) .. py:method:: get_dry_PHA_dir(polymer_name) .. py:method:: get_dry_PHA_inputs_dir(polymer_name) .. py:method:: get_dry_PHA_simulations_dir(polymer_name) .. py:method:: create_dry_PHA_dir(polymer_name) .. py:method:: get_solvated_PHAs_dir() .. py:method:: get_solvated_PHA_system_name(polymer_name) .. py:method:: get_solvated_PHA_dir(polymer_name) .. py:method:: get_solvated_PHA_inputs_dir(polymer_name) .. py:method:: get_solvated_PHA_simulations_dir(polymer_name) .. py:method:: create_solvated_PHA_dir(polymer_name) .. py:method:: get_solvated_ions_PHAs_dir() .. py:method:: format_ion_label(ion_names) .. py:method:: format_concentration_label(ion_concentration) .. py:method:: get_solvated_ions_PHA_system_name(polymer_name, ion_names, ion_concentration) .. py:method:: get_solvated_ions_PHA_dir(polymer_name, ion_names, ion_concentration) .. py:method:: get_solvated_ions_PHA_inputs_dir(polymer_name, ion_names, ion_concentration) .. py:method:: get_solvated_ions_PHA_simulations_dir(polymer_name, ion_names, ion_concentration) .. py:method:: create_solvated_ions_PHA_dir(polymer_name, ion_names, ion_concentration) .. py:method:: get_PHA_melt_name(polymer_names, number_of_polymers) .. py:method:: get_PHA_melt_dir(polymer_names, number_of_polymers) .. py:method:: create_PHA_melt_dir(polymer_names, number_of_polymers) .. py:method:: get_PHA_melt_inputs_dir(polymer_names, number_of_polymers) .. py:method:: get_PHA_melt_simulations_dir(polymer_names, number_of_polymers) .. py:method:: create_PHA_melt_simulation_run_dir(polymer_names, number_of_polymers, timestamp=None) .. py:method:: create_named_PHA_melt_simulation_run_dir(polymer_names, number_of_polymers, run_name) .. py:method:: find_file(directory, extension) .. py:method:: find_files(directory, extension) .. py:class:: PHAResidueCodeManager(paths) Manage the PHA residue code registry. The residue code CSV links user-facing PHA names to internal Amber-style residue codes. Expected CSV format: PHA_type,component,readable_name,residue_code,smiles 3HB,trimer,P3HB_3,AAA,... 3HB,head,hP3HB,AAB,... 3HB,mainchain,mP3HB,AAC,... 3HB,tail,tP3HB,AAD,... :param paths: Filepath manager used to locate residue_codes.csv. :type paths: PHAFileManager .. py:attribute:: forbidden_codes .. py:attribute:: header :value: ['PHA_type', 'component', 'readable_name', 'residue_code', 'smiles'] .. py:attribute:: paths .. py:attribute:: csv_path .. py:method:: load_rows() Load all rows from residue_codes.csv. :returns: List of CSV entries. :rtype: list[dict] .. py:method:: get_used_codes() Return all residue codes currently stored in the CSV. :returns: Set of used residue codes. :rtype: set .. py:method:: PHA_type_exists(PHA_type) Check whether a PHA type has already been registered. :param PHA_type: :type PHA_type: str :rtype: bool .. py:method:: get_code(PHA_type, component) Return the residue code for a given PHA component. :param PHA_type: :type PHA_type: str :param component: One of: trimer head mainchain tail :type component: str :rtype: str or None .. py:method:: generate_unique_codes(number_of_codes) Generate multiple unique residue codes. .. rubric:: Examples Existing CSV: AAA AAB generate_unique_codes(4) :returns: AAC AAD AAE AAF :param number_of_codes: :type number_of_codes: int :rtype: list[str] .. py:method:: register_PHA_type(PHA_type, trimer_name, trimer_smiles, monomer_smiles) Register a new PHA type. Creates four residue entries: trimer head mainchain tail .. rubric:: Example PHA_type = "3HB" trimer_name = "P3HB_3" Generates: AAA trimer AAB head AAC mainchain AAD tail :param PHA_type: :type PHA_type: str :param trimer_name: :type trimer_name: str :param trimer_smiles: :type trimer_smiles: str :param monomer_smiles: :type monomer_smiles: str