Introduction

The oncoanalyser pipeline typically runs from FASTQs or BAMs and supports two modes: (1) whole genome and/or transcriptome, and (2) targeted panel. Launching an analysis requires only the creation of a samplesheet that describes details of each input such as the sample type (tumor or normal), sequence type (DNA or RNA), and filepath.

Various aspects of an oncoanalyser analysis can be configured to fit a range of needs, and many of these are considered advanced usage of the pipeline. The most useful include:

  • precise process selection
  • starting from existing data
  • granular control over reference/resource files

These features enable oncoanalyser to be run in a highly flexible way. For example, an analysis can be run with existing PURPLE data as the starting point and skip variant calling processes. Additionally, reference/resource files can be staged locally to optimise execution or modified to create user-defined driver gene panels.

Danger

When starting from BAMs rather than FASTQ it is expected that:

  • RNA read alignments are generated with STAR using specific parameters, this is critical for WTS data, and
  • reads are aligned to a Hartwig-distributed reference genome (custom genomes can be used but are not recommended)

Supported analyses

A variety of analyses are accessible in oncoanalyser and are implicitly run according to the data described in the samplesheet. The supported analysis types for each workflow are listed below.

Input sequence dataWGS/WTS workflowTargeted sequencing workflow*
• Tumor/normal DNA
• Tumor RNA
-
• Tumor only DNA
• Tumor RNA
• Tumor/normal DNA-
• Tumor only DNA
• Tumor only RNA-

* Supported analyses relate to the TSO500 panel only

Note

The default settings of oncoanalyser will accommodate typical sequencing depths for sample inputs and each individual tool is generally sequencing depth agnostic. However, variant calling is optimised for 100x tumor and 40x normal when invoked in wgts mode and expects sparse high-depth read data characteristic of panel sequencing when run in targeted mode. For atypical input sequence data you may consult the hmftools documentation and configure oncoanalyser accordingly.

Samplesheet

A samplesheet that contains information of each input in CSV format is needed to run oncoanalyser. The required input details and columns are described below.

Several different input filetypes beyond FASTQ and BAM are recognised, including intermediate output files generated during execution such as the PURPLE output directory. The full list of recognised input filetypes is available here.

Simple example

FASTQ

Note

Currently only non-interleaved paired-end reads are accepted as FASTQ input.

samplesheet.csv
group_id,subject_id,sample_id,sample_type,sequence_type,filetype,info,filepath
P1_wgts,P1,SA,normal,dna,fastq,library_id:SA_library;lane:001,/path/to/P1.SA.normal.dna.wgs.001.R1.fastq.gz;/path/to/P1.SA.normal.dna.wgs.001.R2.fastq.gz
P1_wgts,P1,SB,tumor,dna,fastq,library_id:SB_library;lane:001,/path/to/P1.SB.tumor.dna.wgs.001.R1.fastq.gz;/path/to/P1.SB.tumor.dna.wgs.001.R2.fastq.gz
P1_wgts,P1,SC,tumor,rna,fastq,library_id:SC_library;lane:001,/path/to/P1.SC.tumor.rna.wts.001.R1.fastq.gz;/path/to/P1.SC.tumor.rna.wts.001.R2.fastq.gz

BAM

Note

Inputs with the bam filetype will be processed by MarkDups as required by hmftools. Where an input BAM has already been processed specifically by HMF MarkDups, you can avoid needless reprocessing by setting bam_markdups as the filetype instead. It is important to understand that duplicate marking by other tools (e.g. GATK) cannot be used as a substitute since HMF MarkDups performs key operations beyond just duplicate marking.


Please note there are other essential requirements around the use of BAMs as inputs, see the warning above in the Introduction.

samplesheet.csv
group_id,subject_id,sample_id,sample_type,sequence_type,filetype,filepath
P1_wgts,P1,SA,normal,dna,bam,/path/to/P1.SA.normal.dna.wgs.bam
P1_wgts,P1,SB,tumor,dna,bam,/path/to/P1.SB.tumor.dna.wgs.bam
P1_wgts,P1,SC,tumor,rna,bam,/path/to/P1.SC.tumor.rna.wts.bam

Multiple lanes

