
    DUfe                        d dl mZ d dlmZ d dlmZ d dlZd dlZ	ddl
mZ ddlmZmZmZmZ ddlmZmZ d dlZd dlZd	 Zd dZd Z	 	 	 d!dZ	 	 	 d!dZ	 d"dZd#dZ	 	 	 d$dZ	 	 	 	 	 	 	 	 	 	 	 d%dZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d&dZd Z dS )'    )combinations)partial)toeplitzN   )numutils)is_compatible_viewframeis_valid_expectedis_cooler_balancedis_track)view_from_trackalign_track_with_coolerc                     i | |S N )abs     Q/var/www/html/software/conda/lib/python3.11/site-packages/cooltools/api/saddle.py_merge_dictr      s    a:1:    leftc                     t          j        |           } t          j        t          j        |           ||          dz
  }t          j        dt          |           z  dt          |                     }||         S )zmask_bad_bins
    Return array `x`'s empirical CDF value(s) at the points in `v`.
    This is based on the :func:`statsmodels.distributions.ECDF` step function.
    This is the inverse of `quantile`.

    )side         ?)npasarraysearchsortedsortlinspacelen)xvr   indys        r   _ecdfr%      s`     	
1A
/"'!**ad
3
3
3a
7C
C#a&&L#s1vv..AS6Mr   c                 ~    t          j        |           } t          j        |          dz  }t          j        | |fi |S )zz
    Return the values of the quantile cut points specified by fractions `q` of
    a sequence of data given by `x`.

    d   )r   r   nanpercentile)r!   qkwargsps       r   	_quantiler,   $   s>     	
1A

1AAq++F+++r   weightbalanced.avgnamec                      d                      ddg          |         D                                 |           fd}|S )a  
    Construct a function that returns intra-chromosomal OBS/EXP for symmetrical regions
    defined in view_df.

    Used in `get_saddle()`.

    Parameters
    ----------
    clr : cooler.Cooler
        Observed matrix.
    expected : DataFrame
        Diagonal summary statistics for a number of regions.
    view_df: viewframe
        Viewframe with genomic regions.
    clr_weight_name : str
        Name of the column in the clr.bins to use as balancing weights.
    expected_value_col : str
        Name of the column in expected used for normalizing.
    view_name_col : str
        Name of column in view_df with region names.

    Returns
    -------
    getexpected(reg, _). 2nd arg is ignored.

    c                 $    i | ]\  }}||j         S r   values.0kr!   s      r   
<dictcomp>z,_make_cis_obsexp_fetcher.<locals>.<dictcomp>Q   s0       Aq 	
18  r   region1region2c                    t          	j        |                    }t          	j        |                   }                                                  ||          }t	          | |f         d |j        d                            }||z  S )Nbalancer   )tuplelocmatrixfetchr   shape)
reg1reg2reg1_coordsreg2_coordsobs_matexp_matclrclr_weight_nameexpectedview_dfs
         r   _fetch_cis_oez/_make_cis_obsexp_fetcher.<locals>._fetch_cis_oeW   s    GK-..GK-..**_*55;;KUU8D$J/0B'-2B0BCDD  r   )groupby	set_index)rH   rJ   rK   rI   expected_value_colview_name_colrL   s   ````   r   _make_cis_obsexp_fetcherrQ   /   s    D $$i%;<<=OP  H ..G! ! ! ! ! ! ! ! r   c                 F                         |          t          j                  r
 fd}|S t                    t          j        j        j        u r6d                     ddg          |         D             fd fd}|S t          d          )a  
    Construct a function that returns OBS/EXP for any pair of chromosomes.

    Used in `get_saddle()`.

    Parameters
    ----------
    clr : cooler.Cooler
        Observed matrix.
    expected : DataFrame or scalar
        Average trans values. If a scalar, it is assumed to be a global trans
        expected value. If a tuple of (dataframe, name), the dataframe must
        have a MultiIndex with 'region1' and 'region2' and must also have a column
        labeled ``name``, with the values of expected.
    view_df: viewframe
        Viewframe with genomic regions.
    clr_weight_name : str
        Name of the column in the clr.bins to use as balancing weights
    expected_value_col : str
        Name of the column in expected used for normalizing.
    view_name_col : str
        Name of column in view_df with region names.

    Returns
    -----
    getexpected(reg1, reg2)

    c                     t          j        |                    }t          j        |                   }                                                  ||          }|z  S Nr;   r=   r>   r?   r@   )	rB   rC   rD   rE   rF   rH   rI   rJ   rK   s	        r   _fetch_trans_oez3_make_trans_obsexp_fetcher.<locals>._fetch_trans_oe   s`    D 122KD 122Kjjj99??[ G X%%r   c                 $    i | ]\  }}||j         S r   r2   r4   s      r   r7   z._make_trans_obsexp_fetcher.<locals>.<dictcomp>   s0     
 
 
