
    DUf                        d dl Z ddlmZ ddlmZ ddlmZ d dlZddlmZ  ej	                     ej
        dd	ed
           ej        dddde           ej        ddde ed          d           ej        ddded           ej        ddd ej        d          d           ej        ddd            ej        d!d"d            ej        d#d$ed%d           ej        d&d'ed(d           ej        d)d*edd          d+                                                                                                                                     ZdS ),    N   )api)make_cooler_view)read_viewframe_from_file   )cli	cool_path	COOL_PATH)metavartypenargsz--nprocz-pzPNumber of processes to split the work between.[default: 1, i.e. no process pool])helpdefaultr   z--chunksizez-czFControl the number of pixels handled by each worker process at a time.g    cAT)r   r   r   show_defaultz--outputz-oz?Specify output file name to store the expected in a tsv format.F)r   r   requiredz--viewz	--regionsaM  Path to a 3 or 4-column BED file with genomic regions to calculated cis-expected on. When region names are not provided (no 4th column), UCSC-style region names are generated. Cis-expected is calculated for all chromosomes, when this is not specified. Note that '--regions' is the deprecated name of the option. Use '--view' instead.)existsz--smoothzeIf set, cis-expected is smoothed and result stored in an additional column e.g. balanced.avg.smoothed)r   is_flagz--aggregate-smoothedzIf set, cis-expected is averaged over all regions and then smoothed. Result is stored in an additional column, e.g. balanced.avg.smoothed.agg. Ignored without smoothingz--smooth-sigmazjControl smoothing with the standard deviation of the smoothing Gaussian kernel, ignored without smoothing.g?z--clr-weight-namezqUse balancing weight with this name stored in cooler.Provide empty argument to calculate cis-expected on raw dataweightz--ignore-diagsz3Number of diagonals to neglect for cis contact typec
                 T   t          j        |           }
|t          |
          }nt          ||
d          }t          j                            |
|d||||r|nd|	||
  
        }|r|                    |ddd           dS t          |                    ddd                     dS )	a  
    Calculate expected Hi-C signal for cis regions of chromosomal interaction map:
    average of interactions separated by the same genomic distance, i.e.
    are on the same diagonal on the cis-heatmap.

    When balancing weights are not applied to the data, there is no
    masking of bad bins performed.

    COOL_PATH : The paths to a .cool file with a balanced Hi-C map.

    NT)check_sorting)	view_df
intra_onlysmoothaggregate_smoothedsmooth_sigmaclr_weight_nameignore_diags	chunksizenproc	Fnan)sepindexna_rep)	coolerCoolerr   r   r   expectedexpected_cisto_csvprint)r	   r   r   outputviewr   r   r   r   r   clrr   results                W/var/www/html/software/conda/lib/python3.11/site-packages/cooltools/cli/expected_cis.pyr(   r(   
   s    @ -	
"
"C|"3'' +4DIII\&&-!+:D! '  F  Bf$eEBBBBB 	fmmE%m@@AAAAA    )r%    r   
lib.commonr   lib.ior   clickr   commandargumentstroptionintPathfloatr(    r0   r/   <module>r=      s          ) ) ) ) ) ) - - - - - -        [s!DDD
)	   	Q	CII   	J	   
Y
 
4	 	 	 
 
 
 
"	   
!    
"	   
C	   	>	  3B 3B     
 
    ED P3B 3B 3Br0   