samplesheet.csv
group_id,subject_id,sample_id,sample_type,sequence_type,filetype,info,filepath
P1_wgts,P1,SA,normal,dna,fastq,library_id:SA_library;lane:001,/path/to/P1.SA.normal.dna.wgs.001.R1.fastq.gz;/path/to/P1.SA.normal.dna.wgs.001.R2.fastq.gz
P1_wgts,P1,SA,normal,dna,fastq,library_id:SA_library;lane:002,/path/to/P1.SA.normal.dna.wgs.002.R1.fastq.gz;/path/to/P1.SA.normal.dna.wgs.002.R2.fastq.gz
P1_wgts,P1,SB,tumor,dna,fastq,library_id:SB_library;lane:001,/path/to/P1.SB.tumor.dna.wgs.001.R1.fastq.gz;/path/to/P1.SB.tumor.dna.wgs.001.R2.fastq.gz
P1_wgts,P1,SB,tumor,dna,fastq,library_id:SB_library;lane:002,/path/to/P1.SB.tumor.dna.wgs.002.R1.fastq.gz;/path/to/P1.SB.tumor.dna.wgs.002.R2.fastq.gz
P1_wgts,P1,SC,tumor,rna,fastq,library_id:SC_library;lane:001,/path/to/P1.SC.tumor.rna.wts.001.R1.fastq.gz;/path/to/P1.SC.tumor.rna.wts.001.R2.fastq.gz

Multiple patients

samplesheet.csv
group_id,subject_id,sample_id,sample_type,sequence_type,filetype,info,filepath
P1_wgts,P1,SA,normal,dna,fastq,library_id:SA_library;lane:001,/path/to/P1.SA.normal.dna.wgs.001.R1.fastq.gz;/path/to/P1.SA.normal.dna.wgs.001.R2.fastq.gz
P1_wgts,P1,SB,tumor,dna,fastq,library_id:SB_library;lane:001,/path/to/P1.SB.tumor.dna.wgs.001.R1.fastq.gz;/path/to/P1.SB.tumor.dna.wgs.001.R2.fastq.gz
P2_wgts,P2,SA,normal,dna,fastq,library_id:SA_library;lane:001,/path/to/P2.SA.normal.dna.wgs.001.R1.fastq.gz;/path/to/P2.SA.normal.dna.wgs.001.R2.fastq.gz
P2_wgts,P2,SB,tumor,dna,fastq,library_id:SB_library;lane:001,/path/to/P2.SB.tumor.dna.wgs.001.R1.fastq.gz;/path/to/P2.SB.tumor.dna.wgs.001.R2.fastq.gz

Column descriptions

ColumnDescription
group_idGroup ID for a set of samples and inputs
subject_idSubject/patient ID
sample_idSample ID
sample_typeSample type: tumor, normal
sequence_typeSequence type: dna, rna
filetypeFile type: e.g. fastq, bam, bai
infoAdditional input information: library_id, lane, cancer_type [optional]
filepathAbsolute filepath to input file (can be local filepath, URL, S3 URI)

The identifiers provided in the samplesheet are used to set output file paths:

  • group_id: top-level output directory for analysis files e.g. output/COLO829_example/
  • tumor sample_id: output prefix for most filenames e.g. COLO829T.purple.sv.vcf.gz
  • normal sample_id: output prefix for some filenames e.g. COLO829R.cobalt.ratio.pcf

Running the pipeline

The typical command for running the pipeline is as follows:

nextflow run nf-core/oncoanalyser \
  -profile docker \
  -revision dev \
  --mode <wgts|targeted> \
  --genome <GRCh37_hmf|GRCh38_hmf> \
  --input samplesheet.csv \
  --outdir <output_directory>

This will launch the pipeline with the docker configuration profile. See below for more information about profiles.

Note

Reference data will be retrieved by oncoanalyser for every analysis run. It is therefore strongly recommended when running multiple analyses to pre-stage reference data locally to avoid it being retrieved multiple times. See Staging reference data.

Note that the pipeline will create the following files in your working directory:

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

If you wish to repeatedly use the same parameters for multiple runs, rather than specifying each flag in the command, you can specify these in a params file.

Pipeline settings can be provided in a yaml or json file via -params-file <file>.

Warning

Do not use -c <file> to specify parameters as this will result in errors. Custom config files specified with -c must only be used for tuning process resource specifications, other infrastructural tweaks (such as output directories), or module arguments (args).

The above pipeline run specified with a params file in yaml format:

nextflow run nf-core/oncoanalyser -profile docker -params-file params.yaml

with:

params.yaml
mode: 'wgts'
genome: 'GRCh38_hmf'
input: './samplesheet.csv'
outdir: './results/'
<...>

You can also generate such YAML/JSON files via nf-core/launch.

Updating the pipeline

