Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/pigz.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A parallel implementation of gzip for modern
multi-processor, multi-core machines
https://zlib.net/pigz/
*/
process fasta_uncompress {
process fasta_unzip {
tag "$genome"
label 'pigz'

Expand Down
10 changes: 5 additions & 5 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ params {
}

// Include a base config (2 forks of 1 CPU)
includeConfig "$baseDir/config/ressources/base.config"
includeConfig "$baseDir/config/resources/base.config"

profiles {

Expand All @@ -32,7 +32,7 @@ profiles {
params.sifPath = "${baseDir}/sif_images"
// singularity.envWhitelist = '' // Comma separated list of environment variable names to be included in the container environment.
includeConfig "$baseDir/config/softwares.config"
includeConfig "$baseDir/config/ressources/hpc.config"
includeConfig "$baseDir/config/resources/hpc.config"
}

debug { process.beforeScript = 'env' }
Expand All @@ -50,10 +50,10 @@ profiles {
includeConfig "$baseDir/config/softwares.config"
}
local {
includeConfig "$baseDir/config/ressources/local.config"
includeConfig "$baseDir/config/resources/local.config"
}
test {
params.aline_profiles = "${baseDir}/config/ressources/base_aline.config"
params.aline_profiles = "${baseDir}/config/resources/base_aline.config"
params.aligner = "STAR"
params.reads = "${baseDir}/data/chr21/chr21_small_R1.fastq.gz "
params.genome = "${baseDir}/data/chr21/chr21_small.fasta.gz"
Expand All @@ -62,7 +62,7 @@ profiles {
params.read_type = "short_single"
}
test2 {
params.aline_profiles = "${baseDir}/config/ressources/base_aline.config"
params.aline_profiles = "${baseDir}/config/resources/base_aline.config"
params.aligner = "STAR"
params.reads = "${baseDir}/data/chr21/"
params.genome = "${baseDir}/data/chr21/chr21_small.fasta.gz"
Expand Down
43 changes: 16 additions & 27 deletions rain.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ params.aggregation_mode = "all"
aline_profile_allowed = [ 'docker', 'singularity', 'local', 'itrop' ]

// Aline ressource config used
params.aline_profiles = "$baseDir/config/ressources/custom_aline.config" // e.g. "docker, singularity,itrop,local"
params.aline_profiles = "$baseDir/config/resources/custom_aline.config" // e.g. "docker, singularity,itrop,local"

// Aligner params
align_tools = ['hisat2', "STAR"]
Expand Down Expand Up @@ -139,7 +139,7 @@ include {fastp} from './modules/fastp.nf'
include {fastqc as fastqc_raw; fastqc as fastqc_ali; fastqc as fastqc_dup; fastqc as fastqc_clip} from './modules/fastqc.nf'
include {gatk_markduplicates } from './modules/gatk.nf'
include {multiqc} from './modules/multiqc.nf'
include {fasta_uncompress} from "$baseDir/modules/pigz.nf"
include {fasta_unzip} from "$baseDir/modules/pigz.nf"
include {samtools_index; samtools_fasta_index; samtools_sort_bam} from './modules/samtools.nf'
include {reditools2} from "./modules/reditools2.nf"
include {reditools3} from "./modules/reditools3.nf"
Expand Down Expand Up @@ -205,16 +205,16 @@ workflow {
Channel.fromPath(params.genome, checkIfExists: true)
.ifEmpty { exit 1, "Cannot find genome matching ${params.genome}!\n" }
.set{genome_raw}
// uncompress it if needed
fasta_uncompress(genome_raw)
fasta_uncompress.out.genomeFa.set{genome_ch} // set genome to the output of fasta_uncompress
// unzip it if needed
fasta_unzip(genome_raw)
fasta_unzip.out.genomeFa.set{genome} // set genome to the output of fasta_unzip
// ----------------------------------------------------------------------------
// --- DEAL WITH ANNOTATION ---
Channel.empty().set{annotation_ch}
Channel.empty().set{annotation}
if (params.annotation){
Channel.fromPath(params.annotation, checkIfExists: true)
.ifEmpty { exit 1, "Cannot find annotation matching ${params.annotation}!\n" }
.set{annotation_ch}
.set{annotation}
}
// ----------------------------------------------------------------------------
def path_csv = params.csv
Expand Down Expand Up @@ -368,7 +368,7 @@ workflow {
"${workflow.resume?'-resume':''} -profile ${aline_profile}", // workflow opts supplied as params for flexibility
"-config ${params.aline_profiles}",
"--reads ${path_reads}",
genome_ch,
genome,
"--read_type ${params.read_type}",
"--aligner ${params.aligner}",
"--library_type ${params.library_type}",
Expand All @@ -390,7 +390,7 @@ workflow {
if (params.library_type.contains("auto") ) {
log.info "Library type is set to auto, extracting it from salmon output"
// GET TUPLE [ID, OUTPUT_SALMON_LIBTYPE] FILES
ALIGNMENT.out.output
aline_alignments_all = ALIGNMENT.out.output
.map { dir ->
files("$dir/salmon_libtype/*/*.json", checkIfExists: true) // Find BAM files inside the output directory
}
Expand All @@ -404,7 +404,7 @@ workflow {
aline_libtype = extract_libtype(aline_libtype)
aline_alignments.join(aline_libtype)
.map { key, val1, val2 -> tuple(key, val1, val2) }
.set { aline_alignments_all }

} else {
log.info "Library type is set to ${params.library_type}, no need to extract it from salmon output"
aline_alignments_all = aline_alignments.map { name, bam -> tuple(name, bam, params.library_type) }
Expand All @@ -418,20 +418,8 @@ workflow {
}

// call rain
all_bams = aline_alignments_all.mix(sorted_bam)
tuple_sample_sortedbam = aline_alignments_all.mix(sorted_bam)
log.info "The following bam file(s) will be processed by RAIN:"
all_bams.view()
rain(all_bams, genome_ch, annotation_ch)
}

workflow rain {

take:
tuple_sample_sortedbam
genome
annnotation

main:

// STEP 1 QC with fastp ?
Channel.empty().set{logs}
Expand Down Expand Up @@ -459,30 +447,31 @@ workflow rain {
samtools_index(tuple_sample_bam_processed)
// report with multiqc
// multiqc(logs.collect(),params.multiqc_config)
// Create a fasta index file of the reference genome
samtools_fasta_index(genome.collect())

normalize_gxf(annnotation)

// Select site detection tool
switch (params.edit_site_tool) {
case "jacusa2":
// Create a fasta index file of the reference genome
samtools_fasta_index(genome.collect())
jacusa2(samtools_index.out.tuple_sample_bam_bamindex, samtools_fasta_index.out.tuple_fasta_fastaindex.collect())
break
case "sapin":
sapin(tuple_sample_bam_processed, genome.collect())
break
case "reditools2":
reditools2(samtools_index.out.tuple_sample_bam_bamindex, genome.collect(), params.region)
normalize_gxf(annotation.collect())
pluviometer(reditools2.out.tuple_sample_serial_table, normalize_gxf.out.gff.collect(), "reditools2")
break
case "reditools3":
reditools3(samtools_index.out.tuple_sample_bam_bamindex, genome.collect())
normalize_gxf(annotation.collect())
pluviometer(reditools3.out.tuple_sample_serial_table, normalize_gxf.out.gff.collect(), "reditools3")
break
default:
exit(1, "Wrong edit site tool was passed")
}

}


Expand Down