
    tfS                        d dl Z d dlZddlmZ ddlmZ ddlmZ  ej                          ej                  de	d	       ej                  d
e
d	       ej                  ddd       ej                  dddddd       ej                  dd ej                  ddg      d       ed      d                                                  Zy)    N   )util   )cli)exit_on_broken_pipe
chromsizesCHROMSIZES_PATH)typemetavarbinsizeBINSIZEz--outz-oz Output file (defaults to stdout))helpz--headerz-Hz2Print the header of column names as the first row.TF)r   is_flagdefaultshow_defaultz	--rel-idsz-i01ziInclude a column of relative bin IDs for each chromosome. Choose whether to report them as 0- or 1-based.)r
   r   c                    t        j                  | d      } t        j                  | |      }|?|j                  dd      j	                         |d<   t        |      dk(  r|dxx   dz  cc<   |t        j                  }nt        |d      }|r|d	d	 j                  |d
ddd       |j                  |d
ddd       |j                          y)a  
    Generate fixed-width genomic bins.

    Output a genome segmentation at a fixed resolution as a BED file.

    CHROMSIZES_PATH : UCSC-like chromsizes file, with chromosomes in desired
    order.

    BINSIZE : Resolution (bin size) in base pairs <int>.

    T)	all_namesNchrom)observedidr   wr   	
F)seplineterminatorindexheader)r   read_chromsizesbinnifygroupbycumcountintsysstdoutopento_csvflush)r   r   outr   rel_idsbinsfs          ]/var/www/html/software/conda/envs/higlass/lib/python3.12/site-packages/cooler/cli/makebins.pymakebinsr/   
   s    @ %%jDAJ<<
G,D\\'D\9BBDT
w<1J!OJ {JJcNQq	4E$ 	 	
 	KKtDeKLGGI    )r%   click r   r   _utilr   commandargumentstrr$   optionChoicer/    r0   r.   <module>r:      s    
    & 30AB	Y7gt"DE	= 	sCj	!
6	 Q  F 8 C (r0   