Skip to content
Snippets Groups Projects
Unverified Commit f40aa5d9 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

BWA: add nf file for paired mapping

parent a2c5d6c2
No related branches found
No related tags found
No related merge requests found
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
$index_fasta {
container = "bwa:0.7.17"
}
}
}
sge {
process{
$index_fasta {
beforeScript = "module purge; module load BWA/0.7.17"
executor = "sge"
cpus = 1
memory = "5GB"
time = "6h"
queueSize = 1000
pollInterval = '60sec'
queue = 'h6-E5-2667v4deb128'
penv = 'openmp8'
}
}
}
}
params.fasta = "$baseDir/data/bam/*.fasta"
log.info "fasta files : ${params.fasta}"
Channel
.fromPath( params.fasta )
.ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fasta_file }
process index_fasta {
tag "$fasta_id"
cpus 4
publishDir "results/mapping/index/", mode: 'copy'
input:
set fasta_id, file(fasta) from fasta_file
output:
set fasta_id, "${fasta.baseName}.*" into index_files
file "*_bwa_report.txt" into index_files_report
script:
"""
bwa index -p ${fasta.baseName} ${fasta} \
&> ${fasta.baseName}_bwa_report.txt
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
$mapping_fastq {
container = "bwa:0.7.17"
}
}
}
sge {
process{
$mapping_fastq {
beforeScript = "module purge; module load BWA/0.7.17"
executor = "sge"
cpus = 4
memory = "5GB"
time = "6h"
queueSize = 1000
pollInterval = '60sec'
queue = 'h6-E5-2667v4deb128'
penv = 'openmp8'
}
}
}
}
params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
params.index = "$baseDir/data/index/*.index.*"
log.info "fastq files : ${params.fastq}"
log.info "index files : ${params.index}"
Channel
.fromFilePairs( 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}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.groupTuple()
.set { index_files }
process mapping_fastq {
tag "$reads"
cpus 4
publishDir "results/mapping/sam/", mode: 'copy'
input:
set pair_id, file(reads) from fastq_files
set index_id, file(index) from index_files.collect()
output:
file "${pair_id}.sam" into sam_files
file "${pair_id}_bwa_report.txt" into mapping_repport_files
script:
"""
bwa mem -t ${task.cpus} \
${index_id} ${reads[0]} ${reads[1]} \
-o ${pair_id}.sam &> ${pair_id}_bwa_report.txt
"""
}
./nextflow src/nf_modules/BWA/indexing.nf \
-c src/nf_modules/BWA/indexing.config \
-profile docker \
--fasta "data/tiny_dataset/fasta/tiny_v2.fasta"
# ./nextflow src/nf_modules/BWA/mapping_single.nf \
# -c src/nf_modules/BWA/mapping_single.config \
# -profile docker \
# --index "results/mapping/index/tiny_v2.index" \
# --fastq "data/tiny_dataset/fastq/tiny*_S.fastq"
./nextflow src/nf_modules/BWA/mapping_paired.nf \
-c src/nf_modules/BWA/mapping_paired.config \
-profile docker \
--index "results/mapping/index/tiny_v2*" \
--fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment