MOD Reader¶
- class dendrotweaks.biophys.io.reader.MODFileReader[source]¶
Bases:
object
Reader class for .mod files.
Provides methods to read and preprocess .mod files. Splits the content of the file into blocks for further parsing.
- content¶
The content of the MOD file.
- Type:
str
- blocks¶
The blocks of the MOD file corresponding to the NMODL blocks e.g. NEURON, PARAMETER, ASSIGNED, etc.
- Type:
Dict[str, List[str]]
- unmatched¶
The unmatched content in the MOD file after splitting into blocks.
- Type:
str
- BLOCK_TYPES = ['TITLE', 'COMMENT', 'NEURON', 'UNITS', 'PARAMETER', 'ASSIGNED', 'STATE', 'BREAKPOINT', 'DERIVATIVE', 'INITIAL', 'FUNCTION', 'PROCEDURE', 'KINETIC']¶
- read_file(path_to_file: str) str [source]¶
Read the content of the file.
- Parameters:
path_to_file (str) – The path to the file.
- preprocess(remove_inline_comments=True, remove_unitsoff=True, remove_verbatim=True) None [source]¶
Preprocess the content of the file.
- replace_suffix_with_name(overwirte=False) None [source]¶
Replace the suffix in the content of the file with the file name.
Notes
Suffix is a string of the form SUFFIX suffix
- Parameters:
overwirte (bool, optional) – Whether to overwrite the content of the file with the modified content.
- remove_inline_comments() None [source]¶
Remove the rest of the line after “:” from the content of the file.
- remove_verbatim() None [source]¶
Remove ‘VERBATIM’ and ‘ENDVERBATIM’ and everything in between from the content of the file.
- remove_suffix_from_gbar() None [source]¶
Remove the suffix from ‘gbar’ in the content of the file.
Example
gnabar -> gbar