def bootstrap_predictions(train_x, train_y, test_x, model, boot_idx=None, permute_idx=None):
    """
    fits a model to training data and predicts output using test data. features are selected with boot_idx.
    Optional permutation of rows for significant testing.

    train_x, test_x: dataframes containing train and test data
    train_y: target value for model fitting
    model: sklearn regressor object, or Pipeline
    boot_idx: features to use for model
    permute_idx: permutation index to shuffle training data

    returns:
    pred: bootstrapped predictions of test data
    """

    # fit model with bootstrapped genes
    if boot_idx is None:
        if permute_idx is None:
            model.fit(train_x, train_y)
        else:
            model.fit(train_x.iloc[permute_idx,:], train_y)

        pred = model.predict(test_x)

    else:
        if permute_idx is None:
            model.fit(train_x.iloc[:,boot_idx], train_y)
            pred = model.predict(test_x.iloc[:,boot_idx])
        else:
            model.fit(train_x.iloc[permute_idx,boot_idx], train_y)
            pred = model.predict(test_x.iloc[:,boot_idx])

    return pred