Skip to content

Commit

Permalink
adding new pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacozzuto committed May 29, 2024
1 parent 45d3c37 commit 1f2ebb4
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 0 deletions.
1 change: 1 addition & 0 deletions mop_dna/comparison.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CO_22_K1 CO_22_S1
26 changes: 26 additions & 0 deletions mop_dna/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
title: "Master of Pores"
subtitle: ""
intro_text: False

report_header_info:
- Application Type: 'Nanopore sequencing'

custom_logo: 'logo_small.png'
custom_logo_url: 'https://github.com/biocorecrg/nanopore_analysis'
custom_logo_title: 'Master of Pores'

extra_fn_clean_trim:
- '_QC'

table_columns_visible:
FastQC:
percent_duplicates: True

module_order:
- fastqc:
name: 'FastQC'
info: 'This section of the report shows FastQC results on raw reads.'

- alnQC:
name: "alnQC"
info: 'This section of the report shows alnQC results on aligned reads'
167 changes: 167 additions & 0 deletions mop_dna/mop_dna.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl=2

/*
* Define the pipeline parameters
*
*/

// Pipeline version
version = '3.0'

params.help = false
params.resume = false

log.info """
╔╦╗┌─┐╔═╗ ╔╦╗╔╗╔╔═╗
║║║│ │╠═╝ ║║║║║╠═╣
╩ ╩└─┘╩ ═╩╝╝╚╝╩ ╩
====================================================
BIOCORE@CRG Master of Pores 3. Detection of DNA variations - N F ~ version ${version}
====================================================
***************** Input files *******************
input_path : ${params.input_path}
comparison : ${params.comparison}
********** reference has to be the genome *************
reference : ${params.reference}
output : ${params.output}
pars_tools : ${params.pars_tools}
************************* Flows *******************************
clairS : ${params.clairS}
email : ${params.email}
"""

// Help and avoiding typos
if (params.help) exit 1
if (params.resume) exit 1, "Are you making the classical --resume typo? Be careful!!!! ;)"

// check input files
reference = file(params.reference)
if( !reference.exists() ) exit 1, "Missing reference file: ${reference}!"

// include functions, outdirs from other files
evaluate(new File("../outdirs.nf"))
def local_modules = file("$baseDir/../local_modules.nf")

def subworkflowsDir = "${baseDir}/../BioNextflow/subworkflows"

def flows = [:]
flows["clairS"] = params.clairS

include { getParameters; mapIDPairs } from "${local_modules}"
include { final_message; notify_slack } from "${subworkflowsDir}/global_functions.nf"
include { checkRef } from "${local_modules}"

// Create a channel for tool options
progPars = getParameters(params.pars_tools)

include { RUN as RUN_CLAIRS } from "${subworkflowsDir}/snp_calling/clairS" addParams(LABEL: 'big_mem_cpus', EXTRAPARS: progPars["clairS--clairS"], OUTPUT: outputClairS)



/*
* Creates the channels with comparisons
*/

comparisons = channel.empty()

if (params.comparison != "") {
compfile = file(params.comparison)
if( !compfile.exists() ) exit 1, "Missing comparison file: ${compfile}. Specify path with --comparisons"

Channel
.from(compfile.readLines())
.map { line ->
list = line.split("\t")
if (list.length <2) {
error "ERROR!!! Comparison file has to be tab separated\n"
}
if (list[0]!= "") {
def sampleID = list[0]
def ctrlID = list[1]
[ sampleID, ctrlID ]
}
}.set {comparisons}
}


workflow {
// Get Sample Names from comparisons
comparisons.flatten().unique().set{unique_samples}
// get BAM FILEs
unique_samples.map {
[it, file("${params.input_path}/alignment/${it}_s.bam")]
}.transpose().set{bams}
// get BAI FILEs
unique_samples.map {
[it, file("${params.input_path}/alignment/${it}_s.bam.bai")]
}.transpose().set{bais}

// ref_file = checkRef(reference)
clairS_flow(bams, comparisons, reference)


}


workflow clairS_flow {

take:
bam
comparisons
reference

main:
data = mapIDPairs(comparisons, bam)
RUN_CLAIRS(data, reference)

// emit:

}




workflow.onComplete {

def text = final_message("MoP3")
println text
if (params.hook != "") {
notify_slack(text, params.hook)
}
}

/*
* Mail notification
*/

if (params.email == "yourmail@yourdomain" || params.email == "") {
log.info 'Skipping the email\n'
}
else {
log.info "Sending the email to ${params.email}\n"

workflow.onComplete {

def msg = """\
Pipeline BIOCORE@CRG Master of Pore 3 modification module's execution summary
---------------------------
Completed at: ${workflow.complete}
Duration : ${workflow.duration}
Success : ${workflow.success}
workDir : ${workflow.workDir}
exit status : ${workflow.exitStatus}
Error report: ${workflow.errorReport ?: '-'}
"""
.stripIndent()

sendMail(to: params.email, subject: "Master of Pore 3 execution", body: msg)
}
}
2 changes: 2 additions & 0 deletions mop_dna/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
includeConfig "../nextflow.global.config"
//singularity.cacheDir = "$baseDir/../singularity"
13 changes: 13 additions & 0 deletions mop_dna/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
input_path: "${projectDir}/test_dataset/"
comparison: "${projectDir}/comparison.tsv"

reference: "/db/gencode/human/release_38/GRCh38.primary_assembly.genome.fa.gz"
output: "${projectDir}/output_dna"
pars_tools: "${projectDir}/tools_opt.tsv"

# flows
clairS: "YES"

# epinano plots
hook: ""
email: ""
2 changes: 2 additions & 0 deletions mop_dna/tools_opt.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#flows tool extrapars
clairS clairS "-p ont_r9_guppy"

0 comments on commit 1f2ebb4

Please sign in to comment.