Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VCF output #25

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions conf/conda.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ process {
withName: mafstats {
conda = "$projectDir/assets/maf-environment.yml"
}
withName: maf2mfa {
conda = "$projectDir/assets/maf-environment.yml"
}
}
6 changes: 6 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ include {PREPROC} from './modules/subworkflows/preprocess' params(params)
include {LIFTOVER} from './modules/subworkflows/liftover' params(params)
include {DATA} from './modules/subworkflows/data' params(params)
include {make_report} from './modules/processes/postprocess' params(params)
include {maf2mfa; mfa2vcf} from "./modules/processes/postprocess" params(params)
workflow {
DATA()
ch_source = DATA.out.ch_source
Expand All @@ -134,5 +135,10 @@ workflow {
if (params.mafTools || params.annotation || workflow.containerEngine){
rmd = Channel.fromPath("${baseDir}/assets/gatherMetrics.Rmd")
make_report(ALIGNER.out.mafs, ALIGNER.out.mafc, ALIGNER.out.mafi, liftstats, rmd)

// Make VCF file
}
if (params.vcf){
maf2mfa(ALIGNER.out.maf, ch_source, ch_target) | mfa2vcf
}
}
52 changes: 52 additions & 0 deletions modules/processes/postprocess.nf
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,58 @@ process mafstats {
"""
}

process maf2mfa {
tag "mafstats"
publishDir "${params.outdir}/maf", mode: 'copy', overwrite: true
label 'medium'

input:
path final_maf
val sourceFa
val targetFa

output:
path "${final_maf.baseName}.mfa"

stub:
"""
touch ${final_maf.baseName}.mfa
"""

script:
"""
mafToFastaStitcher --maf ${final_maf} --seqs ${sourceFa},${targetFa} --breakpointPenalty 5 --interstitialSequence 20 --outMfa ${final_maf.baseName}.mfa
"""
}

process mfa2vcf {
tag "mafstats"
publishDir "${params.outdir}/vcf", mode: 'copy', overwrite: true
label 'medium'
conda "bioconda::ucsc-fatovcf bioconda::tabix"

input:
path mfa

output:
path "${mfa.baseName}.vcf.gz"
path "${mfa.baseName}.vcf.gz.tbi"

stub:
"""
touch ${mfa.baseName}.vcf.gz
touch ${mfa.baseName}.vcf.gz.tbi
"""

script:
"""
faToVcf ${mfa} ${mfa.baseName}.vcf
bgzip ${mfa.baseName}.vcf
tabix -p vcf ${mfa.baseName}.vcf.gz
"""
}


// Liftover functions
process liftover{
tag "liftover"
Expand Down
7 changes: 4 additions & 3 deletions modules/subworkflows/GSAlign.nf
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ workflow GSALIGN {
net_ch = netSynt.out
}
chainsubset(net_ch, chainMerge.out)
if(!params.no_maf){
if(!params.no_maf || params.vcf){
chain2maf( chainsubset.out[0], twoBitS, twoBitT, twoBitSN, twoBitTN )
name_maf_seq( chain2maf.out )
mafstats( name_maf_seq.out, ch_source.simpleName, ch_target.simpleName )
maf = name_maf_seq( chain2maf.out )
mafstats( maf, ch_source.simpleName, ch_target.simpleName )
mafs = mafstats.out[0]
mafc = mafstats.out[1]
mafi = mafstats.out[2]
Expand All @@ -84,4 +84,5 @@ workflow GSALIGN {
mafs
mafc
mafi
maf
}
7 changes: 4 additions & 3 deletions modules/subworkflows/blat.nf
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ workflow BLAT {
net_ch = netSynt.out
}
chainsubset(net_ch, chainMerge.out)
if(!params.no_maf){
if(!params.no_maf || params.vcf){
chain2maf( chainsubset.out[0], twoBitS, twoBitT, twoBitSN, twoBitTN )
name_maf_seq( chain2maf.out )
mafstats( name_maf_seq.out, ch_source.simpleName, ch_target.simpleName )
maf = name_maf_seq( chain2maf.out )
mafstats( maf, ch_source.simpleName, ch_target.simpleName )
mafs = mafstats.out[0]
mafc = mafstats.out[1]
mafi = mafstats.out[2]
Expand All @@ -88,4 +88,5 @@ workflow BLAT {
mafs
mafc
mafi
maf
}
7 changes: 4 additions & 3 deletions modules/subworkflows/lastz.nf
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ workflow LASTZ {
net_ch = netSynt.out
}
chainsubset(net_ch, chainMerge.out)
if(!params.no_maf){
if(!params.no_maf || params.vcf){
chain2maf( chainsubset.out[0], twoBitS, twoBitT, twoBitSN, twoBitTN )
name_maf_seq( chain2maf.out )
mafstats( name_maf_seq.out, ch_source.simpleName, ch_target.simpleName )
maf = name_maf_seq( chain2maf.out )
mafstats( maf, ch_source.simpleName, ch_target.simpleName )
mafs = mafstats.out[0]
mafc = mafstats.out[1]
mafi = mafstats.out[2]
Expand All @@ -96,4 +96,5 @@ workflow LASTZ {
mafs
mafc
mafi
maf
}
7 changes: 4 additions & 3 deletions modules/subworkflows/minimap2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ workflow MINIMAP2 {
net_ch = netSynt.out
}
chainsubset(net_ch, chainMerge.out)
if(!params.no_maf){
if(!params.no_maf || params.vcf){
chain2maf( chainsubset.out[0], twoBitS, twoBitT, twoBitSN, twoBitTN )
name_maf_seq( chain2maf.out )
mafstats( name_maf_seq.out, ch_source.simpleName, ch_target.simpleName )
maf = name_maf_seq( chain2maf.out )
mafstats( maf, ch_source.simpleName, ch_target.simpleName )
mafs = mafstats.out[0]
mafc = mafstats.out[1]
mafi = mafstats.out[2]
Expand All @@ -78,4 +78,5 @@ workflow MINIMAP2 {
mafs
mafc
mafi
maf
}
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ params {
igenomes_base = 's3://ngi-igenomes/igenomes/'
igenomes_ignore = false
no_maf = false
vcf = false
no_netsynt = false
mafTools = null
reciprocal_best = false
Expand Down
36 changes: 20 additions & 16 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@
},
"source": {
"type": "string",
"default": "null"
"default": null
},
"target": {
"type": "string",
"default": "null"
"default": null
},
"ncbi_source": {
"type": "boolean",
"default": "false"
"default": false
},
"ncbi_target": {
"type": "boolean",
"default": "false"
"default": false
},
"igenomes_source": {
"type": "boolean",
"default": "false"
"default": false
},
"igenomes_target": {
"type": "boolean",
"default": "false"
"default": false
},
"annotation": {
"type": "string",
"default": "null"
"default": null
},
"annotation_format": {
"type": "string",
"default": "null",
"enum": ["null", "gff", "bed", "gtf", "vcf", "bam", "maf"]
"default": null,
"enum": [null, "gff", "bed", "gtf", "vcf", "bam", "maf"]
}
}
},
Expand Down Expand Up @@ -93,11 +93,11 @@
},
"qscores": {
"type": "string",
"default": "null"
"default": null
},
"custom": {
"type": "string",
"default": "null"
"default": null
}
}
},
Expand All @@ -109,15 +109,15 @@
"properties": {
"chainCustom": {
"type": "string",
"default": "null"
"default": null
},
"chain_name": {
"type": "string",
"default": "liftover"
},
"no_netsynt": {
"type": "boolean",
"default": "false"
"default": false
}
}
},
Expand Down Expand Up @@ -146,11 +146,15 @@
},
"no_maf": {
"type": "boolean",
"default": "false"
"default": false
},
"vcf": {
"type": "boolean",
"default": false
},
"mafTools": {
"type": "string",
"default": "null"
"default": null
}
}
},
Expand Down Expand Up @@ -252,7 +256,7 @@
"mamba": {
"description": "Use mamba instead of conda to create the anaconda environment.",
"type": "boolean",
"default": "false"
"default": false
},
"extra_cluster_options": {
"description": "Additional cluster options to be used; valid in some clusters only.",
Expand Down
Loading