Skip to content

Commit

Permalink
adding more steps
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacozzuto committed Jul 15, 2024
1 parent 6c4f44b commit c3ef1a9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 33 deletions.
58 changes: 33 additions & 25 deletions mop_dna/mop_dna.nf
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ comparison : ${params.comparison}
********** reference has to be the genome *************
reference : ${params.reference}
snpeff_db : ${params.snpeff_db}
clinvar_db : ${params.clinvar_db}
clinvar_db_idx : ${params.clinvar_db_idx}
output : ${params.output}
pars_tools : ${params.pars_tools}
************************* Flows *******************************
************************* SNPs ********************************
clairS : ${params.clairS}
clairS_TO : ${params.clairS_TO}
clair3 : ${params.clair3}
***************** Structural Variants *************************
sniffles : ${params.sniffles}
***************************************************************
filter : ${params.filter}
Expand Down Expand Up @@ -66,11 +71,13 @@ include { checkRef } from "${local_modules}"
progPars = getParameters(params.pars_tools)

include { RUN as RUN_CLAIRS } from "${subworkflowsDir}/snp_calling/clairS" addParams(LABEL: 'big_mem_cpus', EXTRAPARS: progPars["clairS--clairS"], OUTPUT: outputClairS)
include { RUN as RUN_CLAIRSTO } from "${subworkflowsDir}/snp_calling/clairS_TO" addParams(LABEL: 'big_mem_cpus', EXTRAPARS: progPars["clairS_TO--clairS_TO"], OUTPUT: outputClairS)
include { CHECK_FASTA } from "${subworkflowsDir}/misc/misc.nf"
include { FAIDX as SAMTOOLS_FAIDX } from "${subworkflowsDir}/misc/samtools"
include { RUN as RUN_SNIFFLES } from "${subworkflowsDir}/structural_variant/sniffles.nf" addParams(EXTRAPARS: progPars["sniffles--sniffles"], OUTPUT:outputSniffles, LABEL:'big_mem_cpus', CONTAINER:'quay.io/biocontainers/sniffles:2.3.3--pyhdfd78af_0')
include { RUN_MULTI as RUN_MULTI_SNIFFLES } from "${subworkflowsDir}/structural_variant/sniffles.nf" addParams(EXTRAPARS: progPars["sniffles_multi--sniffles"], OUTPUT:outputSniffles, LABEL:'big_mem_cpus', CONTAINER:'quay.io/biocontainers/sniffles:2.3.3--pyhdfd78af_0')
include { ANN as SNPEFF_ANN } from "${subworkflowsDir}/var_annotation/snpeff.nf" addParams(EXTRAPARS: progPars["commong--snpEff"], OUTPUT:outputAnnotation)
//include { RUN_MULTI as RUN_MULTI_SNIFFLES } from "${subworkflowsDir}/structural_variant/sniffles.nf" addParams(EXTRAPARS: progPars["sniffles_multi--sniffles"], OUTPUT:outputSniffles, LABEL:'big_mem_cpus', CONTAINER:'quay.io/biocontainers/sniffles:2.3.3--pyhdfd78af_0')
include { ANN as SNPEFF_ANN } from "${subworkflowsDir}/var_annotation/snpeff.nf" addParams(EXTRAPARS: progPars["common--snpEff"], OUTPUT:outputAnnotation)
include { ANN as SNPSIFT_ANN } from "${subworkflowsDir}/var_annotation/snpsift.nf" addParams(OUTPUT:outputAnnotation)
include { VIEW as BCFTOOLS_VIEW } from "${subworkflowsDir}/snp_calling/bcftools.nf" addParams(EXTRAPARS: progPars["filter--bcftools-view"], OUTPUT:outputFiltered)
include { REPORT as MULTIQC } from "${subworkflowsDir}/reporting/multiqc" addParams(OUTPUT:outputMultiQC)

Expand Down Expand Up @@ -128,20 +135,38 @@ workflow {
}
}

