Question 2 of 6 Intermediate Scenario
How would you process a biological dataset too large for memory?
Short answer
Prefer chunked or columnar reading, bounded intermediate data and a streaming or partitioned algorithm. Measure memory use and preserve record-level correctness.
Why
First determine whether the pipeline truly requires all rows or just selected columns, samples or summary statistics. For a huge assay table, read chunks with explicit dtypes and compute mergeable per-group aggregates instead of concatenating every chunk. Partitioned Parquet can support column projection and filtering.
Dask can schedule out-of-core operations when partition sizes are safe for worker memory. Beware expensive shuffles and joins, duplicate identifiers and group-level statistics that cannot be computed correctly by simply averaging chunk means. Use checksums, row counts and tests on a known small reference dataset.
Record processing order when numerically sensitive reductions make exact floating-point agreement important. More parallelism does not help if each worker allocates a full input copy.
Common mistakes
- Calling read_csv in chunks but appending every chunk into a single giant in-memory DataFrame
The interviewer might ask next
How would you calculate a global mean correctly from unequal-sized chunks?