20 Reproducible, publishable results
A result is reproducible when the same data and the same method give the same result again. To trust a result, you must be able to show how you obtained it. Reviewers, readers and your own future self need to know which data, software and settings produced each number. This chapter shows what to record, how to describe it in a paper, how to share the data, and how to check that an analysis gives the same answer when it is run again.
- what to record for each analysis: the data, the reference, the software, the settings and the commands;
- what the record of one EpiNexus run holds;
- how to use the methods text that EpiNexus writes;
- how to build a submission package for the Gene Expression Omnibus (GEO);
- how to run an analysis again and compare the two runs.
20.1 The question
Could someone else, or you in a year, get exactly the same result from the same data? And can you write down, for a paper, everything that was done?
20.2 What to record
Sandve and colleagues give ten simple rules for reproducible computational research (Sandve et al. 2013). Three of them matter most for a pipeline:
- Rule 1: “For Every Result, Keep Track of How It Was Produced”.
- Rule 3: “Archive the Exact Versions of All External Programs Used”.
- Rule 6: “For Analyses That Include Randomness, Note Underlying Random Seeds”.
For an epigenomics analysis, this means recording:
- the input data: which files, and their checksums (a fingerprint of a file’s content, such as MD5);
- the reference: the genome assembly, the gene annotation and the blacklist, with their versions (Chapter 3);
- the software: every tool and package, with its version;
- the settings: every parameter of every step;
- the commands: what was actually run, in which order.
A list of versions alone is not enough, because tools depend on other software, which can change too. A complete record therefore also fixes the whole software environment, for example as a container image with a unique digest.
Every run writes its own record. EpiNexus runs each analysis in one software image, built from fixed versions of the operating system packages, R and Bioconductor packages and Python packages. The run records the image’s digest, so the same image can be used again. It also fixes the order of the aligner’s output, and the random seeds of the steps that use random numbers.
The record is part of the GEO submission package (see below), in the folder provenance/.
The Regulatory Atlas compares a finished run with public chromatin data. This data comes in releases, each with fixed files and a date. The comparison records which release it used, and a newer release is never applied automatically: the page offers Compare again with release …. The Data sources page, at the bottom of the sidebar, lists every source of the atlas with its version, its licence and what to cite. When a run has a comparison, its methods text describes it.
20.3 The record of one run
The record of a run is the set of files that describe how its results were made. The GEO package of the heart run (Chapter 16) holds the files listed in Table 20.1.
provenance/ folder of a GEO submission package (run cafc042f).
| File | What it holds |
|---|---|
tool_versions.json |
Every tool and package version (for example Bowtie2 2.5.4, MACS3 3.0.4, DESeq2 1.50.2), the EpiNexus version (1.2.0) and the software image’s digest |
environment.txt |
The full list of installed packages in the image (868 lines), and the dates of the package snapshots it was built from |
commands.tsv |
All 129 commands that ran, with their start time, duration and exit code |
params.effective.json, settings.json |
Every parameter and setting the run used |
samplesheet.csv, inputs.json |
The samples, and where their files came from (here, GEO and ENA accessions with checksums) |
reference.json |
The genome build, the annotation and the blacklist |
20.4 Writing the methods
EpiNexus writes a methods text for each run, from this record. The text names each tool with its version and each setting that mattered. For the heart run, it begins:
8 ChIP-seq libraries were processed (single-end) against Mouse (mm10/GRCm38). … Adapters and low-quality bases were trimmed with Trim Galore (v0.6.10) using Cutadapt (v4.7) … Reads were aligned with Bowtie2 (v2.5.4).
The text is a draft, not a final version. Read it, check that it says what you did, and add what EpiNexus cannot know: the biology, the samples, and any steps you did outside EpiNexus.
The methods text is in the run’s report (Reports page) and in the GEO package (methods.md). Exported figures have a resolution of 300 dpi. The report states the EpiNexus version and the software image used.
20.6 Running an analysis again
The best test of reproducibility is to run the analysis again and compare the results.
On a finished run’s page, Run again starts a new run with the same samples and settings, using the current software (Chapter 4). The new run gets its own record, so the two can be compared. Before it starts, a dialog says what will be the same and what may differ (Figure 20.2).
We ran the heart dataset twice: first with EpiNexus 1.1.0 (run 93a23cb5), then again with 1.2.0 (run cafc042f). We then compared the processed files of the two GEO packages (Table 20.2).
| Files | Same in both runs? | Why |
|---|---|---|
| Peaks (4), reproducible peaks (2), peak annotation (4) | Yes, byte for byte | These steps did not change |
| Super-enhancers (4), enhancer–gene links (4) | Yes, byte for byte | These steps did not change |
| GO enrichment of each sample’s peaks (4), QC table | Yes, byte for byte | These steps did not change |
| Motifs in all peaks (AME) | Same results; family names replaced | Version 1.2 takes the motif families from JASPAR |
| Differential tables, GO of the changed regions | No | Version 1.2 changed how H3K27ac regions are defined and tested |
| Motifs in changed regions, pooled regions | New in 1.2 | New analyses |
| MultiQC report | No | It names its own run, and it lists the new pooled peak call as an extra sample. Three fingerprint scores (the CHANCE values) differed by less than 0.3 % |
Twenty-three files were identical, byte for byte, although the runs used different versions of EpiNexus and different machines. Apart from the MultiQC report, the files that changed were those of the steps that version 1.2 changed. This is the behaviour expected of a reproducible pipeline: the same data and the same method give the same result, and a change in the result can be traced to a change in the method.
A run keeps the results and the quality control (QC) grades of the version that made it. When a later version changes a method, older runs do not change. For example, version 1.2.7 grades quality control in a new way (Chapter 6), and version 1.3.0 counts a long, split region only once in GO enrichment (Chapter 11). Run again applies the current methods, and the two records show what differs.
If you run an analysis again with a newer version, some results may change. Report in your paper which version produced the results, and keep the record of each run.
Every manual step, such as deleting rows from a table in a spreadsheet, leaves no record. Sandve and colleagues’ second rule is “Avoid Manual Data Manipulation Steps” (Sandve et al. 2013). Filter and sort with tools that keep a record, or describe each manual step in your methods.
Key points
- A result is reproducible when the same data and the same method give the same result again.
- Record the input data with their checksums, the reference, the software with its versions, the settings and the commands. A container image fixes the whole software environment.
- Every EpiNexus run writes its own record, which the GEO submission package holds in the folder
provenance/. - The methods text that EpiNexus writes is a draft: check it, and add what EpiNexus cannot know.
- The GEO package holds no raw FASTQ files: upload the files you sequenced yourself.
- Run again applies the current methods, and the two records show what differs. In the heart example, twenty-three files were identical, byte for byte, between the runs with EpiNexus 1.1.0 and 1.2.0.