schrodinger.application.combiglide.utils module¶
This module contains the utility functions for CombiGlide.
- schrodinger.application.combiglide.utils.get_spec_dict(filename, delimiter=':', pat_replace={}, ignore_case=True)¶
Reads the file, tokenizes the each line with delimiter, and returns the dict. It ignores the lines which start with ‘#’.
- Parameters
filename (string) – The name of the input file.
delimiter (str) – line is divided from delimiter to create the <key,value> of dict.
pat_replace (dict) – this dict can be used to replace pattern, if specified. For example: pat_replace={‘#.*’:’’, ‘s+’:’ ‘} would do replace all characters starting from ‘#’ to end of the line with ‘’ and replace multiple spaces with one space.
ignore_case (bool) – it is used to create the lowercase keys to make case insensitive search
Illustration:
A call to get_spec_dict(filename, pat_replace={'#.*':'', '\s+':' '}) with following file.. file content = " #CombGen input file #Core molecule Core: cg_singledock_run1_tproj38171a23586-core.mae #Attachment AcCl Chain: AcCl 1 1 1f 1t Frag: AcCl 1 cg_acid_chlorides_Acid_Cl_C_C #Attachment Hyd Chain: Hyd 1 1 2f 2t Frag: Hyd 1 cg_hydrazines_Hydrazine_C_N #Attachment NCO Chain: NCO 1 1 3f 3t Frag: NCO 1 cg_isocyanates_Isocyanate_C_N " would return spec_dict as follow... {'frag': ['AcCl', '1', 'cg_acid_chlorides_Acid_Cl_C_C', 'Hyd', '1', 'cg_hydrazines_Hydrazine_C_N', 'NCO', '1', 'cg_isocyanates_Isocyanate_C_N'], 'core': ['cg_singledock_run1_tproj38171a23586-core.mae'], 'chain': ['AcCl', '1', '1', '1f', '1t', 'Hyd', '1', '1', '2f', '2t', 'NCO', '1', '1', '3f', '3t']}