def consistency_check(d): if len(d) != ROWS * COLUMNS: writer = ScreenWriter("foo", ROWS, COLUMNS, FIELDS) missing = [] for idx in range(ROWS * COLUMNS): k = writer.index2d(idx) if k not in d: missing.append(k) print("ERROR: missing well(s):", missing) for v in d.itervalues(): assert set(v) == set(EXPECTED_FIELDS)
def consistency_check(d): if len(d) != ROWS * COLUMNS: writer = ScreenWriter("foo", ROWS, COLUMNS, FIELDS) missing = [] for idx in xrange(ROWS * COLUMNS): k = writer.index2d(idx) if k not in d: missing.append(k) print "ERROR: missing well(s):", missing for v in d.itervalues(): assert set(v) == set(EXPECTED_FIELDS)
def write_screen(data_dir, plate, outf): d = group_files(data_dir) consistency_check(d) writer = ScreenWriter(plate, ROWS, COLUMNS, FIELDS, exclude_readers=EXCLUDE_READERS) for idx in range(ROWS * COLUMNS): well_coords = writer.index2d(idx) field_values = [] try: by_field = d[well_coords] except KeyError: sys.stderr.write("missing well: %r\n" % (well_coords,)) else: for i, field_coords in enumerate(EXPECTED_FIELDS): field_values.append(build_pattern(by_field[field_coords])) writer.add_well(field_values) writer.write(outf)
def write_screen(data_dir, plate, outf): d = group_files(data_dir) consistency_check(d) writer = ScreenWriter(plate, ROWS, COLUMNS, FIELDS, exclude_readers=EXCLUDE_READERS) for idx in xrange(ROWS * COLUMNS): well_coords = writer.index2d(idx) field_values = [] try: by_field = d[well_coords] except KeyError: sys.stderr.write("missing well: %r\n" % (well_coords,)) else: for i, field_coords in enumerate(EXPECTED_FIELDS): field_values.append(build_pattern(by_field[field_coords])) writer.add_well(field_values) writer.write(outf)