1 qx
 
 
r   r8   r9   c                     | |f                                 v r
| |f         S || f                                 v r
|| f         S t          d                    | |                    )Nz8trans-exp index is missing a pair of chromosomes: {}, {})keysKeyErrorformat)r8   r9   rJ   s     r   _fetch_trans_expz4_make_trans_obsexp_fetcher.<locals>._fetch_trans_exp   s{    !X]]__44 0117#x}}66 011 #VGW55  r   c                     t          	j        |                    }t          	j        |                   }                                                  ||          } | |          }||z  S rT   rU   )
rB   rC   rD   rE   rF   expr\   rH   rI   rK   s
         r   rV   z3_make_trans_obsexp_fetcher.<locals>._fetch_trans_oe   sq    D 122KD 122Kjjj99??[ G #"4..CS= r   zUnknown type of expected)
rN   r   isscalartypepdcoreframe	DataFramerM   
ValueError)rH   rJ   rK   rI   rO   rP   rV   r\   s   ````   @r   _make_trans_obsexp_fetcherrf   a   s   L ..G	{8 -5	& 	& 	& 	& 	& 	& 	& 	& 	h27=2	2	2
 
 (()Y)?@@AST
 
 

	 	 	 	 		! 	! 	! 	! 	! 	! 	! 	!  3444r      Fc	           
      |   | j         d         }	 |||          }
||k    rt          j        | dz   |          D ]"}t          j        |
t          j        |           #|dk    ryt          j        t          j        |
j         d          |           t          j        |dz   |
j         d                             D ]"}t          j        |
t          j        |           #|r#t          d                    ||                     t          |	          D ]}||         |k    }t          |	          D ]}||         |k    }|
|ddf         dd|f         }|t          j
        |                   }| ||fxx         t          j        |          z  cc<   |||fxx         t          t          |                    z  cc<   dS )z
    Helper function to aggregate across region pairs.
    If regions are identical, also masks returned matrices below min_diag and above max_diag.

    Used in `get_saddle()`.
    r   r   zregions {} vs {}N)rA   r   aranger   set_diagnanappendprintr[   rangeisfinitesumfloatr    )SC	getmatrix	digitizedrB   rC   min_diagmax_diagverbosen_binsr?   dirow_maskjcol_maskdatas                    r   _accumulater      s    WQZFYtT""Ft||H9q=(33 	1 	1Afbfa0000q==Y	6<?*XI66	(Q,Q88  5 5 !&"&!4444 5 ''d334446]] ( (T?a'v 	( 	(A !+H(AAA+&qqq({3DD))*DadGGGrvd||#GGGadGGGuSYY'''GGGG	(( (r   c                    ||t          d          |8|\  }}||k    rt          d          t          j        |||dz             }|||fS |c|\  }}|dk     s|dk    rt          d          ||k    rt          d          t          j        |||dz             }	t          | |	          }|||fS t          d	          )
z
    Helper function to make bins for `get_digitized()`.

    Nakes binedges in real space from value limits provided by vrange,
    or in quantile space from quantile limits provided by qrange.

    Nz,only one of vrange or qrange can be suppliedz+vrange does not satisfy vrange[0]<vrange[1]r           r   z*qrange must specify quantiles in (0.0,1.0)z+qrange does not satisfy qrange[0]<qrange[1]z(either vrange or qrange must be supplied)re   r   r   r,   )
track_valuesrz   vrangeqrangelohibinedgesqloqhiq_edgess
             r   _make_binedgesr      s     f0GHHH		B77JKKK;r2vz22R		S99c		IJJJ99JKKK+c3
33\733c!! CDDDr   .dc                    t          |          t          urt          d          t          | d           |                                 }| j        d         }||z   }| |                                         }|                    |t          j        i          j	        }t          ||||          \  }	}
}t          j        ||	d          ||<   ||j        ||         t          j        |	          k    |f<   | |                                         }d|j        ||f<   t          j        t          j        d|d	z             d
          }|                    ||i          }|t%          | j        dd                   |gz            }||	fS )a  
    Digitize genomic signal tracks into integers between `1` and `n`.

    Parameters
    ----------
    track : 4-column DataFrame
        bedGraph-like dataframe with columns understood as (chrom,start,end,value).
    n_bins : int
        number of bins for signal quantization.
    vrange : tuple
        Low and high values used for binning track values.
        E.g. if `vrange`=(-0.05, 0.05), equal width bins would be generated
        between the value -0.05 and 0.05.
    qrange : tuple
        Low and high values for quantile binning track values.
        E.g., if `qrange`=(0.02, 0.98) the lower bin would
        start at the 2nd percentile and the upper bin would end at the 98th
        percentile of the track value range.
        Low must be 0.0 or more, high must be 1.0 or less.
    digitized_suffix : str
        suffix to append to the track value name in the fourth column.

    Returns
    -------
    digitized : DataFrame
        New track dataframe (bedGraph-like) with
        digitized value column with name suffixed by '.d'
        The digized column is returned as a categorical.
    binedges : 1D array (length n + 1)
        Bin edges used in quantization of track. For `n` bins, there are `n + 1`
        edges. See encoding details in Notes.

    Notes
    -----
    The digital encoding is as follows:

    - `1..n` <-> values assigned to bins defined by vrange or qrange
    - `0` <-> left outlier values
    - `n+1` <-> right outlier values
    - `-1` <-> missing data (NaNs)

    z!n_bins must be provided as an intTraise_errorsrg   r   r   F)rightrh   r   )