When you run the above command, Nextflow automatically pulls the pipeline code from GitHub and stores it as a cached version. When running the pipeline after this, it will always use the cached version if available - even if the pipeline has been updated since. To make sure that you’re running the latest version of the pipeline, make sure that you regularly update the cached version of the pipeline:

nextflow pull nf-core/oncoanalyser

Reproducibility

It is a good idea to specify a pipeline version when running the pipeline on your data. This ensures that a specific version of the pipeline code and software are used when you run your pipeline. If you keep using the same tag, you’ll be running the same version of the pipeline, even if there have been changes to the code since.

First, go to the nf-core/oncoanalyser releases page and find the latest pipeline version - numeric only (eg. 1.0.0). Then specify this when running the pipeline with -r (one hyphen) - eg. -r 1.0.0. Of course, you can switch to another version by changing the number after the -r flag.

This version number will be logged in reports when you run the pipeline, so that you’ll know what you used when you look back in the future. For example, in the <outdir>/pipeline_info/software_versions.yml file.

To further assist in reproducbility, you can share and re-use parameter files to repeat pipeline runs with the same settings without having to write out a command with every single parameter.

Tip

If you wish to share such profile (such as upload as supplementary material for academic publications), make sure to NOT include cluster specific paths to files, nor institutional specific profiles.

Advanced usage

Selecting processes

Most of the major components in oncoanalyser can be skipped using --processes_exclude (the full list of available processes can be viewed here). Multiple processes can be given as a comma-separated list. While there are some use-cases for this feature (e.g. skipping resource intensive processes such as VIRUSBreakend), it becomes more powerful when combined with existing inputs as described in the following section.

Warning

When skipping components no checks are done to identify orphan processes in the execution DAG or for redundant processes.

Existing inputs

The oncoanalyser pipeline has been designed to allow entry at arbitrary points, which is particularly useful in situations where previous outputs exist and re-running oncoanalyser is desired (e.g. to subsequently execute an optional sensor/workflow or re-run an analysis with an upgraded tool such as PURPLE). The primary advantage of this approach is that only the required processes are executed, reducing costs and runtimes by skipping unnecessary processes.

In order to effectively utilise this feature, existing inputs must be set in the samplesheet and the appropriate processes selected. Take the below example where existing PURPLE inputs are used so that all upstream variant calling can be skipped:

group_id,subject_id,sample_id,sample_type,sequence_type,filetype,filepath
P1_wgts,P1,SA,normal,dna,bam,/path/to/P1.SA.normal.dna.wgs.bam
P1_wgts,P1,SB,tumor,dna,bam,/path/to/P1.SB.tumor.dna.wgs.bam
P1_wgts,P1,SB,tumor,dna,purple_dir,/path/to/P1.purple_dir/
Note

The original source input file (i.e. BAM or FASTQ) must always be provided for oncoanalyser to infer the correct analysis type.

And now run and skip variant calling:

nextflow run nf-core/oncoanalyser \
  -profile docker \
  -revision dev \
  --mode wgts \
  --processes_exclude markdups,amber,cobalt,gridss,gripss,sage,pave \
  --genome GRCh38_hmf \
  --input samplesheet.csv \
  --outdir output/
Warning

Providing existing inputs will cause oncoanalyser to skip the corresponding process but not any of the upstream processes. It is the responsibility of the user to skip all relevant processes.

Configuring reference data

All reference data can be configured as needed, and are defined in the following locations:

Reference dataFilepathNote
Genomes and indexesconf/hmf_genomes.configAbsolute paths
hmftools resource filesconf/hmf_data.configPaths relative to data bundle directory
Panel resource filesconf/panel_data.configPaths relative to data bundle directory

See the below sections for further details on customising reference data.

Customising hmf data

To override hmftools resource files, first stage the bundle locally then copy in your custom file under the bundle directory and create a new config with relevant file paths:

hmf_data.custom.config
params {
    hmf_data_paths {
        '38' {
            driver_gene_panel     = 'custom_files/DriverGenePanel.tsv'
            sage_actionable_panel = 'custom_files/ActionableCodingPanel.bed.gz'
            sage_coverage_panel   = 'custom_files/CoverageCodingPanel.bed.gz'
        }
    }
}

To use these hmftools resource file overrides in oncoanalyser the local bundle directory must be provided with --ref_data_hmf_data_path.

Customising other data

The path or URI to the VIRUSBreakend database can also be explicitly set with --ref_data_virusbreakenddb_path. There are additional arguments to manually set various other reference data files, please review the parameters documentation for the complete list.

Staging reference data

