def get_rows_to_keep(gctoo, rid=None, row_bool=None, ridx=None, exclude_rid=None):
    """ Figure out based on the possible row inputs which rows to keep.

    Args:
        gctoo (GCToo object):
        rid (list of strings):
        row_bool (boolean array):
        ridx (list of integers):
        exclude_rid (list of strings):

    Returns:
        rows_to_keep (list of strings): row ids to be kept

    """
    # Use rid if provided
    if rid is not None:
        assert type(rid) == list, "rid must be a list. rid: {}".format(rid)

        rows_to_keep = [gctoo_row for gctoo_row in gctoo.data_df.index if gctoo_row in rid]

        # Tell user if some rids not found
        num_missing_rids = len(rid) - len(rows_to_keep)
        if num_missing_rids != 0:
            logger.info("{} rids were not found in the GCT.".format(num_missing_rids))

    # Use row_bool if provided
    elif row_bool is not None:

        assert len(row_bool) == gctoo.data_df.shape[0], (
            "row_bool must have length equal to gctoo.data_df.shape[0]. " +
            "len(row_bool): {}, gctoo.data_df.shape[0]: {}".format(
                len(row_bool), gctoo.data_df.shape[0]))
        rows_to_keep = gctoo.data_df.index[row_bool].values

    # Use ridx if provided
    elif ridx is not None:

        assert type(ridx[0]) is int, (
            "ridx must be a list of integers. ridx[0]: {}, " +
            "type(ridx[0]): {}").format(ridx[0], type(ridx[0]))

        assert max(ridx) <= gctoo.data_df.shape[0], (
            "ridx contains an integer larger than the number of rows in " +
            "the GCToo. max(ridx): {}, gctoo.data_df.shape[0]: {}").format(
                max(ridx), gctoo.data_df.shape[0])

        rows_to_keep = gctoo.data_df.index[ridx].values

    # If rid, row_bool, and ridx are all None, return all rows
    else:
        rows_to_keep = gctoo.data_df.index.values

    # Use exclude_rid if provided
    if exclude_rid is not None:

        # Keep only those rows that are not in exclude_rid
        rows_to_keep = [row_to_keep for row_to_keep in rows_to_keep if row_to_keep not in exclude_rid]

    return rows_to_keep
Figure out based on the possible row inputs which rows to keep.

    Args:
        gctoo (GCToo object):
        rid (list of strings):
        row_bool (boolean array):
        ridx (list of integers):
        exclude_rid (list of strings):

    Returns:
        rows_to_keep (list of strings): row ids to be kept