def merge_residual_mapping(guide_residuals, guide_mapping, residual_construct_col, mapping_construct_col):
    """Join guide residual df and mapping to genes

    Parameters
    ----------
    guide_residuals: DataFrame
        Guide-level residuals
    guide_mapping: DataFrame
        Mapping between guides and genes
    residual_construct_col: str
        Name of column with constructs in the residual DataFrame
    mapping_construct_col: str
        Name of column with constructs in the guide/gene mapping file

    Returns
    -------
    DataFrame
        Guide residuals mapped to genes
    """
    mapped_guide_residuals = guide_residuals.merge(guide_mapping, how='inner',
                                                   left_on=residual_construct_col,
                                                   right_on=mapping_construct_col)
    return mapped_guide_residuals