lib5c.parsers.loops module

Module for parsing tables containing categorized loop information.

lib5c.parsers.loops.load_loops(loopsfile)[source]

Reads categorized loop file into nested dict structure.

Parameters

loopsfile (str) – String reference to the loop file to parse. Each line in the loop file corresponds to one loop. The lines are tab-separated. with four columns. These are, in order, the category the loop was categorized into (as a string), the region name the loop is in (as a string), the x-coordinate of the pixel which represents the loop (as an int), and the y-coordinate of the pixel which represent the loop (as an int).

Returns

The outer keys are loop categories as strings. The next level’s keys are region names as strings. The innermost dicts represent loops. These inner loop dicts have the following structure:

{
    'x': int,
    'y': int
}

The ints represent the x and y coordinate, respectively, of the loop within the region.

Return type

dict of dicts of dicts