Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ChIPster
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xavier Grand
ChIPster
Commits
2dcade89
Verified
Commit
2dcade89
authored
3 years ago
by
Laurent Modolo
Browse files
Options
Downloads
Patches
Plain Diff
gatk4: working variant calling pipeline
parent
6b6d059a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nf_modules/gatk4/main.nf
+81
-23
81 additions, 23 deletions
src/nf_modules/gatk4/main.nf
with
81 additions
and
23 deletions
src/nf_modules/gatk4/main.nf
+
81
−
23
View file @
2dcade89
...
...
@@ -21,21 +21,21 @@ workflow germline_cohort_data_variant_calling {
picard_index_bam(mark_duplicate.out.bam)
mark_duplicate.out.bam
.join(picard_index_bam.out.index)
set
(
bam_idx
)
.
set
{
bam_idx
}
picard_index_fasta(fasta)
samtools_index_fasta(fasta)
fasta
.join(picard_index_fasta.out.index)
.join(samtools_index_fasta.out.index)
.set
(
fasta_idx
)
.set
{
fasta_idx
}
// variant calling
call_variants_per_sample(
bam_idx,
fasta_idx
fasta_idx
.collect()
)
call_variants_all_sample(
call_variants_
all
_sample.out.gvcf,
call_variants_
per
_sample.out.gvcf,
fasta_idx
)
emit:
...
...
@@ -170,12 +170,10 @@ process call_variants_per_sample {
}
"""
gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \
-R ${fata} \
-R ${fa
s
ta} \
-I ${bam} \
-O ${bam.simpleName}.gvcf.gz \
-ERC GVCF \
-G Standard \
-G AS_Standard
-ERC GVCF
"""
}
...
...
@@ -187,25 +185,84 @@ workflow call_variants_all_sample {
fasta_idx
main:
index_gvcf(gvcf)
validate_gvcf(
index_gvcf.out.gvcf_idx,
fasta_idx.collect()
)
consolidate_gvcf(
gvcf.groupTuple()
validate_gvcf.out.gvcf
.map {
it -> ["library", it[1], it[2]]
}
.groupTuple(),
fasta_idx.collect()
)
genomic_db_call(
consolidate_gvcf.out.g
db
,
fasta_idx
consolidate_gvcf.out.g
vcf_idx
,
fasta_idx
.collect()
)
emit:
vcf = genomic_db_call.out.vcf
}
process
consolidate
_gvcf {
process
index
_gvcf {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
input:
tuple val(file_id), path(gvcf)
output:
tuple val(file_id), path("${file_prefix}.db"), emit: gdb
tuple val(file_id), path("${gvcf}"), path("${gvcf}.tbi"), emit: gvcf_idx
tuple val(file_id), path("${gvcf.simpleName}_IndexFeatureFile_report.txt"), emit: report
script:
xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
"""
gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \
-I ${gvcf} 2> ${gvcf.simpleName}_IndexFeatureFile_report.txt
"""
}
process validate_gvcf {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
input:
tuple val(file_id), path(gvcf), path(gvcf_idx)
tuple val(ref_id), path(fasta), path(fai), path(dict)
output:
tuple val(file_id), path("${gvcf}"), path("${gvcf_idx}"), emit: gvcf
script:
xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
"""
gatk --java-options "-Xmx${xmx_memory}G" ValidateVariants \
-V ${gvcf} \
-R ${fasta} -gvcf
"""
}
process consolidate_gvcf {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
input:
tuple val(file_id), path(gvcf), path(gvcf_idx)
tuple val(ref_id), path(fasta), path(fai), path(dict)
output:
tuple val(file_id), path("${file_prefix}.gvcf"), path("${file_prefix}.gvcf.idx"), emit: gvcf_idx
tuple val(file_id), path("${file_prefix}_CombineGVCFs_report.txt"), emit: report
script:
xmx_memory = "${task.memory}" - ~/\s*GB/
...
...
@@ -217,17 +274,19 @@ process consolidate_gvcf {
def gvcf_cmd = ""
if (gvcf instanceof List){
for (gvcf_file in gvcf){
gvcf_cmd += "-
-
V ${gvcf_file} "
gvcf_cmd += "-V ${gvcf_file} "
}
} else {
gvcf_cmd = "-
-
V ${gvcf} "
gvcf_cmd = "-V ${gvcf} "
}
"""
mkdir tmp
gatk --java-options "-Xmx${xmx_memory}G"
GenomicsDBImport
\
gatk --java-options "-Xmx${xmx_memory}G"
CombineGVCFs
\
${gvcf_cmd} \
--genomicsdb-workspace-path ${file_prefix}.db \
--tmp-dir=./tmp \
-R ${fasta} \
-O ${file_prefix}.gvcf 2> ${file_prefix}_CombineGVCFs_report.txt
gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \
-I ${file_prefix}.gvcf 2> ${file_prefix}_IndexFeatureFile_report.txt
"""
}
...
...
@@ -239,10 +298,10 @@ process genomic_db_call {
publishDir "results/${params.variant_calling_out}", mode: 'copy'
}
input:
tuple val(file_id), path(
db
)
tuple val(file_id), path(
gvcf), path(gvcf_idx
)
tuple val(ref_id), path(fasta), path(fai), path(dict)
output:
tuple val(file_id), path("${
db
.simple
_n
ame}.vcf.gz"), emit: vcf
tuple val(file_id), path("${
gvcf
.simple
N
ame}.vcf.gz"), emit: vcf
script:
xmx_memory = "${task.memory}" - ~/\s*GB/
...
...
@@ -263,15 +322,14 @@ process genomic_db_call {
mkdir tmp
gatk --java-options "-Xmx${xmx_memory}G" GenotypeGVCFs \
-R ${fasta} \
-V
gendb://${db
} \
-O ${
db
.simpleName}.vcf.gz \
-V
${gvcf
} \
-O ${
gvcf
.simpleName}.vcf.gz \
--tmp-dir ./tmp
"""
}
/*******************************************************************/
params.variant_calling = ""
params.variant_calling_out = ""
process variant_calling {
container = "${container_url}"
label "big_mem_mono_cpus"
...
...
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