Skip to content

Commit

Permalink
Updating alignment subworkflow and modules
Browse files Browse the repository at this point in the history
  • Loading branch information
RaqManzano committed Aug 21, 2023
1 parent 6b39dd8 commit 28fe888
Show file tree
Hide file tree
Showing 28 changed files with 671 additions and 816 deletions.
79 changes: 32 additions & 47 deletions lib/WorkflowRnadnavar.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ class WorkflowRnadnavar {
// Check and validate parameters
//
public static void initialise(params, log) {

genomeExistsError(params, log)


if (!params.fasta) {
if (!params.fasta && params.step == 'annotate') {
Nextflow.error "Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file."
}
}
Expand Down Expand Up @@ -47,57 +45,15 @@ class WorkflowRnadnavar {
return yaml_file_text
}

//
// Generate methods description for MultiQC
//

public static String toolCitationText(params) {

// TODO Optionally add in-text citation tools to this list.
// Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "Tool (Foo et al. 2023)" : "",
// Uncomment function in methodsDescriptionText to render in MultiQC report
def citation_text = [
"Tools used in the workflow included:",
"FastQC (Andrews 2010),",
"MultiQC (Ewels et al. 2016)",
"."
].join(' ').trim()

return citation_text
}

public static String toolBibliographyText(params) {

// TODO Optionally add bibliographic entries to this list.
// Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "<li>Author (2023) Pub name, Journal, DOI</li>" : "",
// Uncomment function in methodsDescriptionText to render in MultiQC report
def reference_text = [
"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",
"<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>"
].join(' ').trim()

return reference_text
}

public static String methodsDescriptionText(run_workflow, mqc_methods_yaml, params) {
public static String methodsDescriptionText(run_workflow, mqc_methods_yaml) {
// Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file
def meta = [:]
meta.workflow = run_workflow.toMap()
meta["manifest_map"] = run_workflow.manifest.toMap()

// Pipeline DOI
meta["doi_text"] = meta.manifest_map.doi ? "(doi: <a href=\'https://doi.org/${meta.manifest_map.doi}\'>${meta.manifest_map.doi}</a>)" : ""
meta["nodoi_text"] = meta.manifest_map.doi ? "": "<li>If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used. </li>"

// Tool references
meta["tool_citations"] = ""
meta["tool_bibliography"] = ""

// TODO Only uncomment below if logic in toolCitationText/toolBibliographyText has been filled!
//meta["tool_citations"] = toolCitationText(params).replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".")
//meta["tool_bibliography"] = toolBibliographyText(params)


def methods_text = mqc_methods_yaml.text

def engine = new SimpleTemplateEngine()
Expand All @@ -119,4 +75,33 @@ class WorkflowRnadnavar {
Nextflow.error(error_string)
}
}
}
// TODO add consensus and filtering steps here
public static String retrieveInput(params, log){
def input = ''
if (params.input) input = params.input
else {
switch (params.step) {
case 'mapping': Nextflow.error("Can't start with step $params.step without samplesheet")
break
case 'markduplicates': log.warn("Using file ${params.outdir}/csv/mapped.csv");
input = params.outdir + "/csv/mapped.csv"
break
case 'prepare_recalibration': log.warn("Using file ${params.outdir}/csv/markduplicates_no_table.csv");
input = params.outdir + "/csv/markduplicates_no_table.csv"
break
case 'recalibrate': log.warn("Using file ${params.outdir}/csv/markduplicates.csv");
input = params.outdir + "/csv/markduplicates.csv"
break
case 'variant_calling': log.warn("Using file ${params.outdir}/csv/recalibrated.csv");
input = params.outdir + "/csv/recalibrated.csv"
break
case 'annotate': log.warn("Using file ${params.outdir}/csv/variantcalled.csv");
input = params.outdir + "/csv/variantcalled.csv"
break
default: log.warn("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'")
Nextflow.error("Unknown step $params.step")
}
}
return input
}
}
17 changes: 14 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env nextflow

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-core/rnadnavar
Expand All @@ -17,7 +18,9 @@ nextflow.enable.dsl = 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta')
params.bwa = WorkflowMain.getGenomeAttribute(params, 'bwa')
params.bwamem2 = WorkflowMain.getGenomeAttribute(params, 'bwamem2')
params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta')
params.fasta_fai = WorkflowMain.getGenomeAttribute(params, 'fasta_fai')
params.dict = WorkflowMain.getGenomeAttribute(params, 'dict')
params.gtf = WorkflowMain.getGenomeAttribute(params, 'gtf')
Expand All @@ -33,6 +36,15 @@ params.vep_genome = WorkflowMain.getGenomeAttribute(params, 'vep_genom
params.vep_species = WorkflowMain.getGenomeAttribute(params, 'vep_species')


/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALTERNATIVE INPUT FILE ON RESTART
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

params.input_restart = WorkflowRnadnavar.retrieveInput(params, log)


/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VALIDATE & PRINT PARAMETER SUMMARY
Expand All @@ -45,7 +57,7 @@ include { validateParameters; paramsHelp } from 'plugin/nf-validation'
if (params.help) {
def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GRCh37 -profile docker"
def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GATK.GRCh38 -profile docker --outdir results"
log.info logo + paramsHelp(command) + citation + NfcoreTemplate.dashedLine(params.monochrome_logs)
System.exit(0)
}
Expand Down Expand Up @@ -81,7 +93,6 @@ workflow NFCORE_RNADNAVAR {
//
// WORKFLOW: Execute a single named workflow for the pipeline
// See: https://github.com/nf-core/rnaseq/issues/619
//
workflow {
NFCORE_RNADNAVAR ()
}
Expand Down
105 changes: 90 additions & 15 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"bwa/mem": {
"branch": "master",
"git_sha": "3dc300ddcaa563c1e3503477557c0e0def6df2ce",
"installed_by": ["modules"]
"installed_by": ["modules", "fastq_align_bwa"]
},
"bwamem2/index": {
"branch": "master",
Expand All @@ -50,15 +50,30 @@
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"dragmap/align": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"installed_by": ["modules"]
},
"dragmap/hashtable": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"ensemblvep": {
"branch": "master",
"git_sha": "29984d70aea47d06f0062a1785d76c357dd40ea9",
"installed_by": ["modules"]
},
"ensemblvep/download": {
"branch": "master",
"git_sha": "9f9e1fc31cb35876922070c0e601ae05abae5cae",
"installed_by": ["modules"]
},
"ensemblvep/vep": {
"branch": "master",
"git_sha": "9f9e1fc31cb35876922070c0e601ae05abae5cae",
"installed_by": ["vcf_annotate_ensemblvep"]
"installed_by": ["vcf_annotate_ensemblvep", "modules"]
},
"fastp": {
"branch": "master",
Expand Down Expand Up @@ -108,7 +123,7 @@
"gatk4/calculatecontamination": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": ["bam_tumor_normal_somatic_variant_calling_gatk", "modules"]
},
"gatk4/createsequencedictionary": {
"branch": "master",
Expand All @@ -123,7 +138,7 @@
"gatk4/filtermutectcalls": {
"branch": "master",
"git_sha": "2df2a11d5b12f2a73bca74f103691bc35d83c5fd",
"installed_by": ["modules"]
"installed_by": ["bam_tumor_normal_somatic_variant_calling_gatk", "modules"]
},
"gatk4/filtervarianttranches": {
"branch": "master",
Expand Down Expand Up @@ -153,7 +168,7 @@
"gatk4/getpileupsummaries": {
"branch": "master",
"git_sha": "2df2a11d5b12f2a73bca74f103691bc35d83c5fd",
"installed_by": ["modules"]
"installed_by": ["bam_tumor_normal_somatic_variant_calling_gatk", "modules"]
},
"gatk4/indexfeaturefile": {
"branch": "master",
Expand All @@ -173,7 +188,7 @@
"gatk4/learnreadorientationmodel": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": ["bam_tumor_normal_somatic_variant_calling_gatk", "modules"]
},
"gatk4/markduplicates": {
"branch": "master",
Expand All @@ -198,7 +213,7 @@
"gatk4/mutect2": {
"branch": "master",
"git_sha": "2df2a11d5b12f2a73bca74f103691bc35d83c5fd",
"installed_by": ["modules"]
"installed_by": ["bam_tumor_normal_somatic_variant_calling_gatk", "modules"]
},
"gatk4/splitncigarreads": {
"branch": "master",
Expand Down Expand Up @@ -228,7 +243,7 @@
"hisat2/align": {
"branch": "master",
"git_sha": "a1881f6374506f9e031b7af814768cdb44a6a7d3",
"installed_by": ["modules"]
"installed_by": ["fastq_align_hisat2", "modules"]
},
"hisat2/build": {
"branch": "master",
Expand All @@ -255,11 +270,31 @@
"git_sha": "a6e11ac655e744f7ebc724be669dd568ffdc0e80",
"installed_by": ["modules"]
},
"picard/collecthsmetrics": {
"branch": "master",
"git_sha": "0ce3ab0ac301f160225b22254fa238478b4389f2",
"installed_by": ["bam_qc_picard"]
},
"picard/collectmultiplemetrics": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["bam_qc_picard"]
},
"picard/collectwgsmetrics": {
"branch": "master",
"git_sha": "735e1e04e7e01751d2d6e97055bbdb6f70683cc1",
"installed_by": ["bam_qc_picard"]
},
"picard/filtersamreads": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"picard/markduplicates": {
"branch": "master",
"git_sha": "735e1e04e7e01751d2d6e97055bbdb6f70683cc1",
"installed_by": ["bam_markduplicates_picard"]
},
"samblaster": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
Expand Down Expand Up @@ -288,17 +323,17 @@
"samtools/flagstat": {
"branch": "master",
"git_sha": "570ec5bcfe19c49e16c9ca35a7a116563af6cc1c",
"installed_by": ["modules"]
"installed_by": ["bam_stats_samtools", "modules"]
},
"samtools/idxstats": {
"branch": "master",
"git_sha": "e662ab16e0c11f1e62983e21de9871f59371a639",
"installed_by": ["modules"]
"installed_by": ["bam_stats_samtools", "modules"]
},
"samtools/index": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": ["bam_markduplicates_picard", "modules", "bam_sort_stats_samtools"]
},
"samtools/merge": {
"branch": "master",
Expand All @@ -313,12 +348,12 @@
"samtools/sort": {
"branch": "master",
"git_sha": "a0f7be95788366c1923171e358da7d049eb440f9",
"installed_by": ["modules"]
"installed_by": ["bam_sort_stats_samtools", "modules"]
},
"samtools/stats": {
"branch": "master",
"git_sha": "735e1e04e7e01751d2d6e97055bbdb6f70683cc1",
"installed_by": ["modules"]
"installed_by": ["bam_stats_samtools", "modules"]
},
"samtools/view": {
"branch": "master",
Expand All @@ -328,7 +363,7 @@
"star/align": {
"branch": "master",
"git_sha": "57d75dbac06812c59798a48585032f6e50bb1914",
"installed_by": ["modules"]
"installed_by": ["fastq_align_star", "modules"]
},
"star/genomegenerate": {
"branch": "master",
Expand All @@ -348,7 +383,7 @@
"tabix/tabix": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules", "vcf_annotate_ensemblvep"]
"installed_by": ["vcf_annotate_ensemblvep", "modules"]
},
"untar": {
"branch": "master",
Expand All @@ -369,6 +404,46 @@
},
"subworkflows": {
"nf-core": {
"bam_markduplicates_picard": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"bam_qc_picard": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"bam_sort_stats_samtools": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["fastq_align_bwa", "fastq_align_star", "fastq_align_hisat2"]
},
"bam_stats_samtools": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["bam_markduplicates_picard", "bam_sort_stats_samtools"]
},
"bam_tumor_normal_somatic_variant_calling_gatk": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"fastq_align_bwa": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"fastq_align_hisat2": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"fastq_align_star": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"vcf_annotate_ensemblvep": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
Expand Down
Loading

0 comments on commit 28fe888

Please sign in to comment.