o
    NrfS                     @   s   d dl Z d dlZddlmZ ddlmZ ddlmZ e ejde	dd	ejd
e
dd	ejddddejdddddddejddeddgddeddd ZdS )    N   )util   )cli)exit_on_broken_pipe
chromsizesZCHROMSIZES_PATH)typemetavarbinsizeZBINSIZEz--outz-oz Output file (defaults to stdout))helpz--headerz-Hz2Print the header of column names as the first row.TF)r   Zis_flagdefaultZ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                 C   s   t j| dd} t | |}|dur*|jddd |d< t|dkr*|d  d7  < |du r2tj}nt|d}|rG|d	d	 j	|d
dddd |j	|d
dddd |
  dS )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)Z	all_namesNZchrom)Zobservedidr   wr   	
F)seplineterminatorindexheader)r   Zread_chromsizesZbinnifygroupbyZcumcountintsysstdoutopenZto_csvflush)r   r
   outr   Zrel_idsZbinsf r   \/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/cooler/cli/makebins.pymakebins
   s    

r!   )r   Zclick r   r   Z_utilr   commandargumentstrr   optionZChoicer!   r   r   r   r    <module>   s2    