diff --git a/src/docker_modules/RiboWave/1.0/Dockerfile b/src/docker_modules/RiboWave/1.0/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2d7b51127159576c5da53a9705e85b4862751eb5 --- /dev/null +++ b/src/docker_modules/RiboWave/1.0/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:16.04 +MAINTAINER Emmanuel Labaronne + +ENV BEDTOOLS_VERSION=2.25.0* +ENV PACKAGES bedtools=${BEDTOOLS_VERSION}* \ + r-base \ + r-base-dev \ + git + +RUN apt-get update &&\ + apt-get install -y --no-install-recommends ${PACKAGES} && \ + apt-get clean + +RUN printf "install.packages(c('reshape','ggplot2','wmtsa','parallel'), dep=TRUE, repos='http://cran.us.r-project.org') \n source('http://bioconductor.org/biocLite.R') \n biocLite('rhdf5')" > installpackages.R && \ +Rscript installpackages.R + +RUN git clone https://github.com/lulab/Ribowave.git &&\ + chmod -R +x Ribowave/scripts diff --git a/src/docker_modules/RiboWave/1.0/docker_init.sh b/src/docker_modules/RiboWave/1.0/docker_init.sh new file mode 100755 index 0000000000000000000000000000000000000000..871171a5bcae24c7aab7be2dece93ef741cc3301 --- /dev/null +++ b/src/docker_modules/RiboWave/1.0/docker_init.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker build src/docker_modules/RiboWave/1.0 -t 'ribowave:1.0' diff --git a/src/nf_modules/Ribowave/ribowave.config b/src/nf_modules/Ribowave/ribowave.config new file mode 100644 index 0000000000000000000000000000000000000000..56519cf58fb3cd75b7f352a113973276d80bfa6f --- /dev/null +++ b/src/nf_modules/Ribowave/ribowave.config @@ -0,0 +1,29 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $create_annot { + container = "ribowave:1.0" + } + $determination_P_site { + container = "ribowave:1.0" + } + } + } + sge { + process{ + $create_annot { + beforeScript = "" + executor = "" + cpus = 1 + memory = "" + time = "" + queueSize = 1000 + pollInterval = '' + queue = '' + penv = '' + } + } + } +} diff --git a/src/nf_modules/Ribowave/ribowave.nf b/src/nf_modules/Ribowave/ribowave.nf new file mode 100644 index 0000000000000000000000000000000000000000..41cd9e9e6c04d4b249e08b7b5d011ac598ff573e --- /dev/null +++ b/src/nf_modules/Ribowave/ribowave.nf @@ -0,0 +1,173 @@ +/* +* Ribowave : +* Inputs : fastq files +* Inputs : fasta files +* Output : bam files +*/ + +/* Create annotation */ +params.gtf = "/media/manu/ManuDisque/gencode/gencode.v28.annotation.gtf" +params.genome = "/media/manu/ManuDisque/gencode/GRCh38.p12.genome.fa" + +log.info "gtf file : ${params.gtf}" +log.info "genome fasta file : ${params.genome}" + +Channel + .fromPath( params.gtf ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.gtf}" } + .set { gtf_file } +Channel + .fromPath( params.genome ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.genome}" } + .set { genome_file } + +process create_annot { + publishDir "results/ribowave/annotation", mode: 'copy' + + input: + file gtf from gtf_file + file genome from genome_file + + output: + file "*" into annot_file + + script: +""" +/Ribowave/scripts/create_annotation.sh -G ${gtf} -f ${genome} -o ./ -s /Ribowave/scripts +""" +} + + +/* +* P-site determination +*/ + +params.bam = "" +params.start = "" +params.jobname = "" + +log.info "bam file(s) : ${params.bam}" +log.info "start_codon file : ${params.start}" +log.info "job name : ${params.jobname}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } +Channel + .fromPath( params.start ) + .ifEmpty { error "Cannot find any index files matching: ${params.start}" } + .set { start_file } + +process determination_P_site { + publishDir "results/ribowave/", mode: 'copy' + + input: + file bam from bam_files + file start from start_file + + output: + file "*" into p_site_channel + + script: +""" +/Ribowave/scripts/P-site_determination.sh -i ${bam} -S ${start} -o ./ -n ${params.jobname} -s /Ribowave/scripts +""" +} + +/* +* P-site track +*/ + +params.bam = "" +params.exon = "" +params.genome = "" +params.jobname = "" +params.p_site = "" + +log.info "bam file(s) : ${params.bam}" +log.info "exon file : ${params.exon}" +log.info "genome file : ${params.genome}" +log.info "job name : ${params.jobname}" +log.info "job name : ${params.p_site}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } +Channel + .fromPath( params.exon ) + .ifEmpty { error "Cannot find any index files matching: ${params.exon}" } + .set { exon_file } +Channel + .fromPath( params.genome ) + .ifEmpty { error "Cannot find any index files matching: ${params.genome}" } + .set { genome_file } +Channel + .fromPath( params.p_site ) + .ifEmpty { error "Cannot find any index files matching: ${params.p_site}" } + .set { p_site_file } + +process determination_P_site { + publishDir "results/ribowave/track_P_site", mode: 'copy' + + input: + file bam from bam_files + file exon from exon_file + file genome from genome_file + file p_site from p_site_file + + output: + file "*" into det_p_site_channel + + script: +""" +/Ribowave/scripts/create_track_Ribo.sh -i ${bam} -G ${exon} -g ${genome} -P ${p_site} -o ./ -n ${params.jobname} -s /Ribowave/scripts +""" +} + +/* +* for single-end data +*/ + +params.fastq = "$baseDir/data/fastq/*.fastq" +params.index = "$baseDir/data/index/*.index*" +params.mean = 200 +params.sd = 100 + +log.info "fastq files : ${params.fastq}" +log.info "index files : ${params.index}" +log.info "mean read size: ${params.mean}" +log.info "sd read size: ${params.sd}" + +Channel + .fromPath( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } +Channel + .fromPath( params.index ) + .ifEmpty { error "Cannot find any index files matching: ${params.index}" } + .set { index_files } + +process mapping_fastq { + tag "$reads.baseName" + cpus 4 + publishDir "results/mapping/quantification/", mode: 'copy' + + input: + file reads from fastq_files + file index from index_files.toList() + + output: + file "*" into count_files + + script: +""" +mkdir ${reads.baseName} +kallisto quant -i ${index} -t ${task.cpus} --single +--bias --bootstrap-samples 100 -o ${reads.baseName} \ +-l ${params.mean} -s ${params.sd} -o ./ \ +${reads} > ${reads.baseName}_kallisto_report.txt +""" +} + diff --git a/src/nf_modules/Ribowave/ribowave_command.sh b/src/nf_modules/Ribowave/ribowave_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..2b401e9dba2ff9b99e5fb3e21689ca0181a6704c --- /dev/null +++ b/src/nf_modules/Ribowave/ribowave_command.sh @@ -0,0 +1 @@ +../../nextflow/nextflow src/nf_modules/Ribowave/test/Pipeline.nf -resume -with-dag results/ribowave_dag.pdf -with-timeline results/ribowave_timeline -c src/nf_modules/Ribowave/ribowave.config -profile docker --gtf /media/manu/ManuDisque/gencode/gencode.v27.annotation.gtf --genome /media/manu/ManuDisque/gencode/GRCh38.p10.genome.fa --bam /media/manu/ManuDisque/HIV_project/hg38/U937_CHX_hg38_allmerge_uniqMapped_sorted.bam --jobname U937_CHY_merged diff --git a/src/nf_modules/Ribowave/test/P-site.nf b/src/nf_modules/Ribowave/test/P-site.nf new file mode 100644 index 0000000000000000000000000000000000000000..735a5a531ff3e419030066fa543a8c51b63ad579 --- /dev/null +++ b/src/nf_modules/Ribowave/test/P-site.nf @@ -0,0 +1,32 @@ +params.bam = "" +params.start = "" +params.jobname = "" + +log.info "bam file(s) : ${params.bam}" +log.info "start_codon file : ${params.start}" +log.info "job name : ${params.jobname}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } +Channel + .fromPath( params.start ) + .ifEmpty { error "Cannot find any index files matching: ${params.start}" } + .set { start_file } + +process p_site { + publishDir "results/ribowave/P-site", mode: 'copy' + + input: + file bam from bam_files + file start from start_file + + output: + file "*" into p_site_channel + + script: +""" +/Ribowave/scripts/P-site_determination.sh -i ${bam} -S ${start} -o ./ -n ${params.jobname} -s /Ribowave/scripts +""" +} diff --git a/src/nf_modules/Ribowave/test/Pipeline.nf b/src/nf_modules/Ribowave/test/Pipeline.nf new file mode 100644 index 0000000000000000000000000000000000000000..894dc48da6167d20931872a71becbe6015170cb5 --- /dev/null +++ b/src/nf_modules/Ribowave/test/Pipeline.nf @@ -0,0 +1,63 @@ +/* +* Ribowave : +* Inputs : fastq files +* Inputs : fasta files +* Output : bam files +*/ + +params.gtf = "/media/manu/ManuDisque/gencode/gencode.v28.annotation.gtf" +params.genome = "/media/manu/ManuDisque/gencode/GRCh38.p12.genome.fa" +params.bam = "" +params.jobname = "" + +log.info "gtf file : ${params.gtf}" +log.info "genome fasta file : ${params.genome}" +log.info "bam file(s) : ${params.bam}" +log.info "job name : ${params.jobname}" + +Channel + .fromPath( params.gtf ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.gtf}" } + .set { gtf_file } +Channel + .fromPath( params.genome ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.genome}" } + .set { genome_file } +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } + +process create_annot { + publishDir "results/ribowave/gtf27/annot", mode: 'copy' + + input: + file gtf from gtf_file + file genome from genome_file + + output: + file "*" into annot_file_save + file "start_codon.bed" into annot_file + + script: +""" +/Ribowave/scripts/create_annotation.sh -G ${gtf} -f ${genome} -o ./ -s /Ribowave/scripts +""" +} + +process determination_P_site { + publishDir "results/ribowave/gtf27/deter_P_site", mode: 'copy' + + input: + file bam from bam_files + file start from annot_file + + output: + file "*" into p_site_channel + + script: +""" +/Ribowave/scripts/P-site_determination.sh -i ${bam} -S ${start} -o ./ -n ${params.jobname} -s /Ribowave/scripts +""" +} + diff --git a/src/nf_modules/Ribowave/test/create_annot.nf b/src/nf_modules/Ribowave/test/create_annot.nf new file mode 100644 index 0000000000000000000000000000000000000000..058d911719921afc241c63b7b2c88ec3fb72fb71 --- /dev/null +++ b/src/nf_modules/Ribowave/test/create_annot.nf @@ -0,0 +1,31 @@ +params.gtf = "/media/manu/ManuDisque/gencode/gencode.v28.annotation.gtf" +params.genome = "/media/manu/ManuDisque/gencode/GRCh38.p12.genome.fa" + +log.info "gtf file : ${params.gtf}" +log.info "genome fasta file : ${params.genome}" + +Channel + .fromPath( params.gtf ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.gtf}" } + .set { gtf_file } +Channel + .fromPath( params.genome ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.genome}" } + .set { genome_file } + +process create_annot { + publishDir "results/ribowave/", mode: 'copy' + + input: + file gtf from gtf_file + file genome from genome_file + + output: + file "*" into annot_file + + script: +""" +mkdir annotation +/Ribowave/scripts/create_annotation.sh -G ${gtf} -f ${genome} -o annotation -s /Ribowave/scripts +""" +} diff --git a/src/nf_modules/Ribowave/test/track_P_site.nf b/src/nf_modules/Ribowave/test/track_P_site.nf new file mode 100644 index 0000000000000000000000000000000000000000..d36ab485d714e88662c07ae52c47962372e06079 --- /dev/null +++ b/src/nf_modules/Ribowave/test/track_P_site.nf @@ -0,0 +1,46 @@ +params.bam = "" +params.exon = "" +params.genome = "" +params.jobname = "" +params.p_site = "" + +log.info "bam file(s) : ${params.bam}" +log.info "exon file : ${params.exon}" +log.info "genome file : ${params.genome}" +log.info "job name : ${params.jobname}" +log.info "job name : ${params.p_site}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } +Channel + .fromPath( params.exon ) + .ifEmpty { error "Cannot find any index files matching: ${params.exon}" } + .set { exon_file } +Channel + .fromPath( params.genome ) + .ifEmpty { error "Cannot find any index files matching: ${params.genome}" } + .set { genome_file } +Channel + .fromPath( params.p_site ) + .ifEmpty { error "Cannot find any index files matching: ${params.p_site}" } + .set { p_site_file } + +process determination_P_site { + publishDir "results/ribowave/track_P_site", mode: 'copy' + + input: + file bam from bam_files + file exon from exon_file + file genome from genome_file + file p_site from p_site_file + + output: + file "*" into det_p_site_channel + + script: +""" +/Ribowave/scripts/create_track_Ribo.sh -i ${bam} -G ${exon} -g ${genome} -P ${p_site} -o ./ -n ${params.jobname} -s /Ribowave/scripts +""" +}