data/nora2012/make_processed_files.py
def build_cmatrix(rev_mapping, for_mapping, region, n_beads):
    """
    Builds a square contact frequency matrix of shape (n_beads, n_beads).
    Contacts from restriction fragments mapping to the same bead are summed.
    A zero in this matrix means either that there was no data collected or that
    the number of counts is in fact zero. Later, we ignore zero-valued
    entries in the matrix.
    Return square contact frequency matrix.
    """
    contmatrix = np.zeros((n_beads, n_beads))

    cmatrix = np.zeros((n_beads, n_beads))
    for i in range(n_beads):
        contributing_fors = np.where(for_mapping == i)[0]
        for j in range(n_beads):
            contributing_revs = np.where(rev_mapping == j)[0]
            for cfor in contributing_fors:
                for crev in contributing_revs:
                    cmatrix[i,j] += region[cfor, crev]
    cmatrix += cmatrix.T

    return cmatrix

    Builds a square contact frequency matrix of shape (n_beads, n_beads).
    Contacts from restriction fragments mapping to the same bead are summed.
    A zero in this matrix means either that there was no data collected or that
    the number of counts is in fact zero. Later, we ignore zero-valued
    entries in the matrix.
    Return square contact frequency matrix.
    
Builds a square contact frequency matrix of shape (n_beads, n_beads).
Contacts from restriction fragments mapping to the same bead are summed.
A zero in this matrix means either that there was no data collected or that
the number of counts is in fact zero. Later, we ignore zero-valued
entries in the matrix.
Return square contact frequency matrix.
Builds a square contact frequency matrix of shape ( n_beads n_beads ) . Contacts from restriction fragments mapping to the same bead are summed . A zero in this matrix means either that there was no data collected or that the number of counts is in fact zero . Later we ignore zero - valued entries in the matrix . Return square contact frequency matrix .
def build_cmatrix(rev_mapping, for_mapping, region, n_beads):
    contmatrix = np.zeros((n_beads, n_beads))
    cmatrix = np.zeros((n_beads, n_beads))
    for i in range(n_beads):
        contributing_fors = np.where(for_mapping == i)[0]
        for j in range(n_beads):
            contributing_revs = np.where(rev_mapping == j)[0]
            for cfor in contributing_fors:
                for crev in contributing_revs:
                    cmatrix[i,j] += region[cfor, crev]
    cmatrix += cmatrix.T
    return cmatrix
def build_cmatrix ( rev_mapping , for_mapping , region , n_beads ) : contmatrix = np . zeros ( ( n_beads , n_beads ) ) cmatrix = np . zeros ( ( n_beads , n_beads ) ) for i in range ( n_beads ) : contributing_fors = np . where ( for_mapping == i ) [ 0 ] for j in range ( n_beads ) : contributing_revs = np . where ( rev_mapping == j ) [ 0 ] for cfor in contributing_fors : for crev in contributing_revs : cmatrix [ i , j ] += region [ cfor , crev ] cmatrix += cmatrix . T return cmatrix
Builds a square contact frequency matrix of shape (n_beads, n_beads).
Builds a square contact frequency matrix of shape ( n_beads n_beads ) .
"""
    Builds a square contact frequency matrix of shape (n_beads, n_beads).
    Contacts from restriction fragments mapping to the same bead are summed.
    A zero in this matrix means either that there was no data collected or that
    the number of counts is in fact zero. Later, we ignore zero-valued
    entries in the matrix.
    Return square contact frequency matrix.
    """
rev_mapping
for_mapping
region
n_beads