Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nextflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LBMC
nextflow
Commits
c9fc9da5
Unverified
Commit
c9fc9da5
authored
Oct 3, 2018
by
Laurent Modolo
Browse files
Options
Downloads
Patches
Plain Diff
SNP_calling.nf: last test with BWA MEM
parent
45be00ec
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!10
Module for BWA GATK sambamba samblaster and bcftools
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SNP_calling.config
+0
-6
0 additions, 6 deletions
src/SNP_calling.config
src/SNP_calling.nf
+84
-122
84 additions, 122 deletions
src/SNP_calling.nf
with
84 additions
and
128 deletions
src/SNP_calling.config
+
0
−
6
View file @
c9fc9da5
...
...
@@ -15,12 +15,6 @@ profiles {
withName
:
mapping_fastq
{
container
=
"bwa:0.7.17"
}
withName
:
dedup_sam
{
container
=
"samblaster:0.1.24"
}
withName
:
sam_to_bam
{
container
=
"sambamba:0.6.7"
}
withName
:
merge_bam
{
container
=
"sambamba:0.6.7"
}
...
...
This diff is collapsed.
Click to expand it.
src/SNP_calling.nf
+
84
−
122
View file @
c9fc9da5
params
.
fastq
=
"$baseDir/data/*.fastq"
params
.
fasta
=
"$baseDir/data/*.fasta"
params
.
sam
=
""
log
.
info
"fastq files : ${params.fastq}"
log
.
info
"fasta files : ${params.fasta}"
def
normal_sample
=
Eval
.
me
(
params
.
normal
)
...
...
@@ -22,7 +21,6 @@ Channel
.
ifEmpty
{
error
"Cannot find any fastq files matching: ${params.fastq}"
}
.
set
{
fastq_files
}
if
(
params
.
sam
==
""
)
{
process
adaptor_removal
{
tag
"$pair_id"
publishDir
"results/fastq/adaptor_removal/"
,
mode:
'copy'
...
...
@@ -31,18 +29,19 @@ if (params.sam == "") {
set
pair_id
,
file
(
reads
)
from
fastq_files
output:
set
pair_id
,
"*_cut_R{1,2}.fastq.gz"
into
fastq_files_cut
set
pair_id
,
file
(
"*.fastq.gz"
)
into
fastq_files_cut
file
"*_cutadapt_report.txt"
into
cut_files_report
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT -A AGATCGGAAGAG -G CTCTTCCGATCT \
-o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt
${reads[0]} ${reads[1]} > ${pair_id}_
cutadapt_
report.txt
"""
}
process
trimming
{
tag
"${
reads
}"
tag
"${
pair_id
}"
cpus
4
publishDir
"results/fastq/trimming/"
,
mode:
'copy'
...
...
@@ -50,7 +49,8 @@ if (params.sam == "") {
set
pair_id
,
file
(
reads
)
from
fastq_files_cut
output:
set
pair_id
,
"*_trim_R{1,2}.fastq.gz"
into
fastq_files_trim
set
pair_id
,
file
(
"*.fastq.gz"
)
into
fastq_files_trim
file
"*_trimming_report.txt"
into
trimming_files_report
script:
"""
...
...
@@ -75,77 +75,58 @@ if (params.sam == "") {
script:
"""
bwa index -p ${fasta
.baseName
} ${fasta} \
bwa index -p ${fasta
_id
} ${fasta} \
&> ${fasta.baseName}_bwa_report.txt
"""
}
process
mapping_fastq
{
tag
"$reads"
cpus
4
publishDir
"results/mapping/sam/"
,
mode:
'copy'
input:
set
pair_id
,
file
(
reads
)
from
fastq_files_trim
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
"""
}
}
else
{
Channel
.
fromPath
(
params
.
sam
)
.
ifEmpty
{
error
"Cannot find any sam files matching: ${params.sam}"
}
.
map
{
it
->
[(
it
.
baseName
=~
/([^\.]*)/
)[
0
][
1
],
it
]}
.
set
{
sam_files
}
fastq_files_trim
.
into
{
fastq_files_trim_norm
;
fastq_files_trim_tumor
}
process
dedup_sam
{
tag
"$file_id"
cpus
4
collect_fastq_files_trim_norm
=
fastq_files_trim_norm
.
filter
{
normal_sample
.
contains
(
it
[
0
])
}
.
map
{
it
->
[
"normal_sample"
,
it
[
0
],
it
[
1
]]}
input:
set
file_id
,
file
(
sam
)
from
sam_files
collect_fastq_files_trim_tumor
=
fastq_files_trim_tumor
.
filter
{
tumor_sample
.
contains
(
it
[
0
])
}
.
map
{
it
->
[
"tumor_sample"
,
it
[
0
],
it
[
1
]]}
output:
set
file_id
,
"*_dedup.sam*"
into
dedup_sam_files
script:
"""
samblaster --addMateTags -i ${sam} -o ${file_id}_dedup.sam
"""
}
collect_fastq_files_trim
=
Channel
.
create
()
.
mix
(
collect_fastq_files_trim_norm
,
collect_fastq_files_trim_tumor
)
process
sam_to_bam
{
tag
"$file_id"
cpus
4
process
mapping_fastq
{
tag
"$pair_id"
cpus
6
publishDir
"results/mapping/bam/"
,
mode:
'copy'
input:
set
file_id
,
file
(
sam
)
from
dedup_sam_files
set
sample_name
,
pair_id
,
file
(
reads
)
from
collect_fastq_files_trim
set
index_id
,
file
(
index
)
from
index_files
.
collect
()
output:
set
file_id
,
"*.bam"
into
dedup_bam_files
set
pair_id
,
"${pair_id}.bam"
into
bam_files
file
"${pair_id}_bwa_report.txt"
into
mapping_repport_files
script:
"""
sambamba view -t ${task.cpus} -S -f bam -l 0 ${sam} -o ${file_id}.bam
bwa mem -t ${task.cpus} -M \
-R '@RG\\tID:${sample_name}\\tSM:${sample_name}\\tPL:Illumina' \
${index_id} ${reads[0]} ${reads[1]} | \
samblaster --addMateTags -M -i /dev/stdin | \
sambamba view -t ${task.cpus} --valid -S -f bam -l 0 /dev/stdin -o ${pair_id}.bam \
2> ${pair_id}_bwa_report.txt
"""
}
process
sort_bam
{
tag
"$file_id"
cpus
10
cpus
4
input:
set
file_id
,
file
(
bam
)
from
dedup_
bam_files
set
file_id
,
file
(
bam
)
from
bam_files
output:
set
file_id
,
"*_sorted.bam"
into
sorted_bam_files
...
...
@@ -196,30 +177,10 @@ fi
"""
}
process
name_bam
{
tag
"$file_id"
cpus
4
publishDir
"results/mapping/bam/"
,
mode:
'copy'
input:
set
file_id
,
file
(
bam
)
from
merged_bam_files
output:
set
file_id
,
"*_named.bam"
into
named_bam_files
script:
"""
samtools view -H ${bam} > header.sam
echo "@RG\tID:${file_id}\tLB:library1\tPL:illumina\tPU:${file_id}\tSM:${file_id}" \
>> header.sam
cp ${bam} ${file_id}_named.bam
samtools reheader header.sam ${file_id}_named.bam
"""
}
named_bam_files
.
into
{
index_named_bam_files
;
haplotypecaller_bam_files
merged_bam_files
.
into
{
index_merged_bam_files
;
haplo_bam_files_norm
;
haplo_bam_files_tumor
}
process
index_bam
{
...
...
@@ -228,10 +189,10 @@ process index_bam {
publishDir
"results/mapping/bam/"
,
mode:
'copy'
input:
set
file_id
,
file
(
bam
)
from
index_
nam
ed_bam_files
set
file_id
,
file
(
bam
)
from
index_
merg
ed_bam_files
output:
set
file_id
,
"*.bam*"
into
index
ed
_bam_files
set
file_id
,
"*.bam*"
into
index_bam_files
script:
"""
...
...
@@ -239,6 +200,11 @@ sambamba index -t ${task.cpus} ${bam}
"""
}
index_bam_files
.
into
{
named_index_bam_files
;
indexed_bam_files
}
haplotypecaller_fasta_file
.
into
{
haplo_fasta_file
;
index2_fasta_file
...
...
@@ -277,10 +243,6 @@ samtools faidx ${fasta}
"""
}
haplotypecaller_bam_files
.
into
{
haplo_bam_files_norm
;
haplo_bam_files_tumor
}
haplotypecaller_bam_files_norm
=
haplo_bam_files_norm
.
filter
{
"normal_sample"
==
it
[
0
]
}
haplotypecaller_bam_files_tumor
=
haplo_bam_files_tumor
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment