Zero fill prefix
Handles zero filling prefix for module folder names.
To facilitate folder sorting, HADDOCK3 module run folder names have a integer prefix starting at 0.
Depending on the number of modules of the run, the integer prefix is a single digit number or multi-digit number (00, 01, 02, 03…).
This gear module contains the “zero filling” logic in HADDOCK 3.
The main class of this module zerofill is already instantiated such that its state can be used and edited throughout the HADDOCK3 library.
Examples
>>> from haddock.gear import zerofill
>>> zerofill.read(modules) # a dictionary containing 11 modules
>>> zerofill.zfnum
2
>>> zerofill.fill("topoaa", 0)
"00_topoaa"
- haddock.gear.zerofill.get_number_of_digits(num: int) int [source]
Get the number of digits of a number.
10 has two digits. 100 has three digits.
- haddock.gear.zerofill.get_zerofill_for_modules(modules: Sized) int [source]
Get a the prefix zerofill for modules.
If there are 5 modules, zerofill digits is 1.
If there are 10 modules, zerofill digits is 1 because counting starts at 0 (for topoaa).
If there are 100 modules, zerofill digits is 2 because counting starts at 0 (for topoaa).
This function is used in combination with zero_fill.