Default reference data can be staged locally with oncoanalyser by providing a samplesheet for the desired analysis and setting the --prepare_reference_only argument. The samplesheet and oncoanalyser configuration will determine the relevant reference data to download. For example the following command will download the GRCh38_hmf genome plus indices, reference data, and databases required to run a WGTS analysis for tumor/normal DNA with tumor RNA:

samplesheet.csv
group_id,subject_id,sample_id,sample_type,sequence_type,filetype,filepath
P1_wgts,P1,SA,normal,dna,bam,/path/to/P1.SA.normal.dna.wgs.bam
P1_wgts,P1,SB,tumor,dna,bam,/path/to/P1.SB.tumor.dna.wgs.bam
P1_wgts,P1,SC,tumor,rna,bam,/path/to/P1.SC.tumor.rna.wts.bam
nextflow run nf-core/oncoanalyser \
  -profile docker \
  -revision dev \
  --mode wgts \
  --genome GRCh38_hmf \
  --prepare_reference_only \
  --input samplesheet.csv \
  --outdir prepare_reference/

Executing the above command will download and unpack default reference data without running any analysis, and once complete the prepared reference files can found in ./prepare_reference/reference_data/1.1.0dev/<datetimestamp>/. It is recommended to remove the Nextflow work directory after staging data to free disk space.

For oncoanalyser to use locally staged reference data a custom config can be used:

refdata.local.config
params {
 
    genomes {
        GRCh38_hmf {
            fasta           = "/path/to/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna"
            fai             = "/path/to/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.fai"
            dict            = "/path/to/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.dict"
            bwamem2_index   = "/path/to/bwa-mem2_index/"
            gridss_index    = "/path/to/gridss_index/"
            star_index      = "/path/to/star_index/"
        }
    }
 
    ref_data_hmf_data_path        = "/path/to/hmftools_data/"
    ref_data_panel_data_path      = "/path/to/tso500_panel_data/"
    ref_data_virusbreakenddb_path = "/path/to/virusbreakenddb/"
}

Specific reference files can also be downloaded directly from the hosting service with the corresponding URL.

Reference data URLs

GRCh37 genome (Hartwig) [GRCh37_hmf]

GRCh38 genome (Hartwig) [GRCh38_hmf]

Other reference data

TypeName
hmftools data (GRCh37)hmftools/5.34_37—2.tar.gz
hmftools data (GRCh38)hmftools/5.34_38—2.tar.gz
TSO500 data (GRCh37)panels/tso500_5.34_37—1.tar.gz
TSO500 data (GRCh38)panels/tso500_5.34_38—1.tar.gz
HLA slice BEDhla_slice/grch38_alt.plus_homologous.bed
VIRUSBreakend databasevirusbreakenddb_20210401.tar.gz

Custom genomes

It is strongly recommended to use a Hartwig-distributed reference genome for alignments and subsequent analysis (GRCh37_hmf or GRCh38_hmf). Where it is not feasible to do so, a custom genome can instead be used by providing the relevant FASTA file in a configuration file:

params {
    genomes {
        CustomGenome {
            fasta = "/path/to/custom_genome.fa"
        }
    }
}

Each index required for the analysis will first be created before running the rest of oncoanalyser with the following command:

Note

In a process similar to staging reference data, you can first generate the required indexes by setting --prepare_reference_only and then provide the prepared reference files to oncoanalyser through a custom config file. This avoids having to regenerate indexes for each new analysis.

nextflow run nf-core/oncoanalyser \
  -profile docker \
  -revision dev \
  -config genome.custom.config \
  --mode wgts \
  \
  --genome CustomGenome \
  --genome_version <37|38> \
  --genome_type <alt|no_alt> \
  --force_genome \
  \
  --input samplesheet.csv \
  --outdir output/

Creation of a STAR index also requires transcript annotations, please provide either of the following GTF files via the --ref_data_genome_gtf option after decompressing:

Warning

STAR index must use transcript annotations from Ensembl versions that match hmftools resource data (GRCh37: v74; GRCh38: v104).

When creating indexes for reference genomes with alternative haplotypes, an ALT file must be given with --ref_data_genome_alt. Importantly, a STAR index will not be generated for reference genomes with alternative haplotypes since this requires careful processing and is hence left to the user.

Core Nextflow arguments

Note

These options are part of Nextflow and use a single hyphen (pipeline parameters use a double-hyphen).

-profile

Use this parameter to choose a configuration profile. Profiles can give configuration presets for different compute environments.

Several generic profiles are bundled with the pipeline which instruct the pipeline to use software packaged using different methods (Docker, Singularity, Podman, Shifter, Charliecloud, Apptainer, Conda) - see below.