categoriesorderedN)r`   intre   r   copycolumnsastyper   float64r3   r   digitizer>   maxisnullra   CategoricalDtyperj   list)trackrz   r   r   digitized_suffixrv   track_value_coldigitized_colr   r   r   r   maskdigitized_catss                 r   r   r      s   d F||3<===U&&&&

ImA&O#&66M)..00L&&'DEELL%fVF  Hb"  "{<OOOIm 	 M/"bfX&6&66G !((**D)+IM$%&(9R!,,d  N   -!@AAI $u}RaR011]OCDIhr   c                   
 t          |          t          u rKt          || |d|          }t          |j        ddddf         |||d          \  }}|j        d         }n||}|j        d         }t          |                    |di          d	           t          |j        d                   t          j
        j        j        j        urt          d
          ||         j        j        j        }t!          ||dk                       dz
  }nt          d          t#          |          n7	 t%          | dd          }n"# t&          $ r}t          d          |d}~ww xY w	 t)          ||| |	gd          }n"# t&          $ r}t          d          |d}~ww xY w|r:	 t+          | |d	          }n&# t&          $ r}t          d| d          |d}~ww xY wi }                                D ]+\  }}t/          j        ||          }||         ||
         <   ,|dk    r?t3          t5          
         
                             }t7          | |
|	|          }n]|dk    rHt3          t9          
         d                    }
fd|D             }t;          | |
|	|          }nt          d          t=          j        |dz   |dz   f          }t=          j        |dz   |dz   f          }|D ]\  }}tA          |||||||||	  	         ||j!        z  }||j!        z  }|r|ddddf         }|ddddf         }||fS )a  
    Get a matrix of average interactions between genomic bin
    pairs as a function of a specified genomic track.

    The provided genomic track is either:
    (a) digitized inside this function by passing 'n_bins', and one of 'v_range' or 'q_range'
    (b) passed as a pre-digitized track with a categorical value column as generated by `get_digitized()`.

    Parameters
    ----------
    clr : cooler.Cooler
        Observed matrix.
    expected : DataFrame in expected format
        Diagonal summary statistics for each chromosome, and name of the column
        with the values of expected to use.
    contact_type : str
        If 'cis' then only cis interactions are used to build the matrix.
        If 'trans', only trans interactions are used.
    track : DataFrame
        A track, i.e. BedGraph-like dataframe, which is digitized with
        the options n_bins, vrange and qrange. Can optionally be passed
        as a pre-digitized dataFrame with a categorical value column,
        as generated by get_digitzied(), also passing n_bins as None.
    n_bins : int or None
        number of bins for signal quantization. If None, then track must
        be passed as a pre-digitized track.
    vrange : tuple
        Low and high values used for binning track values.
        See get_digitized().
    qrange : tuple
        Low and high values for quantile binning track values.
        Low must be 0.0 or more, high must be 1.0 or less.
        Only one of vrange or qrange can be passed. See get_digitzed().
    view_df: viewframe
        Viewframe with genomic regions. If none, generate from track chromosomes.
    clr_weight_name : str
        Name of the column in the clr.bins to use as balancing weights.
        Using raw unbalanced data is not supported for saddles.
    expected_value_col : str
        Name of the column in expected used for normalizing.
    view_name_col : str
        Name of column in view_df with region names.
    min_diag : int
        Smallest diagonal to include in computation. Ignored with
        contact_type=trans.
    max_diag : int
        Biggest diagonal to include in computation. Ignored with
        contact_type=trans.
    trim_outliers : bool, optional
        Remove first and last row and column from the output matrix.
    verbose : bool, optional
        If True then reports progress.
    drop_track_na : bool, optional
        If True then drops NaNs in input track (as if they were missing),
        If False then counts NaNs as present in dataframe.
        In general, this only adds check form chromosomes that have all missing values, but does not affect the results.
    Returns
    -------
    interaction_sum : 2D array
        The matrix of summed interaction probability between two genomic bins
        given their values of the provided genomic track.
    interaction_count : 2D array
        The matrix of the number of genomic bin pairs that contributed to the
        corresponding pixel of ``interaction_sum``.
    T)rK   rI   mask_clr_bad_binsdrop_track_naN   r   )r   r   r   rg   rr   r   zwhen n_bins=None, saddle assumes the track has been pre-digitized and the value column is a pandas categorical. See get_digitized().rh   r   z&n_bins must be provided as int or None)check_sortingr   z0view_df is not a valid viewframe or incompatible)verify_coolerexpected_value_colsr   z#provided expected is not compatiblez#provided cooler is not balanced or z is missingcis)rP   rO   rI   transc                     g | ]V}d          j                  |d         k             j        d          j                  |d         k             j        k    T|WS )chromr   r   )r>   r3   )r5   r|   rK   rP   s     r   
<listcomp>zsaddle.<locals>.<listcomp>  sz     
 
 
 $W]%;qt%CDK7#'(>!A$(FGNO O O O Or   z5Allowed values for contact_type are 'cis' or 'trans'.)rw   rx   ry   r   )"r`   r   r   r   ilocr   r   r   dtypesra   rb   r   re   dtyper   r3   r    r   r   	Exceptionr	   r
   iterrowsbioframeselectr   ziprQ   r   rf   r   zerosr   T) rH   rJ   r   contact_typerz   r   r   rK   rI   rO   rP   rw   rx   trim_outliersry   r   digitized_trackr   r   cats_edigitized_tracksnumregdigitized_regsupportsru   interaction_suminteraction_countrB   rC   s           `  `                     r   saddler   Q  s   h F||s'+"'
 
 
 %-Jqqq"1"u!%
 %
 %
