示例#1
0
def get_symmetric_well(well, is_384=False):
    """
    Get the well that is symmetric to the provided well.

    Well A is symmetric to well B if the two would swap positions if the
    plate were flipped 180 degrees.
    """
    if not is_proper_well_name(well):
        raise ValueError('{} is an improper well name'.format(well))

    rows, cols = get_rows_and_cols(is_384)

    row_idx = (len(rows) - 1) - rows.index(well[0])
    row = rows[row_idx]
    col = (len(cols) + 1) - int(well[1:])
    return get_well_name(row, col)
示例#2
0
def get_well_grid(is_384=False):
    """
    Get a 2D list representing the wells in one plate.

    is_384 param determines if the well list should be for 384-format
    plates, or 96-format plates. Defaults to 96-format.
    """
    rows, cols = get_rows_and_cols(is_384)

    plate = []
    for row in rows:
        this_row = []
        for column in cols:
            well = get_well_name(row, column)
            this_row.append(well)

        plate.append(this_row)

    return plate
示例#3
0
def get_well_list(is_384=False, vertical=False):
    """
    Get a list of all wells.

    is_384 param determines if the well list should be for 384-format plates,
    or 96-format plates. Defaults to 96-format plates.

    vertical param determines whether to list first by column or by row:
        - with vertical=False (the default), the order is:
            ['A01', 'A02', ..., 'A12', 'B01', 'B02', ..., 'B12', ...,
             'H01', 'H02', ..., 'H12']

        - with vertical=True, the order is:
            ['A01', 'B01', ..., 'H01', 'A02', 'B02', ..., 'H02', ...,
             'A12', 'B12', ..., 'H12']
    """
    rows, cols = get_rows_and_cols(is_384)

    if vertical:
        return _get_well_list_vertical(rows, cols)
    else:
        return _get_well_list_horizontal(rows, cols)
示例#4
0
def get_random_well(is_384=False):
    """Get a random well."""
    rows, cols = get_rows_and_cols(is_384)
    row = random.choice(rows)
    col = random.choice(cols)
    return get_well_name(row, col)