def marker_intersection(query, reference, features):
    """Subset matricies down to an intersection of features.
    
    Arguments:
        query (pandas DataFrame): samples x feature (row x col) matrix
        reference (pandas DataFrame): samples x feature matrix (row x col) matrix
        features (list): column ids that are in query and reference
    
    Returns:
        (pd.DataFrame, pd.DataFrame): tuple of modified matrices
    """
    features = set(features)
    q_features = set(query.columns)
    r_features = set(reference.columns)
    both_have = q_features.intersection(r_features).intersection(features)
    both_have = list(both_have)
    return query[both_have], reference[both_have]