! (/2	'/2}g677dKKKK'*++7>(9: : =  
 }-3>E T$)_%%)ABBB!/22	X'"!	  AA  	X 	X 	XOPPVWW	XG"! 	
 	
 	
  G G G>??QFG  	"3dKKKAA 	 	 	RoRRR 	
 $$&& L LS ==/<]/K]+,, uGM2GM4JKKLL,'1+
 
 
		 
	 	 W]%;Q??@@
 
 
 
 

 
 
 /'1+
 
 
		 PQQQ h
FQJ788O&1*fqj!9:: 
 

d
	
 
	
 
	
 
	
 
	
 ((O*,, :)!B$"*5-adAbDj9---sH   5E	 	
E(E##E(,F 
F"FF"(F; ;
GGGr   r   coolwarmlog      ?c                 J   t          j        dt                     ddlm}m} ddlm}m} ddl	m
} ddlm}  G fdd|j                  }| j        d	         }| |         j        }t!          | |||
          \  }}||j        d	                  j                            t$                                                    }||dk    |t)          |          dz   k     z           }t+          j        |t)          |          dz             } ||\  }!}"||\  }!}"t+          j        |!|"|dz             }|j        d         }#t+          j        ||          \  }$}%|}&|#|z
  dk    r|&ddddf         }&| dd         } |t5          ||          }i }' |d	d	g dg ddd          }(|1t7          d          })t9          |)||ni           } |j        d5i |}|dk    r |          }*n#|dk    r |          }*nt=          d          |                    |(d                   x|'d<   }+t7          |d          },t9          |,||ni           } |+j         |$|%|&fd|*i|}-|!                                j"        #                    d           t7          d|	d           }.t9          |.||ni           }|                    |(d	         |'d         !          |'d"<    |j$        |dd         ft+          j%        |          | d#d$| |&                    |&                                d         |&                                d                    |'                    |"|!           |!                                j(        d%         #                    d           |!                                j(        d&         #                    d           |!                                j(        d'         #                    d           |!                                j)        #                    d           |                    |(d         |'d         (          |'d)<    |j*        |dd         ft+          j%        |          | d#d*| |&                    |!|"           |!                                j(        d%         #                    d           |!                                j(        d+         #                    d           |!                                j(        d'         #                    d           |!                                j)        #                    d           |!                                j"        #                    d           |                    |(d,                   |'d-<   t7          d.|pd/0          }/t9          |/||ni           }|dk    r_][ |j+        |-fi |x|'d1<   }0d2}1d,}2t+          j,        t+          j        |2          |1z            |1z  }3|0-                    |3           nD |j+        |-fd3 |            i|x|'d1<   }0|0j.        j"        /                     |                       |'d         0                    |!|"           |'d         1                    |"|!           |2                    d           |3                    d4           |
