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

training_dataset: add bam indexing step

parent 911287b2
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,24 @@ profiles { ...@@ -18,12 +18,24 @@ profiles {
$bam_2_fastq_paired { $bam_2_fastq_paired {
container = "samtools:1.7" container = "samtools:1.7"
} }
$sort_bam_paired {
container = "samtools:1.7"
}
$index_bam_paired {
container = "samtools:1.7"
}
$mapping_fastq_single { $mapping_fastq_single {
container = "bowtie2:2.3.4.1" container = "bowtie2:2.3.4.1"
} }
$bam_2_fastq_single { $bam_2_fastq_single {
container = "samtools:1.7" container = "samtools:1.7"
} }
$sort_bam_single {
container = "samtools:1.7"
}
$index_bam_single {
container = "samtools:1.7"
}
} }
} }
sge { sge {
...@@ -59,12 +71,24 @@ profiles { ...@@ -59,12 +71,24 @@ profiles {
$bam_2_fastq_paired { $bam_2_fastq_paired {
beforeScript = "module purge; module load SAMtools/1.7" beforeScript = "module purge; module load SAMtools/1.7"
} }
$sort_bam_paired {
beforeScript = "module purge; module load SAMtools/1.7"
}
$index_bam_paired {
beforeScript = "module purge; module load SAMtools/1.7"
}
$mapping_fastq_single { $mapping_fastq_single {
beforeScript = "module purge; module load SAMtools/1.7; module load Bowtie2/2.3.4.1" beforeScript = "module purge; module load SAMtools/1.7; module load Bowtie2/2.3.4.1"
} }
$bam_2_fastq_single { $bam_2_fastq_single {
beforeScript = "module purge; module load SAMtools/1.7" beforeScript = "module purge; module load SAMtools/1.7"
} }
$sort_bam_single {
beforeScript = "module purge; module load SAMtools/1.7"
}
$index_bam_single {
beforeScript = "module purge; module load SAMtools/1.7"
}
} }
} }
} }
...@@ -160,12 +160,45 @@ if ( params.fastq_paired != "" ) { ...@@ -160,12 +160,45 @@ if ( params.fastq_paired != "" ) {
file bed from bed_files file bed from bed_files
output: output:
set file_id, "*.bam" into filtered_bam_files set file_id, "*.bam" into filtered_bam_files_paired
script: script:
""" """
samtools view -@ ${task.cpus} -hb ${bam} -f 0x2 > ${file_id}_S.bam samtools view -@ ${task.cpus} -hb ${bam} -f 0x2 > ${file_id}_S.bam
""" """
} }
process sort_bam_paired {
tag "$file_id"
publishDir "results/training/bams/", mode: 'copy'
cpus 4
input:
set file_id, file(bam) from filtered_bam_files_paired
output:
set file_id, "*_sorted.bam" into sorted_bam_files_paired
script:
"""
samtools sort -@ ${task.cpus} -O BAM -o ${file_id}_sorted.bam ${bam}
"""
}
process index_bam_paired {
tag "$file_id"
publishDir "results/training/bams/", mode: 'copy'
input:
set file_id, file(bam) from sorted_bam_files_paired
output:
set file_id, "*.bam*" into indexed_bam_file_paired
script:
"""
samtools index ${bam}
"""
}
} }
...@@ -226,7 +259,6 @@ if ( params.fastq_single != "" ) { ...@@ -226,7 +259,6 @@ if ( params.fastq_single != "" ) {
process filter_bam_single { process filter_bam_single {
tag "$file_id" tag "$file_id"
publishDir "results/training/bams/", mode: 'copy'
cpus 4 cpus 4
input: input:
...@@ -234,10 +266,44 @@ if ( params.fastq_single != "" ) { ...@@ -234,10 +266,44 @@ if ( params.fastq_single != "" ) {
file bed from bed_files file bed from bed_files
output: output:
set file_id, "*_S.bam" into filtered_bam_files set file_id, "*_S.bam" into filtered_bam_files_single
script: script:
""" """
samtools view -@ ${task.cpus} -hb ${bam} -F 0x4 > ${file_id}_S.bam samtools view -@ ${task.cpus} -hb ${bam} -F 0x4 > ${file_id}_S.bam
""" """
} }
process sort_bam_single {
tag "$file_id"
publishDir "results/training/bams/", mode: 'copy'
cpus 4
input:
set file_id, file(bam) from filtered_bam_files_single
output:
set file_id, "*_sorted.bam" into sorted_bam_files_single
script:
"""
samtools sort -@ ${task.cpus} -O BAM -o ${file_id}_sorted.bam ${bam}
"""
}
process index_bam_single {
tag "$file_id"
publishDir "results/training/bams/", mode: 'copy'
input:
set file_id, file(bam) from sorted_bam_files_single
output:
set file_id, "*.bam*" into indexed_bam_file_single
script:
"""
samtools index ${bam}
"""
}
} }
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