Example Files

Task nextflow.config

This nextflow.config file is copied to the task directory by the command:

#mkdir ./my_task_dir
#cd ./my_task_dir
nextflow run rennelab/CnR-flow --mode initiate

This configuration file contains paramaters for input file and task workflow setup.

…/my_task_dir/nextflow.config (Task Settings)
//Daniel Stribling
//Renne Lab, University of Florida
//CnR-flow Configuration File
//
// Config syntax:
// This config file uses the syntax described here:
//   https://www.nextflow.io/docs/latest/config.html
// Primarily, "//" acts as a comment and allows removal/deactivation of lines.
//
// Settings within scopes, Ex:
//   params {
//     setting = value
//     ...
//   }
// are equivalent to:
//   params.setting = value"
//
// Configuration Hierarchy:
//   Different Nextflow configuration files have the precedence order:
//     task-dir  >  pipe-dir  >  user-default  >  pipe-default
//
//   This configruation is (presumably) in the task directory:
//   (after running "nextflow CnR-flow --mode initiate" )
//   and will therefore superceed pipe-setup, user, and pipe hardcoded defaults.
//   For more detail visit: https://www.nextflow.io/docs/latest/config.html
//
//   This configuration only includes task-specific paramaters and paramaters 
//   designed to be modified at runtime. Other parameters are provided in the 
//   pipe configuration, at CnR-flow/nextflow.config. Parameters
//   provided here will override system defaults.
//

// Process Settings (For use of PBS, SLURM, etc)
process {
    // --Executor, see: https://www.nextflow.io/docs/latest/executor.html 
    //executor = 'slurm'  // for running processes using SLURM (Default: 'local')
    // Process Walltime, See https://www.nextflow.io/docs/latest/process.html#process-time
    //time = '12h'
    // Process CPUs, See https://www.nextflow.io/docs/latest/process.html#cpus
    //cpus = 8
    // 
    // Memory: See https://www.nextflow.io/docs/latest/process.html#process-memory
    // Set Memory for specific task sizes (1n/2n/4n scheme recommended)
    //withLabel: big_mem   { memory = '16 GB' }
    //withLabel: norm_mem  { memory = '4 GB'  }
    //withLabel: small_mem { memory = '2 GB'  }
    // -*OR*- Set Memory for all processes
    //memory = "16 GB"

    ext.ph = null //Placeholder to prevent errors.
}