|'d)         4                    |
           ||'d         5                    |           ||'d"         6                    |           |'S )6a  
    Generate a saddle plot.

    Parameters
    ----------
    track : pd.DataFrame
        See get_digitized() for details.
    saddledata : 2D array-like
        Saddle matrix produced by `make_saddle`. It will include 2 flanking
        rows/columns for outlier signal values, thus the shape should be
        `(n+2, n+2)`.
    cmap : str or matplotlib colormap
        Colormap to use for plotting the saddle heatmap
    scale : str
        Color scaling to use for plotting the saddle heatmap: log or linear
    vmin, vmax : float
        Value limits for coloring the saddle heatmap
    color : matplotlib color value
        Face color for margin bar plots
    fig : matplotlib Figure, optional
        Specified figure to plot on. A new figure is created if none is
        provided.
    fig_kws : dict, optional
        Passed on to `plt.Figure()`
    heatmap_kws : dict, optional
        Passed on to `ax.imshow()`
    margin_kws : dict, optional
        Passed on to `ax.bar()` and `ax.barh()`
    cbar_kws : dict, optional
        Passed on to `plt.colorbar()`
    subplot_spec : GridSpec object
        Specify a subregion of a figure to using a GridSpec.

    Returns
    -------
    Dictionary of axes objects.

    zGenerating a saddleplot will be deprecated in future versions, please see https://github.com/open2c_examples for examples on how to plot saddles.r   )GridSpecGridSpecFromSubplotSpec)	NormalizeLogNorm)tickerNc                   ,    e Zd Zd fd	Zd fd	ZdS )&saddleplot.<locals>.MinOneMaxFormatterNc                 H    t          dz  dz  dz  dg          | _        d S )N
   r   )set