if (params.clairS_TO != "NO") {
out_clairsto = RUN_CLAIRSTO(bams.join(bais), checked_genome, faidx)

vcf_clairSTO = out_clairsto.snps.map{
[ "${it[0]}--clairS---snps", it[1][0] ]
}.mix(out_clairsto.indels.map{
[ "${it[0]}--clairS---indels", it[1][0] ]
})
}
// Structural variants
if (params.sniffles != "NO") {
vcf_sniffles = sniffles_flow(bams, bais, comparisons, checked_genome).map{
vcf_sniffles = sniffles_flow(bams, bais, checked_genome).map{
[ "${it[0]}--sniffles", it[1]]
}
}

all_vcf = vcf_clairS.mix(vcf_sniffles)
all_vcf = vcf_clairS.mix(vcf_sniffles).mix(vcf_clairSTO)

if (params.filter != "NO") {
filt_vcf = BCFTOOLS_VIEW(all_vcf)
}

annos = SNPEFF_ANN(filt_vcf, params.snpeff_db, snpEff_data, snpEff_config).csv_summary.map{it[1]}
out_snpeff = SNPEFF_ANN(filt_vcf, params.snpeff_db, snpEff_data, snpEff_config)
annos = out_snpeff.csv_summary.map{it[1]}

if (params.clinvar_db != "" && params.clinvar_db_idx != "") {
clinvarDB = channel.fromPath(params.clinvar_db, checkIfExists: true)
clinvarDBi = channel.fromPath(params.clinvar_db_idx, checkIfExists: true)
SNPSIFT_ANN(out_snpeff.annotation, clinvarDB, clinvarDBi)
}


MULTIQC(annos.collect())
}

Expand Down Expand Up @@ -179,31 +204,14 @@ workflow sniffles_flow {
take:
bam
bais
comparisons
reference


main:
bam_comp = mapIDPairs(comparisons, bam).map{
[ "${it[0]}--${it[1]}", it[2], it[3] ]
}


bai_comp = mapIDPairs(comparisons, bais).map{
[ "${it[0]}--${it[1]}", it[2], it[3] ]
}

data = bam_comp.join(bai_comp)
out = RUN_SNIFFLES(bam, bais, reference)

snf_comp = mapIDPairs(comparisons, out.snf).map{
[ "${it[0]}--${it[1]}", [ it[2], it[3] ] ]
}

out = RUN_MULTI_SNIFFLES(snf_comp)


emit:
out
out.vcf

}

Expand Down
16 changes: 12 additions & 4 deletions mop_dna/params.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
input_path: "${projectDir}/test_dataset/"
comparison: "${projectDir}/comparison.tsv"

##reference: "${projectDir}/GRCh38.primary_assembly.genome.fa"
reference: "/db/gencode/human/release_38/GRCh38.primary_assembly.genome.fa.gz"
snpeff_db: "GRCh38.105"
clinvar_db: "${projectDir}/clinvar/clinvar_20240630.vcf.gz"
clinvar_db_idx: "${projectDir}/clinvar/clinvar_20240630.vcf.gz.tbi"
output: "${projectDir}/output_dna"
pars_tools: "${projectDir}/tools_opt.tsv"

# flows
clairS: "YES"
# clair flows
## clairS for comparing tumor/normal samples
clairS: "NO"
comparison: "${projectDir}/comparison.tsv"
## clairS-TO (tumor only)
clairS_TO: "YES"

## sniffles for structural variants
sniffles: "YES"

## Commmon flows
filter: "YES"
annotation: "YES"

# epinano plots
hook: ""
email: ""
4 changes: 2 additions & 2 deletions mop_dna/tools_opt.tsv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#flows tool extrapars
sniffles sniffles "--tandem-repeats ${projectDir}/anno/human_GRCh38_no_alt_analysis_set.trf.bed"
sniffles_multi sniffles ""
clairS clairS "-p ont_r9_guppy"
clairS clairS ""
clairS_TO clairS_TO "-p ont_r10_dorado_sup_5khz"
filter bcftools-view "-f PASS"
common snpEff ""
2 changes: 1 addition & 1 deletion outdirs.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ outputTomboFlow = "${params.output}/tombo_flow"
outputModPhredFlow = "${params.output}/modphred_flow"

// mop_dna
outputClairS = "${params.output}/clairS_flow"
outputClairS = "${params.output}/clair_flow"
outputSniffles = "${params.output}/sniffles_flow"
outputAnnotation = "${params.output}/annotation"
outputFiltered = "${params.output}/filtered_vcf"
Expand Down

0 comments on commit c3ef1a9

Please sign in to comment.