Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions conf/modules/rank_variants.config
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ process {
}

withName: '.*RANK_VARIANTS_SNV:BCFTOOLS_SORT' {
ext.when = false
}

withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIP' {
ext.args = "--output-type z"
ext.prefix = { "${meta.id}_snv_ranked_${meta.set}" }
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
Expand All @@ -107,6 +104,10 @@ process {
]
}

withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIP' {
ext.when = false
}

withName: '.*RANK_VARIANTS_SNV:TABIX_TABIX' {
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
Expand Down Expand Up @@ -147,10 +148,7 @@ process {
}

withName: '.*RANK_VARIANTS_MT:BCFTOOLS_SORT' {
ext.when = false
}

withName: '.*RANK_VARIANTS_MT:TABIX_BGZIP' {
ext.args = "--output-type z"
ext.prefix = { "${meta.id}_mt_ranked_${meta.set}" }
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
Expand All @@ -159,6 +157,10 @@ process {
]
}

withName: '.*RANK_VARIANTS_MT:TABIX_BGZIP' {
ext.when = false
}

withName: '.*RANK_VARIANTS_MT:TABIX_TABIX' {
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
Expand Down
9 changes: 6 additions & 3 deletions modules/local/create_hgncids_file/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ process CREATE_HGNCIDS_FILE {
for line in input:
if not line.startswith("#") and line.strip():
spl = line.strip().split("\\t")
output.write(spl[3]+"\\n")
output.write("HGNC:" + spl[3] + "\\n")
else:
for line in input:
if not line.startswith("#"):
output.write(line)
if not line.startswith("#") and line.strip():
hgnc_id = line.strip()
if not hgnc_id.startswith("HGNC:"):
hgnc_id = "HGNC:" + hgnc_id
output.write(hgnc_id + "\\n")
CODE

cat <<-END_VERSIONS > versions.yml
Expand Down
62 changes: 62 additions & 0 deletions modules/local/fix_expansionhunter_header/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
process BCFTOOLS_FIXEXPANSIONHUNTERHEADER {
tag "$meta.id"
label 'process_single'

conda "bioconda::bcftools=1.20"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bcftools:1.20--h8b25389_0':
'biocontainers/bcftools:1.20--h8b25389_0' }"

input:
tuple val(meta), path(vcf)

output:
tuple val(meta), path("*.vcf"), emit: vcf
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
# Create header file with missing INFO and FORMAT fields from ExpansionHunter
cat > expansionhunter_headers.txt << 'EOF'
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant">
##INFO=<ID=REF,Number=1,Type=Integer,Description="Reference copy number">
##INFO=<ID=REPID,Number=1,Type=String,Description="Repeat identifier from the variant catalog">
##INFO=<ID=RL,Number=1,Type=Integer,Description="Reference length in bp">
##INFO=<ID=RU,Number=1,Type=String,Description="Repeat unit in the reference orientation">
##FORMAT=<ID=SO,Number=1,Type=String,Description="Type of reads that support the allele; can be SPANNING, FLANKING, or INREPEAT">
##FORMAT=<ID=REPCN,Number=1,Type=String,Description="Number of repeat units spanned by the allele">
##FORMAT=<ID=REPCI,Number=1,Type=String,Description="Confidence interval for REPCN">
##FORMAT=<ID=ADSP,Number=1,Type=String,Description="Number of spanning reads consistent with the allele">
##FORMAT=<ID=ADFL,Number=1,Type=String,Description="Number of flanking reads consistent with the allele">
##FORMAT=<ID=ADIR,Number=1,Type=String,Description="Number of in-repeat reads consistent with the allele">
EOF

# Add missing headers to VCF
bcftools annotate \\
-h expansionhunter_headers.txt \\
$args \\
-o ${prefix}.vcf \\
$vcf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.vcf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}
9 changes: 8 additions & 1 deletion subworkflows/local/call_repeat_expansions.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Run ExpansionHunter and Stranger
//

include { BCFTOOLS_FIXEXPANSIONHUNTERHEADER } from '../../modules/local/fix_expansionhunter_header/main'
include { BCFTOOLS_NORM as SPLIT_MULTIALLELICS_EXP } from '../../modules/nf-core/bcftools/norm/main'
include { BCFTOOLS_REHEADER as BCFTOOLS_REHEADER_EXP } from '../../modules/nf-core/bcftools/reheader/main'
include { EXPANSIONHUNTER } from '../../modules/nf-core/expansionhunter/main'
Expand Down Expand Up @@ -38,7 +39,11 @@ workflow CALL_REPEAT_EXPANSIONS {
EXPANSIONHUNTER.out.vcf.map{ meta, vcf -> [ meta, vcf, [], [] ]},
ch_genome_fai
)
RENAMESAMPLE_EXP ( BCFTOOLS_REHEADER_EXP.out.vcf )

// Fix missing INFO headers from ExpansionHunter
BCFTOOLS_FIXEXPANSIONHUNTERHEADER ( BCFTOOLS_REHEADER_EXP.out.vcf )

RENAMESAMPLE_EXP ( BCFTOOLS_FIXEXPANSIONHUNTERHEADER.out.vcf )
TABIX_EXP_RENAME ( RENAMESAMPLE_EXP.out.vcf )

// Split multi allelelic
Expand Down Expand Up @@ -68,6 +73,8 @@ workflow CALL_REPEAT_EXPANSIONS {
ch_versions = ch_versions.mix(SVDB_MERGE_REPEATS.out.versions.first())
ch_versions = ch_versions.mix(SAMTOOLS_SORT.out.versions.first())
ch_versions = ch_versions.mix(SAMTOOLS_INDEX.out.versions.first())
ch_versions = ch_versions.mix(BCFTOOLS_FIXEXPANSIONHUNTERHEADER.out.versions.first())


emit:
vcf = SVDB_MERGE_REPEATS.out.vcf // channel: [ val(meta), path(vcf) ]
Expand Down
Loading