
    DUf                        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 j	        d	          
           e j        dd e j	        d	                     e j
        ddde ed          d           e j
        dded           e j
        ddddd          d                                                                         ZdS )    N   )merge_coolers   )cliparse_field_paramout_pathF)exists)typein_paths)nargsr   z--chunksizez-cz7Size of the merge buffer in number of pixel table rows.g    sAT)helpr   defaultshow_defaultz--fieldzSpecify the names of value columns to merge as '<name>'. Repeat the `--field` option for each one. Use '<name>,dtype=<dtype>' to specify the dtype. Include ',agg=<agg>' to specify an aggregation function different from 'sum'.)r   r   multiplez--appendz-az_Pass this flag to append the output cooler to an existing file instead of overwriting the file.)is_flagr   r   c           	         t          |          rOd |D             }t          | \  }}}}	d t          ||          D             }d t          ||	          D             }	ndgdd}	}}t          | |||||	|rdnd           dS )	a  
    Merge multiple coolers with identical axes.

    OUT_PATH : Output file path or URI.

    IN_PATHS : Input file paths or URIs of coolers to merge.

    **Notes**

    Data columns merged:

        pixels/bin1_id, pixels/bin2_id, pixels/<value columns>

    Data columns preserved:

        chroms/name, chroms/length
        bins/chrom, bins/start, bins/end

    Additional columns in the the input files are not transferred to the output.

    c                 0    g | ]}t          |d           S )F)includes_colnumr   ).0args     M/var/www/html/software/conda/lib/python3.11/site-packages/cooler/cli/merge.py
<listcomp>zmerge.<locals>.<listcomp>=   s3     
 
 
>Ac5999
 
 
    c                     i | ]
\  }}|||S N )r   coldts      r   
<dictcomp>zmerge.<locals>.<dictcomp>A   s    PPPgc2#rr   c                     i | ]
\  }}|||S r   r   )r   r   fs      r   r!   zmerge.<locals>.<dictcomp>B   s    GGG&#qsAr   countNaw)mergebufcolumnsdtypesaggmode)lenzipr   )
r	   r   	chunksizefieldappendfield_specifiersr(   _r)   r*   s
             r   merger3      s    h 5zz 
5
 
EJ
 
 
 #&'7"8FCPPWf)=)=PPPGGC$5$5GGG !(y$#SS     r   )clickreducer    r   _utilr   commandargumentPathoptionintstrr3   r   r   r   <module>r>      sj    " " " " " "       $ $ $ $ $ $ 
5!9!9!9:::
":5:U+C+C+CDDD	B	CII   
L 
   
'  , ,    ED ;: 8, , ,r   