# cmstats module¶

 cmstats.correlateCMaps(ccMapObjOne, ccMapObjTwo) To calculate correlation between two Hi-C maps cmstats.getAvgContactByDistance(ccmaps[, stats]) To calcualte average contact as a function of distance
correlateCMaps(ccMapObjOne, ccMapObjTwo, ignore_triangular=True, diagonal_offset=1, corrType='pearson', blockSize=None, slideStepSize=1, cutoffPercentile=None, workDir=None, outFile=None, logHandler=None)

To calculate correlation between two Hi-C maps

This function can be used to calculate either Pearson or Spearman rank-order correlation between two Hi-C maps. It also ignore lower-trangular matrix with diagnonal offset to avoid duplicate and large values.

Parameters: ccMapObjOne (gcMapExplorer.lib.ccmap.CCMAP) – First gcMapExplorer.lib.ccmap.CCMAP instance containing Hi-C data ccMapObjTwo (gcMapExplorer.lib.ccmap.CCMAP) – Second gcMapExplorer.lib.ccmap.CCMAP instance containing Hi-C data ignore_triangular (bool) – Whether entire matrix is considered or only one half triangular region of matrixis considered. diagonal_offset (int) – If ignore_triangular=True, it is used to determine how much bins are ignored from the diagonal in one half triangular region of matrix. diagonal_offset = 0 is the main diagonal, diagonal_offset > 0 means ignore this many bins from the diagonal. corrType (str) – Correlation type. For Pearson and Spearman rank-order correlation, use pearson and spearman, respectively. blockSize (str) – To calculate block-wise correlations by sliding block of given size along diagonals. It should be in resolution. For example, 1mb, 500kb, 5mb, 2.5mb etc. If None, correlation of whole map is calculated. Sliding step of block depends on slideStepSize. slideStepSize (int) – Step-size in bins by which blocks will be shifted for block-wise correlation. If slideStepSize is large then blocks might not be overlapped. workDir (str) – Name of working directory, where temporary files will be kept.If workDir = None, file will be generated in OS based temporary directory. outFile (str) – Name of output file. Only written for block-wise correlation. corr (float or list) – Correlation coefficient pvalue/centers (float or list) – If blockSize=None 2-tailed p-value is returned. For block-wise correlation, list of block-center is returned.

getAvgContactByDistance(ccmaps, stats='median')
Parameters: hicmaps (gcMapExplorer.lib.ccmap.CCMAP or list[gcMapExplorer.lib.ccmap.CCMAP]) – avg_contacts – A one-dimensional numpy array containing average contacts, where index is distance between two locations for given resolution/binsize. For example, if ccmap.binsize=100000 and avg_contacts[4]=1234.56, then at distance of 400000 b, average contact is 1234.56. numpy.array