Skip to content

Usage

MethylSeq is two pipelines in one, chosen with --aligner:

  • bismark (default): Bismark with Bowtie2 as the aligner.
  • bismark_hisat: Bismark with HISAT2 as the aligner. HISAT2 also supports splice-aware alignment, e.g. for SLAM-seq experiments, with a file of known splice sites given with --known_splices.
  • bwameth: bwa-meth for the alignment and MethylDackel for the methylation calls.

All the parameters are listed on the parameters page.

The samples are given in a comma-separated samplesheet with a header row and 3 columns:

Terminal window
--input '[path to samplesheet file]'
Column Description
sample Sample name, without spaces.
fastq_1 Path to the FastQ file of read 1. The file has to be gzipped and have the extension .fastq.gz or .fq.gz.
fastq_2 Path to the FastQ file of read 2, for paired-end data. Leave it empty for single-end data.

The pipeline detects whether a sample is single-end or paired-end from the fastq_2 column, so a samplesheet can mix both:

samplesheet.csv
sample,fastq_1,fastq_2
CONTROL_S1,CONTROL_S1_R1.fastq.gz,CONTROL_S1_R2.fastq.gz
TREATMENT_S2,TREATMENT_S2_R1.fastq.gz,

An example samplesheet is provided with the pipeline.

The FastQ files of a sample sequenced more than once (e.g. on several lanes) are concatenated before the analysis. The pipeline groups the rows by the sample name without its last _ suffix, so in the samplesheet below the three rows are merged into one sample called CONTROL:

samplesheet.csv
sample,fastq_1,fastq_2
CONTROL_L002,CONTROL_L002_R1.fastq.gz,CONTROL_L002_R2.fastq.gz
CONTROL_L003,CONTROL_L003_R1.fastq.gz,CONTROL_L003_R2.fastq.gz
CONTROL_L004,CONTROL_L004_R1.fastq.gz,CONTROL_L004_R2.fastq.gz

The reference genome is given by its iGenomes name (--genome, e.g. GRCh38) or as a FASTA file (--fasta). The pipeline builds the Bismark or bwa-meth index and the FASTA index when they are not given. To reuse them in later runs, save them with --save_reference and give them with --bismark_index (or --bwa_meth_index) and --fasta_index.

The library preparation determines how the reads are trimmed and aligned. The presets below set the right options of Trim Galore! and Bismark:

Parameter Library
--rrbs Reduced representation bisulfite sequencing (MspI digested material), e.g. RRBS and cfRRBS.
--pbat Post-bisulfite adapter tagging (PBAT) libraries.
--em_seq Enzymatic methyl-seq (EM-seq) libraries.
--single_cell Single-cell bisulfite libraries.
--accel, --cegx, --epignome, --zymo Trimming presets for the Accel, CEGX, Epignome and Zymo kits.

Optical duplicates are copies of the same cluster on the flow cell, which are not removed by the deduplication of RRBS data. In the Bismark workflow, they are marked and removed with Picard MarkDuplicates before the deduplication.

Remove the optical duplicates (default: true). Use --remove_optic_duplicates false to keep them.

Sequencer used, which sets the maximum distance between optical duplicates (--OPTICAL_DUPLICATE_PIXEL_DISTANCE) of Picard MarkDuplicates:

--sequencer Pixel distance
NovaSeq (default) 12000
HiSeq 2500
NextSeq 100

Filtering of reads with an incomplete conversion

Section titled “Filtering of reads with an incomplete conversion”

Reads with a high methylation in non-CG context (CHG and CHH), where methylation is expected to be low (usually < 5%), most likely come from an incomplete bisulfite conversion. In the Bismark workflow, they can be removed with filter_non_conversion after the alignment.

Filter out the reads with an incomplete conversion (default: false).

Minimum number of cytosines in non-CG context in a read before the --percentage_cutoff filter is applied (default: 3).

Minimum methylation percentage in non-CG context for a read to be filtered out (default: 90).

methurator estimates how many new CpGs would be covered with more sequencing, from the deduplicated alignments of each sample. With --rrbs, it runs in RRBS mode.

Run the sequencing saturation analysis (default: true). Use --run_methurator false to skip it.

Maximum extrapolation factor t, i.e. up to how many times the current sequencing depth the saturation is estimated (default: 10).

Minimum number of reads covering a CpG to count it as covered (default: 1). Several values can be given, e.g. '1,3,5', to get one curve per value.

The typical command to run the pipeline is:

Terminal window
nextflow run VIBTOBIlab/MethylSeq --input ./samplesheet.csv --outdir ./results --genome GRCh38 -profile docker

This runs the pipeline with the docker profile (see -profile) and creates the following files in the working directory:

Terminal window
work # Directory containing the Nextflow working files
<OUTDIR> # Finished results in the specified location (defined with --outdir)
.nextflow.log # Log file from Nextflow
# Other Nextflow hidden files, e.g. history of pipeline runs and old logs.

To reuse the same parameters in several runs, write them in a YAML or JSON file and give it with -params-file:

Terminal window
nextflow run VIBTOBIlab/MethylSeq -profile docker -params-file params.yaml
params.yaml
input: ./samplesheet.csv
outdir: ./results
genome: GRCh38
rrbs: true

Nextflow caches the pipeline code the first time it runs it, and keeps using the cached version afterwards. Update it to the latest version with:

Terminal window
nextflow pull VIBTOBIlab/MethylSeq

Give a version of the pipeline with -r (e.g. -r v2.6.4), so that the same code and software versions are used every time. The versions are listed on the releases page, and the version used is reported at the bottom of the MultiQC report.

Configuration profile to use. Profiles set the software packaging (Docker, Singularity, Podman, Shifter, Charliecloud, Apptainer or Conda) and can be combined, e.g. -profile test,docker. They are loaded in order, so later profiles overwrite earlier ones. Without -profile, all software has to be installed and available on the PATH, which is not recommended.

The pipeline also loads the institutional profiles of nf-core/configs, e.g. for HPC clusters.

  • test: a small test dataset with all the parameters needed, to check the setup.
  • docker, singularity, podman, shifter, charliecloud, apptainer: run the processes in containers with the corresponding tool.
  • conda: run the processes in Conda environments. Use it only when containers cannot be used.

Restart a run from where it stopped, reusing the results of the steps whose inputs did not change. Give a run name (e.g. -resume [run-name]) to resume a specific run; nextflow log lists the previous runs. See this blog post for how Nextflow decides what to reuse.

Path to a custom configuration file, e.g. to change the resources of a process. See the nf-core documentation for more information.

Run Nextflow in the background, so that the pipeline keeps running when you log out. Alternatively, use screen or tmux, or submit Nextflow itself as a job to your cluster scheduler.

Each process has default CPUs, memory and time requests. Most processes that fail because they ran out of resources are retried with twice, then three times the original requests. To change the requests of a process, write them in a configuration file and give it with -c:

custom.config
process {
withName: 'NFCORE_METHYLSEQ:METHYLSEQ:BISMARK:BISMARK_ALIGN' {
cpus = 16
memory = 64.GB
}
}

See tuning workflow resources on the nf-core website for more details.

The arguments of a tool can be changed with the ext.args of its process, e.g. to add arguments that are not exposed as pipeline parameters. See customising tool arguments on the nf-core website.

To use another version of a tool, override the container (or conda) of its process in a configuration file. See updating tool versions on the nf-core website.

The Java virtual machine of Nextflow can request a large amount of memory. Limit it by adding the following line to your environment, e.g. in ~/.bashrc:

Terminal window
NXF_OPTS='-Xms1g -Xmx4g'