
    tf                        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y)    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           	      Z   t        |      rl|D cg c]  }t        |d       }}t        | \  }}}	}
t        ||	      D ci c]  \  }}|	|| }	}}t        ||
      D ci c]  \  }}|	|| }
}}ndgdd}
}	}t        | ||||	|
|rd       yd       yc c}w c c}}w c c}}w )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.

    F)includes_colnumNcountaw)mergebufcolumnsdtypesaggmode)lenr   zipr   )r   r   	chunksizefieldappendargfield_specifiersr   _r   r   coldtfs                 Z/var/www/html/software/conda/envs/higlass/lib/python3.12/site-packages/cooler/cli/merge.pymerger)      s    h 5zEJ
>Ac59
 
 #&'7"8FC),Wf)=Pgc2#r'PP$'$5G&#qsAvGG !(y$S !$
 QGs   B
B!B!$
B'/B')clickreducer    r   _utilr   commandargumentPathoptionintstrr)        r(   <module>r6      s     "  $ 
5!9:
":5::U+CD	B	I 
L 
 
', E ; 8,r5   