Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
AmstlerStephan committed Nov 13, 2024
1 parent 678cd50 commit c73ed09
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 92 deletions.
147 changes: 75 additions & 72 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,90 @@
// ENABLE DSL2
nextflow.enable.dsl=2

// Print help and exit
if (params.help) {
println """\
===============================================
U M I H A P L O T Y P I N G P I P E L I N E
===============================================
~ version ${workflow.manifest.version}
include {EXTRACT_HAPLOTYPES_WF} from './lib/workflows/extract_haplotypes.nf'

Usage:
nextflow run AmstlerStephan/haplotyping-KIV2-nf [OPTIONS]...

Options:
--input [path/to/input/dir] [REQUIRED] Provide the directory containing input BAM files.
--ont_pl_dir [path/to/ont_pl_dir] [REQUIRED] Provide the directory associated with ONT pipeline.
--output [path/to/output/dir] [REQUIRED] Specify the directory where the pipeline will write its output.
--variant_calling_positions [path/to/positions] Specify the path to the file specifying variant calling positions.
--bam_pattern [pattern] Pattern to match BAM files within the input directory. Default: "masked_consensus.bam"
--cluster_stats_pattern [pattern] Pattern to match cluster statistics files. Default: "split_cluster_stats.tsv"
--min_reads_per_cluster [number] Minimum number of reads per cluster. Default: 10
--max_reads_per_cluster [number] Maximum number of reads per cluster. Default: 200
--max_edit_distance [number] Maximum edit distance allowed. Default: 2
--use_variant_calling_positions Use variant calling positions. Default: false
--ranges_to_exclude [ranges] Comma-separated list of ranges to exclude. Default: "2472,2506"
--min_qscore [number] Minimum quality score required. Default: 45
--output_format [format] Output format for haplotype results. Default: "fasta"
// Main Workflow
workflow {
// Print help and exit
if (params.help) {
println """\
===============================================
U M I H A P L O T Y P I N G P I P E L I N E
===============================================
~ version ${workflow.manifest.version}
--threads [number] Number of threads used during execution. Default: (availableProcessors() - 1)
"""
exit 0
}
Usage:
nextflow run AmstlerStephan/haplotyping-KIV2-nf [OPTIONS]...
// Print version and exit
if (params.version) {
println """\
===============================================
U M I H A P L O T Y P I N G P I P E L I N E
===============================================
~ version ${workflow.manifest.version}
"""
exit 0
}
Options:
--input [path/to/input/dir] [REQUIRED] Provide the directory containing input BAM files.
--ont_pl_dir [path/to/ont_pl_dir] [REQUIRED] Provide the directory associated with ONT pipeline.
--output [path/to/output/dir] [REQUIRED] Specify the directory where the pipeline will write its output.
--variant_calling_positions [path/to/positions] Specify the path to the file specifying variant calling positions.
--bam_pattern [pattern] Pattern to match BAM files within the input directory. Default: "masked_consensus.bam"
--cluster_stats_pattern [pattern] Pattern to match cluster statistics files. Default: "split_cluster_stats.tsv"
--min_reads_per_cluster [number] Minimum number of reads per cluster. Default: 10
--max_reads_per_cluster [number] Maximum number of reads per cluster. Default: 200
--max_edit_distance [number] Maximum edit distance allowed. Default: 2
--use_variant_calling_positions Use variant calling positions. Default: false
--ranges_to_exclude [ranges] Comma-separated list of ranges to exclude. Default: "2472,2506"
--min_qscore [number] Minimum quality score required. Default: 45
--output_format [format] Output format for haplotype results. Default: "fasta"
// Print standard logging info
log.info ""
log.info " ==============================================="
log.info " U M I - H A P L O T Y P I N G"
if(params.debug){
log.info " (debug mode enabled)"
log.info " ===============================================" }
else {
log.info " ===============================================" }
log.info " ~ version ${workflow.manifest.version}"
log.info ""
log.info " input dir : ${params.input}"
log.info " output dir : ${params.output}"
log.info " ==============================================="
log.info " RUN NAME: ${workflow.runName}"
log.info ""

include {EXTRACT_HAPLOTYPES_WF} from './lib/workflows/extract_haplotypes.nf'
--threads [number] Number of threads used during execution. Default: (availableProcessors() - 1)
"""
exit 0
}

