File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -136,3 +136,30 @@ def get_info(file_path):
136136 }
137137
138138 return info
139+
140+
141+ def get_quadtree_depth (chromsizes , binsize ):
142+ """
143+ Depth of quad tree necessary to tesselate the concatenated genome with quad
144+ tiles such that linear dimension of the tiles is a preset multiple of the
145+ genomic resolution.
146+
147+ """
148+ tile_size_bp = TILE_SIZE * binsize
149+ min_tile_cover = np .ceil (sum (chromsizes ) / tile_size_bp )
150+ return int (np .ceil (np .log2 (min_tile_cover )))
151+
152+
153+ def get_zoom_resolutions (chromsizes , base_res ):
154+ return [base_res * 2 ** x for x in range (get_quadtree_depth (chromsizes , base_res )+ 1 )]
155+
156+
157+ def print_zoom_resolutions (chromsizes_file , base_res ):
158+ """
159+ Print comma-separated list of zoom resolutions for a given genome
160+ and base resolution.
161+
162+ """
163+ chromsizes = cooler .util .read_chromsizes (chromsizes_file , all_names = True )
164+ resolutions = get_zoom_resolutions (chromsizes , base_res )
165+ print (',' .join (str (res ) for res in resolutions ))
You can’t perform that action at this time.
0 commit comments