diff --git a/src/chipster.nf b/src/chipster.nf index 61cf30411b0bdb7ec0dcc50b4d6a20de0d0e2fb8..4af938620938220dbddc385cd25b9b1a09bf9cd2 100755 --- a/src/chipster.nf +++ b/src/chipster.nf @@ -58,6 +58,8 @@ params.bam_to_bigwig_out = "$params.project/BigWig/" params.peak_calling_bg_out = "$params.project/Peak_calling/" params.bam_to_bed_out = "$params.project/Bed/" params.bed_slop_out = "$params.project/Bed_sloped/" +params.bedGraph_out = "$params.project/BedGraph/" +params.chipseq_bam2BG_out = "$params.project/chipseq_BigGig" /* **************************************************************** @@ -148,9 +150,11 @@ include { filter_bam_quality } from "./nf_modules/samtools/main.nf" include { sort_bam } from "./nf_modules/samtools/main.nf" include { index_bam } from "./nf_modules/samtools/main.nf" include { bam_to_bigwig } from "./nf_modules/deeptools/main.nf" +include { chipseq_bam2BG } from "./nf_modules/deeptools/main.nf" include { peak_calling_bg } from "./nf_modules/macs3/main.nf" include { bam_to_bed } from "./nf_modules/bedtools/main.nf" include { bed_slop } from "./nf_modules/bedtools/main.nf" +include { bed_to_bedGraph } from "./nf_modules/bedtools/main.nf" /* **************************************************************** @@ -159,11 +163,12 @@ include { bed_slop } from "./nf_modules/bedtools/main.nf" */ workflow { - // fastq_files.view() // Pour voir les fichier qui sont chargés // fastp fastp_default(fastq_files) + + /* // fastqc_rawdata fastqc_raw(fastq_files) // fastqc_processed @@ -175,6 +180,7 @@ workflow { fastqc_preprocessed.out.report ).collect() ) + */ // index reference genome index_fasta(genome_file) @@ -196,16 +202,22 @@ workflow { sort_bam(filter_bam_quality.out.bam) // samtools_index - // index_bam(sort_bam.out.bam.collect()) + index_bam(sort_bam.out.bam) // Create a bigwig file // bam_to_bigwig(index_bam.out.bam_idx) + // Chipseq Bam 2 bigwig file with reads extends + chipseq_bam2BG(index_bam.out.bam_idx) + // From Bam to Bed - bam_to_bed(sort_bam.out.bam) + // bam_to_bed(sort_bam.out.bam) // Extension of reads with bedtools slop - bed_slop(bam_to_bed.out.bed, genome_sizes.collect()) + // bed_slop(bam_to_bed.out.bed, genome_sizes.collect()) + + // From bed to bedgraph + // bed_to_bedGraph(bed_slop.out, genome_sizes.collect()) // peak calling using MACS3 Prend des bed ou des bam en entrée... // peak_calling_bg() diff --git a/src/nf_modules/bedtools/main.nf b/src/nf_modules/bedtools/main.nf index 6826615fac6b1f8fbb096c17731f4ad30d84f179..bc0177085b8e11a96f16454371684e089800d9d1 100644 --- a/src/nf_modules/bedtools/main.nf +++ b/src/nf_modules/bedtools/main.nf @@ -168,4 +168,30 @@ bedtools slop -s -r 100 -l 0 \ -g ${chromsizes} \ > ${bed.simpleName}_sloped.bed """ +} + +params.bedGraph = "" +params.bedGraph_out = "" +process bed_to_bedGraph { + container = "${container_url}" + label "big_mem_mono_cpus" + tag "${bed_id}" + if (params.bedGraph_out != "") { + publishDir "results/${params.bedGraph_out}", mode: 'copy' + } + + input: + tuple val(bed_id), path(bed) + tuple val(file_id), path(chromsizes) + + output: + tuple val(bed_id), path("*.bg"), emit: bedGraph + + script: +""" +bedtools genomecov -bg\ + -i ${bed} \ + -g ${chromsizes} \ + > ${bed.simpleName}.bg +""" } \ No newline at end of file diff --git a/src/nf_modules/deeptools/main.nf b/src/nf_modules/deeptools/main.nf index 254687066cf4ab4eb8b103c51261fb0074e5c27a..8a4b793293f486133d3019c928b46ef8665b465b 100644 --- a/src/nf_modules/deeptools/main.nf +++ b/src/nf_modules/deeptools/main.nf @@ -104,3 +104,30 @@ plotProfile -m ${matrix} \ --plotTitle "${params.title}" """ } + +params.chipseq_bam2BG = "" +params.chipseq_bam2BG_out = "" +process chipseq_bam2BG { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$file_id" + if (params.chipseq_bam2BG_out != "") { + publishDir "results/${params.chipseq_bam2BG_out}", mode: 'copy' + } + + input: + tuple val(file_id), path(bam), path(idx) + + output: + tuple val(file_id), path("*.bw"), emit: bw + + script: +""" +bamCoverage -p ${task.cpus} -b ${bam} \ + --binSize 10 \ + --ignoreDuplicates \ + --extendReads 200 \ + --effectiveGenomeSize 2913022398 \ + -o ${bam.simpleName}.bw \ +""" +} \ No newline at end of file