// Main Workflow
workflow {
EXTRACT_HAPLOTYPES_WF()
}
// Print version and exit
if (params.version) {
println """\
===============================================
U M I H A P L O T Y P I N G P I P E L I N E
===============================================
~ version ${workflow.manifest.version}
"""
exit 0
}

// Workflow tracing - what to display when the pipeline finishes
workflow.onComplete {
// Print standard logging info
log.info ""
log.info " Pipeline execution summary"
log.info " ---------------------------"
log.info " Name : ${workflow.runName}${workflow.resume ? " (resumed)" : ""}"
log.info " Profile : ${workflow.profile}"
log.info " Launch dir : ${workflow.launchDir}"
log.info " Work dir : ${workflow.workDir} ${!params.debug && workflow.success ? "(cleared)" : "" }"
log.info " Status : ${workflow.success ? "success" : "failed"}"
log.info " Error report : ${workflow.errorReport ?: "-"}"
log.info " ==============================================="
log.info " U M I - H A P L O T Y P I N G"
if(params.debug){
log.info " (debug mode enabled)"
log.info " ===============================================" }
else {
log.info " ===============================================" }
log.info " ~ version ${workflow.manifest.version}"
log.info ""
log.info " input dir : ${params.input}"
log.info " output dir : ${params.output}"
log.info " ==============================================="
log.info " RUN NAME: ${workflow.runName}"
log.info ""

// Run a small clean-up script to remove "work" directory after successful completion
if (!params.debug && workflow.success) {
["bash", "${baseDir}/bin/clean.sh", "${workflow.sessionId}"].execute()
EXTRACT_HAPLOTYPES_WF()


// Workflow tracing - what to display when the pipeline finishes
workflow.onComplete {
log.info ""
log.info " Pipeline execution summary"
log.info " ---------------------------"
log.info " Name : ${workflow.runName}${workflow.resume ? " (resumed)" : ""}"
log.info " Profile : ${workflow.profile}"
log.info " Launch dir : ${workflow.launchDir}"
log.info " Work dir : ${workflow.workDir} ${!params.debug && workflow.success ? "(cleared)" : "" }"
log.info " Status : ${workflow.success ? "success" : "failed"}"
log.info " Error report : ${workflow.errorReport ?: "-"}"
log.info ""

// Run a small clean-up script to remove "work" directory after successful completion
if (!params.debug && workflow.success) {
["bash", "${baseDir}/bin/clean.sh", "${workflow.sessionId}"].execute()
}
}
}

40 changes: 20 additions & 20 deletions nextflow.config
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// NEXTFLOW MANIFEST
manifest {
name = 'haplotyping-KIV2-nf'
version = '0.1.0'
description = 'Nextflow pipeline to extract haplotypes of KIV-2 UMI data'
author = 'Stephan Amstler'
homePage = 'https://github.com/AmstlerStephan/haplotyping-KIV2-nf.git'
mainScript = 'main.nf'
nextflowVersion = '!>=22.04'
name = 'haplotyping-KIV2-nf'
version = '0.1.0'
description = 'Nextflow pipeline to extract haplotypes of KIV-2 UMI data'
author = 'Stephan Amstler'
homePage = 'https://github.com/AmstlerStephan/haplotyping-KIV2-nf.git'
mainScript = 'main.nf'
nextflowVersion = '!>=22.04'
}

// DEFAULT PARAMETERS
params {

// BASIC PARAMS
help = false
version = false
debug = false
help = false
version = false
debug = false

// INPUT / OUTPUT
input = null
ont_pl_dir = null
output = null
variant_calling_positions = null
input = null
ont_pl_dir = null
output = null
variant_calling_positions = null
bam_pattern = "masked_consensus.bam"
cluster_stats_pattern = "split_cluster_stats.tsv"
min_reads_per_cluster = 10
max_reads_per_cluster = 200
cluster_stats_pattern = "split_cluster_stats.tsv"
min_reads_per_cluster = 10
max_reads_per_cluster = 200
max_edit_distance = 2
use_variant_calling_positions = false
use_variant_calling_positions = false
ranges_to_exclude = "2472,2506"
min_qscore = 45
min_qscore = 45
output_format = "fasta"


threads = (Runtime.runtime.availableProcessors() - 1)
threads = (Runtime.runtime.availableProcessors() - 1)

}

Expand Down

0 comments on commit c73ed09

Please sign in to comment.