params {
    //REQUIRED values to enter (all others should work as default):
    // ref_fasta               (or some other ref-mode/location)
    // treat_fastqs            (input paired-end fastq[.gz] file paths)
    //   [OR fastq_groups]     (mutli-group input paired-end .fastq[.gz] file paths)
    
    // Automatic alignment reference preparation/usage settings:
    ref_mode       = 'fasta'  // Options: ['name', 'fasta', 'manual']
    ref_fasta      = ''       // REQUIRED: Ex: '/path/to/my/reference.fasta[.gz]'
    // Default Pre-Supplied Normalization library is Ecoli:
    norm_ref_fasta = "${projectDir}/ref_dbs/gcf_000005845.2_asm584v2_genomic.fasta.gz"

    // CnR-flow Input Files:
    //   Provided fastqs must be in glob pattern matching pairs.
    //     Example: ['./relpath/to/base*R{1,2}*.fastq']
    //     Example: ['/abs/path/to/other*R{1,2}*.fastq']
    //
    treat_fastqs = []  // REQUIRED, Single-group Treatment fastq Pattern
    ctrl_fastqs  = []  //           Single-group Control   fastq pattern
    
    // Can specify multiple treat/control groups as Groovy mapping.
    //   Specified INSTEAD of treat_fasts/ctrl_fastqs paramaters.
    //   Note: There should be only one ctrl sample per group 
    //     (after optional lane combination)
    //Example:
    //fastq_groups = [
    //  'group_1_name': ['treat': 'relpath/to/treat1*R{1,2}*',
    //                   'ctrl':  'relpath/to/ctrl1*R{1,2}*',
    //                  ]
    //  'group_2_name': ['treat': ['relpath/to/g2_treat1*R{1,2}*'
    //                             '/abs/path/to/g2_treat2*R{1,2}*'
    //                            ],
    //                   'ctrl':  'relpath/to/g2_ctrl1*R{1,2}*'
    //                  ]
    //]
    //fastq_groups = []    

    // ------- Step-Specific Pipeline Paramaters --------
    // Step Settings:
    do_merge_lanes = true  // Merge sample names differing only by lane-ID (Ex: L001, L002)
    do_fastqc      = true  // Perform FastQC Analysis
    do_trim        = true  // Trim tags using Trimmomatic
    do_retrim      = true  // Retrim tags using kseq_test (CUTRUNTools)
    do_norm_spike  = true  // Normalize using aligment count to a spike-in reference
    do_make_bigwig = true  // Create UCSC bigWig files from final alignments


    //FastQC Settings:
    fastqc_flags = ''
    
    // Alignment Mode Options (params.use_aln_modes) :
    //   "all"            : Use all reads
    //   "all_dedup"      : Use all reads, and remove duplicates.
    //   "less_120"       : Use trimmed reads <= 120 bp 
    //   "less_120_dedup" : Use trimmed reads <= 120 bp and remove duplicates.
    //   (Multiple modes can be performed in parallel. Ex: ['all', 'less_120'])

    use_aln_modes  = ["all"]  // Options: ["all", "all_dedup", "less_120", "less_120_dedup"]
                                   
    // Peak Caller Options (params.peak_callers):
    //   "macs2" : Call Peaks with Macs2
    //   "seacr" : Call Peaks with SEACR
    //   (Multiple callers can be used in parallel. Ex: ['macs2', 'seacr'])

    peak_callers   = ['macs', 'seacr']  // Options: ['macs', 'seacr']
    
    //Trimmomatic Trim Settings
    
    //--Trimmomatic Adapter Path, Downloaded after "nextflow CnR-flow --mode initiate"
    trimmomatic_adapterpath = "${projectDir}/ref_dbs/trimmomatic_adapters/TruSeq3-PE-2.fa"
    trimmomatic_settings    = "ILLUMINACLIP:${params.trimmomatic_adapterpath}/Truseq3.PE.fa:2:15:4:4:true LEADING:20 TRAILING:20 SLIDINGWINDOW:4:15 MINLEN:25"
    trimmomatic_flags       = "-phred33"
    //kseq_test (CUTRUNTools) Retrim Settings
    input_seq_len = 'auto'  // Length of untrimmed sequence reads (Ex: '150') or 'auto'
    
    //Bowtie2 Alignment Settings
    aln_ref_flags  = "--local --very-sensitive-local --phred33 -I 10 -X 700 --dovetail --no-unal --no-mixed --no-discordant"
    
    //Normalization Settings
    aln_norm_flags = params.aln_ref_flags
    norm_scale     = 1000  // Arbitrary value for scaling of normalized counts.
    norm_mode      = 'adj' // Options: ['adj', 'all']
    
    //Macs2 Settings
    macs_qval  = '0.01'
    macs_flags = ''   
 
    //SEACR Settings
    seacr_fdr_threshhold = "0.01"
    seacr_norm_mode      = "auto" // Options: "auto", "norm", "non"
    seacr_call_stringent = true
    seacr_call_relaxed   = true
    
    // ------- General Pipeline Output Paramaters --------
    publish_files    = 'default' // Options: ["minimal", "default", "all"]
    publish_mode     = 'copy'    // Options: ["symlink", "copy"]

    //Name trim guide: ( regex-based )
    //   ~/groovy-slashy-string/  ;  "~" denotes groovy pattern type.
    //   ~/^/ matches beginning   ;   ~/$/ matches end    
    trim_name_prefix = ''        // Example: ~/^myprefix./ removes "myprefix." prefix.
    trim_name_suffix = ''        // Example: ~/_mysuffix$/ removes "_mysuffix" suffix.   

    // Workflow Output Default Naming Scheme:
    //   Absolute paths for output:
    out_dir          = "${launchDir}/cnr_output"
    refs_dir         = "${launchDir}/cnr_references"
}

Pipe nextflow.config

This nextflow.config file is contains configuration paramaters for pipeline setup.

…/CnR-flow/nextflow.config (Pipe Settings)
//Daniel Stribling
//Renne Lab, University of Florida
//CnR-flow Configuration File
//
// Config syntax:
// This config file uses the syntax described here:
//   https://www.nextflow.io/docs/latest/config.html
// Primarily, "//" acts as a comment and allows removal/deactivation of lines.
//
// Settings within scopes, Ex:
//   params {
//     setting = value
//     ...
//   }
// are equivalent to:
//   params.setting = value"
//
// Configuration Hierarchy:
//   Different Nextflow configuration files have the precedence order:
//     task-dir  >  pipe-dir  >  user-default  >  pipe-default
//
//   (presumably) This configruation is in the CnR-flow/nextflow.config, 
//   and will therefore superceed user and pipe defaults, 
//   but be overridden by the task-specific configuration file 
//   in the case of conflicting settings.
//   For more detail visit: https://www.nextflow.io/docs/latest/config.html
//
//   Users wishing to modify dependency configuration should specifically 
//   direct attention to the conda/module section. 
//   Other default paramaters are provided below. 

// Pipeline Details
manifest {
    author = 'Daniel Stribling, Rolf Renne'
    defaultBranch = 'master'
    description = """\
    CUT&RUN-Flow, A Nextflow pipeline for QC, tag trimming, normalization, and peak
    calling for paired-end sequence data from CUT&RUN experiments.
    """.stripIndent()
    //doi
    homePage = 'http://www.rennelab.com'
    mainScript = 'CnR-flow.nf'
    name = 'CUT&RUN-Flow'
    nextflowVersion = '20.07.1'
    version = '0.10'
}

// Process Settings (For use of PBS, SLURM, etc)
process {
    // --Executor, see: https://www.nextflow.io/docs/latest/executor.html 
    //executor = 'slurm'  // for running processes using SLURM (Default: 'local')
    // Process Walltime, See https://www.nextflow.io/docs/latest/process.html#process-time
    //time = '12h'
    // Process CPUs, See https://www.nextflow.io/docs/latest/process.html#cpus
    //cpus = 8
    // 
    // Memory: See https://www.nextflow.io/docs/latest/process.html#process-memory
    // Set Memory for specific task sizes (1n/2n/4n scheme recommended)
    //withLabel: big_mem   { memory = '16 GB' }
    //withLabel: norm_mem  { memory = '4 GB'  }
    //withLabel: small_mem { memory = '2 GB'  }
    // -*OR*- Set Memory for all processes
    //memory = "16 GB"

    ext.ph = null //Placeholder to prevent errors.
}

params {
    // ------- Dependency Configuration --------
    // Configuration using conda is recommended for most systems.
    // Each dependency can only have one type of resource configured:
    // (Ex: bowtie2_module OR bowtie2_conda)
    
    // Dependency Configuration Using Anaconda
    // Miniconda Install Instructions:
    //     https://docs.conda.io/en/latest/miniconda.html
    //
    // -- External Conda Environments:
    facount_conda          = 'bioconda::ucsc-facount=366=*_0'
    bowtie2_conda          = 'bioconda::bowtie2=2.4.1'
    fastqc_conda           = 'bioconda::fastqc=0.11.9'
    trimmomatic_conda      = 'bioconda::trimmomatic=0.39'
    bedtools_conda         = 'bioconda::bedtools=2.29.2'
    macs2_conda            = 'bioconda::macs2=2.2.6'
    R_conda                = 'r=3.6.0'
    samtools_conda         = 'bioconda::samtools=1.9=*_11'
    bedgraphtobigwig_conda = 'libgcc-ng libpng conda-forge::libuuid mysql-connector-c openssl zlib bioconda::ucsc-bedgraphtobigwig=377'
    
    // -- Packaged/Installed Tool Conda Environments (Changes should not be necessary):
    seacr_conda         = "${params.R_conda} ${params.bedtools_conda}"
    //kseqtest_conda      = ""  // (uses binary, should not be needed)
    
    // -- Comprehensive Conda Environment (If provided, is used for all execution)
    //all_conda           = ""
    
    // Dependency Configuration Using Environment Modules
    // (values will vary depending on system)
    // To enable, comment ("//") / delete the conda-configuration and uncomment this configuration.
    // -- External Tool Modules:
    //facount_module          = ""  // Ex: "ucsc/20200320"
    //bowtie2_module          = ""  // Ex: "bowtie2/2.3.5.1"
    //fastqc_module           = ""  // Ex: "fastqc/0.11.7"
    //trimmomatic_module      = ""  // Ex: "trimmomatic/0.39"
    //bedtools_module         = ""  // Ex: "bedtools/2.29.2"
    //macs2_module            = ""  // Ex: "macs/2.2.7.1"
    //R_module                = ""  // Ex: "R/4.0"
    //bedgraphtobigwig_module = ""  // Ex: "ucsc/20200320"
    
    // -- Packaged/Installed Tool Modules (Changes should not be necessary):
    //seacr_module         = "${params.R_module}:${params.bedtools_module}"
    //kseqtest_module      = ""  // (uses binary, should not be needed)
    
    // -- Comprehensive Tool Modules (If provided, is used for all execution)
    //all_module           = ""  // Ex: "cutruntools/20200104"
    
    // System Call Settings
    //   Call executed on the system, defaults assume that each tool is available
    //     on the system PATH (as with conda setup)
    //   Can replace with direct path as desired:
    //   Ex:
    //        samtools_call = "samtools"
    //     or samtools_call = "/path/to/samtools/dir/samtools" 
    java_call             = "java"
    bowtie2_build_call    = "bowtie2-build"
    facount_call          = "faCount"
    samtools_call         = "samtools"
    fastqc_call           = "fastqc"
    trimmomatic_call      = "trimmomatic"
    bowtie2_call          = "bowtie2"
    bedtools_call         = "bedtools"
    macs2_call            = "macs2"
    bedgraphtobigwig_call = "bedGraphToBigWig"
    kseqtest_call         = "${projectDir}/CUTRUNTools/kseq_test"  //Installed with --mode initiate
    seacr_call            = "${projectDir}/SEACR/SEACR_1.3.sh"     //Packaged with download
    seacr_R_script        = "${projectDir}/SEACR/SEACR_1.3.R"      //Packaged with download
    
    // ------- Step-Specific Pipeline Paramaters --------
    // Step Settings:
    do_merge_lanes = true  // Merge sample names differing only by lane-ID (Ex: L001, L002)
    do_fastqc      = true  // Perform FastQC Analysis
    do_trim        = true  // Trim tags using Trimmomatic
    do_retrim      = true  // Retrim tags using kseq_test (CUTRUNTools)
    do_norm_spike  = true  // Normalize using aligment count to a spike-in reference
    do_make_bigwig = true  // Create UCSC bigWig files from final alignments


    //FastQC Settings:
    fastqc_flags = ''
    
    // Alignment Mode Options (params.use_aln_modes) :
    //   "all"            : Use all reads
    //   "all_dedup"      : Use all reads, and remove duplicates.
    //   "less_120"       : Use trimmed reads <= 120 bp 
    //   "less_120_dedup" : Use trimmed reads <= 120 bp and remove duplicates.
    //   (Multiple modes can be performed in parallel. Ex: ['all', 'less_120'])

    use_aln_modes  = ["all"]  // Options: ["all", "all_dedup", "less_120", "less_120_dedup"]
                                   
    // Peak Caller Options (params.peak_callers):
    //   "macs2" : Call Peaks with Macs2
    //   "seacr" : Call Peaks with SEACR
    //   (Multiple callers can be used in parallel. Ex: ['macs2', 'seacr'])

    peak_callers   = ['macs', 'seacr']  // Options: ['macs', 'seacr']
    
    //Trimmomatic Trim Settings
    
    //--Trimmomatic Adapter Path, Downloaded after "nextflow CnR-flow --mode initiate"
    trimmomatic_adapterpath = "${projectDir}/ref_dbs/trimmomatic_adapters/TruSeq3-PE-2.fa"
    trimmomatic_settings    = "ILLUMINACLIP:${params.trimmomatic_adapterpath}/Truseq3.PE.fa:2:15:4:4:true LEADING:20 TRAILING:20 SLIDINGWINDOW:4:15 MINLEN:25"
    trimmomatic_flags       = "-phred33"
    //kseq_test (CUTRUNTools) Retrim Settings
    input_seq_len = 'auto'  // Length of untrimmed sequence reads (Ex: '150') or 'auto'
    
    //Bowtie2 Alignment Settings
    aln_ref_flags  = "--local --very-sensitive-local --phred33 -I 10 -X 700 --dovetail --no-unal --no-mixed --no-discordant"
    
    //Normalization Settings
    aln_norm_flags = params.aln_ref_flags
    norm_scale     = 1000  // Arbitrary value for scaling of normalized counts.
    norm_mode      = 'adj' // Options: ['adj', 'all']
    
    //Macs2 Settings
    macs_qval  = '0.01'
    macs_flags = ''   
 
    //SEACR Settings
    seacr_fdr_threshhold = "0.01"
    seacr_norm_mode      = "auto" // Options: "auto", "norm", "non"
    seacr_call_stringent = true
    seacr_call_relaxed   = true
    
    // ------- General Pipeline Output Paramaters --------
    publish_files    = 'default' // Options: ["minimal", "default", "all"]
    publish_mode     = 'copy'    // Options: ["symlink", "copy"]

    //Name trim guide: ( regex-based )
    //   ~/groovy-slashy-string/  ;  "~" denotes groovy pattern type.
    //   ~/^/ matches beginning   ;   ~/$/ matches end    
    trim_name_prefix = ''        // Example: ~/^myprefix./ removes "myprefix." prefix.
    trim_name_suffix = ''        // Example: ~/_mysuffix$/ removes "_mysuffix" suffix.   

    // Workflow Output Default Naming Scheme:
    //   Absolute paths for output:
    out_dir          = "${launchDir}/cnr_output"
    refs_dir         = "${launchDir}/cnr_references"
    //   Subdirectory Settigns:
    log_dir          = 'logs'
    merge_fastqs_dir = 'S0_B_merged_reads'
    fastqc_pre_dir   = 'S0_C_FastQC_pre'
    trim_dir         = 'S1_A_fastq_trimomatic'
    retrim_dir       = 'S1_B_fastq_kseqtest'
    fastqc_post_dir  = 'S1_C_FastQC_post'
    aln_dir_ref      = 'S2_A_aln_ref'
    aln_dir_mod      = 'S2_B_aln_mod'
    aln_dir_bdg      = 'S2_C_aln_bdg'
    aln_dir_spike    = 'S3_A_aln_spikein'
    aln_dir_norm     = 'S3_B_aln_norm'
    aln_bigwig_dir   = 'S4_A_aln_bigWig'
    peaks_dir_macs   = 'S5_A_peaks_macs'
    peaks_dir_seacr  = 'S5_B_peaks_seacr'
    prep_bt2db_suf   = 'bt2_db'

}

