config module

It contains functions that handle configuration of gcMapExplorer. gcMapExplorer uses some default settings and options. This can be read and changed through these modules.

Configuration file structure

Configuration
    ├─────────── Dirs
    │             └──────── WorkingDirectory
    │
    └─────────── Programs
                  ├──────── bigWigInfo
                  └──────── bigWigToWig

Examples

import gcMapExplorer

gcMapExplorer.config.cleanScratch()   # Clean default scratch directory

# Change scratch directory
gcMapExplorer.config.updateConfig('Dirs', 'WorkingDirectory', 'Path/to/new/scratch/directory')

# Set path to bigWigInfo program
gcMapExplorer.config.updateConfig('Programs', 'bigWigInfo', 'Path/to/bigWigInfo')

# Set path to bigWigToWig program
gcMapExplorer.config.updateConfig('Programs', 'bigWigToWig', 'Path/to/bigWigToWig')

# Print current configuration file content
gcMapExplorer.config.printConfig()

# Get configuration
config = gcMapExplorer.config.getConfig()

# Get scratch directory
print(config['Dirs']['WorkingDirectory'])

Summary

updateConfig(section, option, value) Update configuration file
getConfig() To get the present configuration.
printConfig() Print configuration file
cleanScratch() Clean scratch directory.
updateConfig(section, option, value)

Update configuration file

Parameters:
  • section (str) – Section of the configuration files. It could be Dirs or Programs.
  • option (str) – Input option, for which value is to be changed.
  • value (str or int) – New value of the input option.
getConfig()

To get the present configuration.

Configuration file has the following organization.

Configuration
    ├─────────── Dirs
    │             └──────── WorkingDirectory
    │
    └─────────── Programs
                  ├──────── bigWigInfo
                  └──────── bigWigToWig

In case no configuration file is found, a new file is generated and default value is assigned to each option.

Returns:config – Dictionary of Dictionaries with option name and value pair. For example, config[‘Dirs’][‘WorkingDirectory’] contains path to scratch directory. Similarly, config[‘Programs’][‘bigWigInfo’] contains path to bigWigInfo program.
Return type:dict
printConfig()

Print configuration file

It can be used to print the configuration file. It shows the current configuration of gcMapExplorer.

cleanScratch()

Clean scratch directory.

It checks whether any other gcMapExplorer process is running. In case, when only one process (i.e. current) is running, all files with “gcx” prefix will be deleted from default scratch directory.