data/nora2012/make_processed_files.py
def calculate_mappings(region_revs, region_fors, bead_lims):
    """
    Calculates a mapping assigning a bead to each restriction fragment.
    If one restriction fragment spans several beads, it will have the center
    bead (or center - 1 for even number of beads) assigned.
    Returns the mappings for reverse and forward restriction fragments
    """
    region_revs = region_revs.T

    mappings = []
    for rfs in (region_revs, region_fors):

        mapping = []
        for b, e in rfs:
            mapping.append((np.where(bead_lims <= b)[0][-1],
                                np.where(bead_lims <= e)[0][-1]))
        mapping = np.array(mapping)
        mapping = mapping.mean(1).astype(int)

        mappings.append(mapping)

    return mappings[0], mappings[1]

    Calculates a mapping assigning a bead to each restriction fragment.
    If one restriction fragment spans several beads, it will have the center
    bead (or center - 1 for even number of beads) assigned.
    Returns the mappings for reverse and forward restriction fragments
    
Calculates a mapping assigning a bead to each restriction fragment.
If one restriction fragment spans several beads, it will have the center
bead (or center - 1 for even number of beads) assigned.
Returns the mappings for reverse and forward restriction fragments
Calculates a mapping assigning a bead to each restriction fragment . If one restriction fragment spans several beads it will have the center bead ( or center - 1 for even number of beads ) assigned . Returns the mappings for reverse and forward restriction fragments
def calculate_mappings(region_revs, region_fors, bead_lims):
    region_revs = region_revs.T
    mappings = []
    for rfs in (region_revs, region_fors):
        mapping = []
        for b, e in rfs:
            mapping.append((np.where(bead_lims <= b)[0][-1],
                                np.where(bead_lims <= e)[0][-1]))
        mapping = np.array(mapping)
        mapping = mapping.mean(1).astype(int)
        mappings.append(mapping)
    return mappings[0], mappings[1]
def calculate_mappings ( region_revs , region_fors , bead_lims ) : region_revs = region_revs . T mappings = [ ] for rfs in ( region_revs , region_fors ) : mapping = [ ] for b , e in rfs : mapping . append ( ( np . where ( bead_lims <= b ) [ 0 ] [ - 1 ] , np . where ( bead_lims <= e ) [ 0 ] [ - 1 ] ) ) mapping = np . array ( mapping ) mapping = mapping . mean ( 1 ) . astype ( int ) mappings . append ( mapping ) return mappings [ 0 ] , mappings [ 1 ]
Calculates a mapping assigning a bead to each restriction fragment.
Calculates a mapping assigning a bead to each restriction fragment .
"""
    Calculates a mapping assigning a bead to each restriction fragment.
    If one restriction fragment spans several beads, it will have the center
    bead (or center - 1 for even number of beads) assigned.
    Returns the mappings for reverse and forward restriction fragments
    """
region_revs
region_fors
bead_lims