Download analyses as CSV

Fetch a study’s analyses, select columns, and download a CSV file.

Fetch all analyses for a study, choose the columns you need, and save the table to your computer. Edit and run the cells in order.

Choose a study

Replace STUDY with another MGnify study accession to download its analyses.

Collect the analyses

The API returns results in pages. Collect each page, then flatten the nested sample and assembly records into dataframe columns.

Choose columns and download

Edit the column list below, or use selected = analyses to keep every column. You can also filter rows before exporting. Run this cell again after making changes to update the download.

The CSV contains the selected rows and columns.

Running this code in your own environment

Install the packages from a terminal:

python -m pip install pandas requests

Run the Python cells in a notebook or script. Save the selected dataframe with selected.to_csv("analyses.csv", index=False).