// Location to store conda environments for reuse.
conda.cacheDir = "${projectDir}/conda_envs/"    

// ------- Individual Task Settings, Included for Completeness --------

    //params {
    //REQUIRED values to enter (all others should work as default):
    // ref_fasta               (or some other ref-mode/location)
    // treat_fastqs            (input paired-end fastq[.gz] file paths)
    //   [OR fastq_groups]     (mutli-group input paired-end .fastq[.gz] file paths)
    
    // Automatic alignment reference preparation/usage settings:
    //ref_mode       = 'fasta'  // Options: ['name', 'fasta', 'manual']
    //ref_fasta      = ''       // REQUIRED: Ex: '/path/to/my/reference.fasta[.gz]'
    // Default Pre-Supplied Normalization library is Ecoli:
    //norm_ref_fasta = "${projectDir}/ref_dbs/gcf_000005845.2_asm584v2_genomic.fasta.gz"

    // CnR-flow Input Files:
    //   Provided fastqs must be in glob pattern matching pairs.
    //     Example: ['./relpath/to/base*R{1,2}*.fastq']
    //     Example: ['/abs/path/to/other*R{1,2}*.fastq']
    //
    //treat_fastqs = []  // REQUIRED, Single-group Treatment fastq Pattern
    //ctrl_fastqs  = []  //           Single-group Control   fastq pattern
    
    // Can specify multiple treat/control groups as Groovy mapping.
    //   Specified INSTEAD of treat_fasts/ctrl_fastqs paramaters.
    //   Note: There should be only one ctrl sample per group 
    //     (after optional lane combination)
    //Example:
    //fastq_groups = [
    //  'group_1_name': ['treat': 'relpath/to/treat1*R{1,2}*',
    //                   'ctrl':  'relpath/to/ctrl1*R{1,2}*',
    //                  ]
    //  'group_2_name': ['treat': ['relpath/to/g2_treat1*R{1,2}*'
    //                             '/abs/path/to/g2_treat2*R{1,2}*'
    //                            ],
    //                   'ctrl':  'relpath/to/g2_ctrl1*R{1,2}*'
    //                  ]
    //]
    //fastq_groups = []