Introduction

nf-core/methylong is a bioinformatics pipeline that processes modification basecalled ONT reads or PacBio HiFi reads (modBam) by performing preprocessing steps (including trimming and tag repair), aligning them to the provided genome assembly, and extracting methylation calls into BED/BEDGraph format, ready for direct downstream analysis.

ONT workflow:

  1. trim and repair tags of input modBam

    • trim and repair workflow:
      1. sort modBam - samtools sort
      2. convert modBam to fastq - samtools fastq
      3. trim barcode and adapters - porechop
      4. convert trimmed modfastq to modBam - samtools import
      5. repair MM/ML tags of trimmed modBam - modkit repair
  2. align to reference (plus sorting and indexing) - dorado aligner

    • include alignment summary - samtools flagstat
  3. create bedMethyl - modkit pileup

  4. create bedgraphs (optional)

PacBio workflow:

  1. align to reference - pbmm2 (default) or minimap2

    • minimap workflow:

      1. convert modBam to fastq - samtools convert
      2. alignment - minimap2
      3. sort and index - samtools sort
      4. alignment summary - samtools flagstat
    • pbmm2 workflow:

      1. alignment and sorting - pbmm2
      2. index - samtools index
      3. alignment summary - samtools flagstat
  2. create bedMethyl - pb-CpG-tools (default) or modkit pileup

  3. create bedgraph (optional)

Usage

Note

If you are new to Nextflow and nf-core, please refer to this page on how to set-up Nextflow. Make sure to test your setup with -profile test before running the workflow on actual data.

First, prepare a samplesheet with your input data that looks as follows:

samplesheet.csv:

sample,modbam,ref,method
Col_0,ont_modbam.bam,Col_0.fasta,ont
ColumnContent
sampleName of the sample
modBamPath to basecalled modBam file
refPath to assembly fasta/fa file
methodspecify ont / pacbio

Now, you can run the pipeline using:

nextflow run nf-core/methylong \
   -profile <docker/singularity/.../institute> \
   --input samplesheet.csv \
   --outdir <OUTDIR>
Warning

Please provide pipeline parameters via the CLI or Nextflow -params-file option. Custom config files including those provided by the -c Nextflow option can be used to provide any configuration except for parameters; see docs.

For more details and further functionality, please refer to the usage documentation and the parameter documentation.

Parameters

ParameterPurpose
--samplesheetpath to samplesheet
--outdirresults directory, default: './results'
--no_trimskip trimming in ONT workflow, process will start directly alignment
--aligneraligner option in PacBio workflow, default is pbmm2, specify minimap2 to switch
--pileup_methodpileup method in PacBio workflow, default is pbcpgtools, specify modkit to switch
--pileup_countspecify pbcpgtools pileup mode, default is using model mode, specify this argument to switch to count mode
--bedgraphindicate if required bedgraphs as output

Pipeline output

To see the results of an example test run with a full size dataset refer to the results tab on the nf-core website pipeline page. For more details about the output files and reports, please refer to the output documentation.

Folder stuctures of the outputs:

 
β”œβ”€β”€ ont/sampleName
β”‚   β”‚
β”‚   β”œβ”€β”€ trim
β”‚   β”‚   β”œβ”€β”€ trimmed.fastq.gz
β”‚   β”‚   β”œβ”€β”€ trimmed.bam
β”‚   β”‚   └── trimmed.log
β”‚   β”‚
β”‚   β”œβ”€β”€ repair
β”‚   β”‚   β”œβ”€β”€ repaired.bam
β”‚   β”‚   └── repaired.log
β”‚   β”‚
β”‚   β”œβ”€β”€ alignment
β”‚   β”‚   β”œβ”€β”€ aligned.bam
β”‚   β”‚   β”œβ”€β”€ aligned.bai
β”‚   β”‚   β”œβ”€β”€ summary.txt
β”‚   β”‚   └── aligned.flagstat
β”‚   β”‚
β”‚   β”œβ”€β”€ pileup/modkit
β”‚   β”‚   β”œβ”€β”€ pileup.bed
β”‚   β”‚   └── pileup.log
β”‚   β”‚
β”‚   └── bedgraph
β”‚       └── bedgraphs
β”‚ 
β”‚  
└── pacbio/sampleName
    β”‚
    β”œβ”€β”€ aligned_minimap2/ aligned_pbmm2
    β”‚   β”œβ”€β”€ aligned.bam
    β”‚   β”œβ”€β”€ aligned.bai/csi
    β”‚   └── aligned.flagstat
    β”‚
    β”œβ”€β”€ pileup: modkit/pb_cpg_tools
    β”‚   β”œβ”€β”€ pileup.bed
    β”‚   β”œβ”€β”€ pileup.log
    β”‚   └── pileup.bw (only pb_cpg_tools)
    β”‚
    └── bedgraph
        └── bedgraphs
 

Credits

nf-core/methylong was originally written by Jin Yan Khoo.

We thank the following people for their extensive assistance in the development of this pipeline:

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines.

For further information or help, don’t hesitate to get in touch on the Slack #methylong channel (you can join with this invite).

Citations

An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x.