_sublabels)selflocsvmaxvmins     r   set_locsz/saddleplot.<locals>.MinOneMaxFormatter.set_locs  s)    !4"9r>4"9a"@AADOOOr   c                 B    |dfvrdS d                     |          S )Nr    z{x:g})r!   )r[   )r   r!   posr   r   s      r   __call__z/saddleplot.<locals>.MinOneMaxFormatter.__call__  s-    q$''r~~~***r   r   )__name__
__module____qualname__r   r   )r   r   s   r   MinOneMaxFormatterr     sb        	B 	B 	B 	B 	B 	B 	B	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+r   r   rg   r   rh   r   )	minlengthr   )subplot_spec)g?r   g?g?)nrowsncolswidth_ratiosheight_ratioswspacehspace)   r   )figsizer   )r   r   linearz.Only linear and log color scaling is supportedr   
ax_heatmapT)cmap
rasterizednormFr6   )	edgecolor	facecolor	linewidth)shareyax_margin_yedge)heightwidthaligntopbottomr   )sharexax_margin_x)r   r   r   r   r   ax_cbarg?r   )fractionlabelcbarr   r[   offr   )7warningswarnDeprecationWarningmatplotlib.gridspecr   r   matplotlib.colorsr   r   
matplotlibr   matplotlib.pyplotpyplotLogFormatterr   r3   r   r   r   r   r    r   bincountr   rA   meshgridr   dictr   figurere   subplot
pcolormeshgcayaxisset_visiblebarhdiffxlimylimspinesxaxisbarcolorbartrunc	set_ticksaxset_minor_formatterset_xlimset_ylimgridaxis	set_title
set_xlabel
set_ylabel)4r   
saddledatarz   r   r   r   scaler   r   colortitlexlabelylabelclabelfigfig_kwsheatmap_kws
margin_kwscbar_kwsr   r   r   r   r   r   pltr   r   r   r   r   r!   histr   r   nXYrt   r(  gsfig_kws_defaultr   r$  heatmap_kws_defaultimgmargin_kws_defaultcbar_kws_defaultcbdecimal	nsegmentscd_tickss4          ``                                           r   
saddleplotrH  7  s   z M	_   FEEEEEEE44444444!!!!!!######+ + + + + + + +V0 + + + mA&O)0L !)vf U U UOX/23:AA#FFKKMMA	1r6a#h--!++
,-A;qCMMA$5666DBB;r2vz22 	A;x**DAqA	F
qadAbDjMAbDz 2NNND	"]]#mm
 
 
B {v...o':MwwSUVVcj##7## ~~wDt,,,	(		yd...IJJJ!kk"Q%000DDT:::K,C[[ K "-1a
:
:d
:k
:
:CGGIIO&&& uJJJ**@JJb J ++beD4F+GGDCH" gh//t6 MW   HHSXXZZ]CHHJJqM***HHRGGIIU''...GGIIX**5111GGIIV((///GGIIO&&&++beD4F+GGDCG"WX..t6 MW   HHRGGIIU''...GGIIW))%000GGIIV((///GGIIO&&&GGIIO&&& kk"Q%((DOS"===+9MXXSUVVHT-$2B(CL99999Vr 	8BKdI>>HIIGS
X(CLVV5G5G5I5IVXVVVVr
''(:(:(<(<=== 	B'''B'''HHUOOOHHUOOO]%%e,,,\%%f---]&&v...Kr   c                    | j         \  }}||k    rt          d          t          j        |          }t	          d|          D ]1}t          j        | d|d|f                   t          j        | ||z
  |||z
  |f                   z   }t          j        |d|d|f                   t          j        |||z
  |||z
  |f                   z   }||z  }t          j        | d|||z
  |f                   t          j        | ||z
  |d|f                   z   }	t          j        |d|||z
  |f                   t          j        |||z
  |d|f                   z   }
|	|
z  }||z  ||<   3|S )a:  
    Parameters
    ----------
    S, C : 2D arrays, square, same shape
        Saddle sums and counts, respectively

    Returns
    -------
    1D array
    Ratios of cumulative corner interaction scores, where the saddle data is
    grouped over the AA+BB corners and AB+BA corners with increasing extent.

    z`saddledata` should be square.r   r   )rA   re   r   r   ro   nansum)rs   rt   mr;  ratiosr6   	intra_sumintra_countintra	inter_suminter_countinters               r   saddle_strengthrS     s    7DAqAvv9:::Xa[[F1a[[ 	" 	"Ia!QqSk**RYqQAEAI9M7N-O-OO	i!A#qs(,,ry1q519a!eai;O9P/Q/QQK'Ia!QUQY/0029Qq1uqy!A#~=N3O3OO	i!A#q1uqy. 122RYqQAaC?P5Q5QQK'EMq		Mr   )r   )r-   r.   r/   )rg   rh   F)NN)NNr   )NNNr-   r.   r/   rg   rh   FFF)Nr   r   r   r   r   NNNNNNNNNNN)!	itertoolsr   	functoolsr   scipy.linalgr   numpyr   pandasra   libr   
lib.checksr   r	   r
   r   
lib.commonr   r   r  r   r   r%   r,   rQ   rf   r   r   r   r   rH  rS  r   r   r   <module>r\     s@   " " " " " "       ! ! ! ! ! !                          B A A A A A A A    
 
 
 
, , , %/ / / /l %U5 U5 U5 U5r NS!( !( !( !(HE E E EH P P P Pr %!c. c. c. c.T 	
		


)F F F FR    r   