Info

We highly recommend the use of Docker or Singularity containers for full pipeline reproducibility, however when this is not possible, Conda is also supported.

The pipeline also dynamically loads configurations from https://github.com/nf-core/configs when it runs, making multiple config profiles for various institutional clusters available at run time. For more information and to see if your system is available in these configs please see the nf-core/configs documentation.

Note that multiple profiles can be loaded, for example: -profile test,docker - the order of arguments is important! They are loaded in sequence, so later profiles can overwrite earlier profiles.

If -profile is not specified, the pipeline will run locally and expect all software to be installed and available on the PATH. This is not recommended, since it can lead to different results on different machines dependent on the computer environment.

  • test
    • A profile with a complete configuration for automated testing
    • Includes links to test data so needs no other parameters
  • docker
    • A generic configuration profile to be used with Docker
  • singularity
    • A generic configuration profile to be used with Singularity
  • podman
    • A generic configuration profile to be used with Podman
  • shifter
    • A generic configuration profile to be used with Shifter
  • charliecloud
    • A generic configuration profile to be used with Charliecloud
  • apptainer
    • A generic configuration profile to be used with Apptainer
  • wave
    • A generic configuration profile to enable Wave containers. Use together with one of the above (requires Nextflow 24.03.0-edge or later).
  • conda
    • A generic configuration profile to be used with Conda. Please only use Conda as a last resort i.e. when it’s not possible to run the pipeline with Docker, Singularity, Podman, Shifter, Charliecloud, or Apptainer.

-resume

Specify this when restarting a pipeline. Nextflow will use cached results from any pipeline steps where the inputs are the same, continuing from where it got to previously. For input to be considered the same, not only the names must be identical but the files’ contents as well. For more info about this parameter, see this blog post.

You can also supply a run name to resume a specific run: -resume [run-name]. Use the nextflow log command to show previous run names.

-c

Specify the path to a specific config file (this is a core Nextflow command). See the nf-core website documentation for more information.

Custom configuration

Resource requests

Whilst the default requirements set within the pipeline will hopefully work for most people and with most input data, you may find that you want to customise the compute resources that the pipeline requests. Each step in the pipeline has a default set of requirements for number of CPUs, memory and time. For most of the steps in the pipeline, if the job exits with any of the error codes specified here it will automatically be resubmitted with higher requests (2 x original, then 3 x original). If it still fails after the third attempt then the pipeline execution is stopped.

To change the resource requests, please see the max resources and tuning workflow resources section of the nf-core website.

Custom containers

In some cases you may wish to change which container or conda environment a step of the pipeline uses for a particular tool. By default nf-core pipelines use containers and software from the biocontainers or bioconda projects. However in some cases the pipeline specified version maybe out of date.

To use a different container from the default container or conda environment specified in a pipeline, please see the updating tool versions section of the nf-core website.

Custom tool arguments

A pipeline might not always support every possible argument or option of a particular tool used in pipeline. Fortunately, nf-core pipelines provide some freedom to users to insert additional parameters that the pipeline does not include by default.

To learn how to provide additional arguments to a particular tool of the pipeline, please see the customising tool arguments section of the nf-core website.

nf-core/configs

In most cases, you will only need to create a custom config as a one-off but if you and others within your organisation are likely to be running nf-core pipelines regularly and need to use the same settings regularly it may be a good idea to request that your custom config file is uploaded to the nf-core/configs git repository. Before you do this please can you test that the config file works with your pipeline of choice using the -c parameter. You can then create a pull request to the nf-core/configs repository with the addition of your config file, associated documentation file (see examples in nf-core/configs/docs), and amending nfcore_custom.config to include your custom profile.

See the main Nextflow documentation for more information about creating your own configuration files.

If you have any questions or issues please send us a message on Slack on the #configs channel.

Running in the background

Nextflow handles job submissions and supervises the running jobs. The Nextflow process must run until the pipeline is finished.

The Nextflow -bg flag launches Nextflow in the background, detached from your terminal so that the workflow does not stop if you log out of your session. The logs are saved to a file.

Alternatively, you can use screen / tmux or similar tool to create a detached session which you can log back into at a later time. Some HPC setups also allow you to run nextflow within a cluster job submitted your job scheduler (from where it submits more jobs).

Nextflow memory requirements

In some cases, the Nextflow Java virtual machines can start to request a large amount of memory. We recommend adding the following line to your environment to limit this (typically in ~/.bashrc or ~./bash_profile):

NXF_OPTS='-Xms1g -Xmx4g'