Skip to content

Commit

Permalink
resolve some conflicts with template update
Browse files Browse the repository at this point in the history
  • Loading branch information
a4000 committed Mar 20, 2024
1 parent 38783b6 commit b57d2fa
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 107 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
</picture>
</h1>

[![GitHub Actions CI Status](https://github.com/nf-core/readsimulator/workflows/nf-core%20CI/badge.svg)](https://github.com/nf-core/readsimulator/actions?query=workflow%3A%22nf-core+CI%22)
[![GitHub Actions Linting Status](https://github.com/nf-core/readsimulator/workflows/nf-core%20linting/badge.svg)](https://github.com/nf-core/readsimulator/actions?query=workflow%3A%22nf-core+linting%22)[![AWS CI](https://img.shields.io/badge/CI%20tests-full%20size-FF9900?labelColor=000000&logo=Amazon%20AWS)](https://nf-co.re/readsimulator/results)[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.10622410-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.10622410)
[![GitHub Actions CI Status](https://github.com/nf-core/readsimulator/actions/workflows/ci.yml/badge.svg)](https://github.com/nf-core/readsimulator/actions/workflows/ci.yml)
[![GitHub Actions Linting Status](https://github.com/nf-core/readsimulator/actions/workflows/linting.yml/badge.svg)](https://github.com/nf-core/readsimulator/actions/workflows/linting.yml)[![AWS CI](https://img.shields.io/badge/CI%20tests-full%20size-FF9900?labelColor=000000&logo=Amazon%20AWS)](https://nf-co.re/readsimulator/results)[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.10622410-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.10622410)
[![nf-test](https://img.shields.io/badge/unit_tests-nf--test-337ab7.svg)](https://www.nf-test.com)

[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A523.04.0-23aa62.svg)](https://www.nextflow.io/)
[![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/)
[![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/)
[![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/)
[![Launch on Nextflow Tower](https://img.shields.io/badge/Launch%20%F0%9F%9A%80-Nextflow%20Tower-%234256e7)](https://tower.nf/launch?pipeline=https://github.com/nf-core/readsimulator)
[![Launch on Seqera Platform](https://img.shields.io/badge/Launch%20%F0%9F%9A%80-Seqera%20Platform-%234256e7)](https://tower.nf/launch?pipeline=https://github.com/nf-core/readsimulator)

[![Get help on Slack](http://img.shields.io/badge/slack-nf--core%20%23readsimulator-4A154B?labelColor=000000&logo=slack)](https://nfcore.slack.com/channels/readsimulator)[![Follow on Twitter](http://img.shields.io/badge/twitter-%40nf__core-1DA1F2?labelColor=000000&logo=twitter)](https://twitter.com/nf_core)[![Follow on Mastodon](https://img.shields.io/badge/mastodon-nf__core-6364ff?labelColor=FFFFFF&logo=mastodon)](https://mstdn.science/@nf_core)[![Watch on YouTube](http://img.shields.io/badge/youtube-nf--core-FF0000?labelColor=000000&logo=youtube)](https://www.youtube.com/c/nf-core)

Expand Down Expand Up @@ -112,7 +113,7 @@ For further information or help, don't hesitate to get in touch on the [Slack `#

## Citations

If you use nf-core/readsimulator for your analysis, please cite it using the following doi: [10.5281/zenodo.XXXXXX](https://doi.org/10.5281/zenodo.10622410)
If you use nf-core/readsimulator for your analysis, please cite it using the following doi: [10.5281/zenodo.10622410](https://doi.org/10.5281/zenodo.10622410)

<!-- TODO nf-core: Add bibliography of tools and data used in your pipeline -->

Expand Down
143 changes: 40 additions & 103 deletions workflows/readsimulator/main.nf
Original file line number Diff line number Diff line change
@@ -1,85 +1,43 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PRINT PARAMS SUMMARY
IMPORT MODULES / SUBWORKFLOWS / FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { paramsSummaryLog; paramsSummaryMap } from 'plugin/nf-validation'

def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
def summary_params = paramsSummaryMap(workflow)

// Print parameter summary log to screen
log.info logo + paramsSummaryLog(workflow) + citation

WorkflowReadsimulator.initialise(params, log)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIG FILES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config, checkIfExists: true ) : Channel.empty()
ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo, checkIfExists: true ) : Channel.empty()
ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT LOCAL MODULES/SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// MODULE: Local modules
//
include { MERGE_FASTAS } from '../../modules/local/custom/merge_fastas/main'
include { INSILICOSEQ_GENERATE } from '../../modules/local/insilicoseq/generate/main' // TODO: Add module to nf-core/modules
include { CREATE_SAMPLESHEET } from '../../modules/local/custom/create_samplesheet/main'
include { MERGE_SAMPLESHEETS } from '../../modules/local/custom/merge_samplesheets/main'
include { WGSIM } from '../../modules/local/wgsim/main' // TODO: Add module to nf-core/modules

//
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
//
include { AMPLICON_WORKFLOW } from '../../subworkflows/local/amplicon_workflow'
include { TARGET_CAPTURE_WORKFLOW } from '../../subworkflows/local/target_capture_workflow'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT NF-CORE MODULES/SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// MODULE: Installed directly from nf-core/modules
//
include { FASTQC } from '../../modules/nf-core/fastqc/main'
include { NCBIGENOMEDOWNLOAD } from '../../modules/nf-core/ncbigenomedownload/main'
include { MULTIQC } from '../../modules/nf-core/multiqc/main'
include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../../modules/nf-core/custom/dumpsoftwareversions/main'
include { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../../subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from '../../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../../subworkflows/local/utils_nfcore_readsimulator_pipeline'
include { MERGE_FASTAS } from '../../modules/local/custom/merge_fastas/main'
include { INSILICOSEQ_GENERATE } from '../../modules/local/insilicoseq/generate/main' // TODO: Add module to nf-core/modules
include { CREATE_SAMPLESHEET } from '../../modules/local/custom/create_samplesheet/main'
include { MERGE_SAMPLESHEETS } from '../../modules/local/custom/merge_samplesheets/main'
include { WGSIM } from '../../modules/local/wgsim/main' // TODO: Add module to nf-core/modules
include { AMPLICON_WORKFLOW } from '../../subworkflows/local/amplicon_workflow'
include { TARGET_CAPTURE_WORKFLOW } from '../../subworkflows/local/target_capture_workflow'
include { NCBIGENOMEDOWNLOAD } from '../../modules/nf-core/ncbigenomedownload/main'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// Info required for completion email and summary
def multiqc_report = []

workflow READSIMULATOR {

take:
ch_input
ch_samplesheet // channel: samplesheet read in from --input

main:

ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
ch_simulated_reads = Channel.empty()
ch_taxids = Channel.empty()
ch_accessions = Channel.empty()
ch_fasta = Channel.empty()

if ( params.fasta ) {
ch_fasta = Channel.fromPath(params.fasta)
Expand Down Expand Up @@ -126,7 +84,7 @@ workflow READSIMULATOR {
if ( params.amplicon ) {
AMPLICON_WORKFLOW (
ch_fasta.ifEmpty([]),
ch_input
ch_samplesheet
)
ch_versions = ch_versions.mix(AMPLICON_WORKFLOW.out.versions.first())
ch_simulated_reads = ch_simulated_reads.mix(AMPLICON_WORKFLOW.out.reads)
Expand All @@ -138,7 +96,7 @@ workflow READSIMULATOR {
if ( params.target_capture ) {
TARGET_CAPTURE_WORKFLOW (
ch_fasta,
ch_input,
ch_samplesheet,
ch_probes.ifEmpty([])
)
ch_versions = ch_versions.mix(TARGET_CAPTURE_WORKFLOW.out.versions.first())
Expand All @@ -150,8 +108,7 @@ workflow READSIMULATOR {
//
if ( params.metagenome ) {
INSILICOSEQ_GENERATE (
ch_input.combine(ch_fasta.ifEmpty([[]])),
params.metagenome_input_format
ch_samplesheet.combine(ch_fasta.ifEmpty([[]]))
)
ch_versions = ch_versions.mix(INSILICOSEQ_GENERATE.out.versions.first())
ch_metagenome_reads = INSILICOSEQ_GENERATE.out.fastq
Expand All @@ -169,7 +126,7 @@ workflow READSIMULATOR {
//
if ( params.wholegenome ) {
WGSIM (
ch_input.combine(ch_fasta)
ch_samplesheet.combine(ch_fasta)
)
ch_versions = ch_versions.mix(WGSIM.out.versions.first())
ch_wholegenome_reads = WGSIM.out.fastq
Expand Down Expand Up @@ -212,62 +169,42 @@ workflow READSIMULATOR {
FASTQC (
ch_simulated_reads
)
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]})
ch_versions = ch_versions.mix(FASTQC.out.versions.first())

CUSTOM_DUMPSOFTWAREVERSIONS (
ch_versions.unique().collectFile(name: 'collated_versions.yml')
)
//
// Collate and save software versions
//
softwareVersionsToYAML(ch_versions)
.collectFile(storeDir: "${params.outdir}/pipeline_info", name: 'nf_core_pipeline_software_mqc_versions.yml', sort: true, newLine: true)
.set { ch_collated_versions }

//
// MODULE: MultiQC
//
workflow_summary = WorkflowReadsimulator.paramsSummaryMultiqc(workflow, summary_params)
ch_workflow_summary = Channel.value(workflow_summary)

methods_description = WorkflowReadsimulator.methodsDescriptionText(workflow, ch_multiqc_custom_methods_description, params)
ch_methods_description = Channel.value(methods_description)

ch_multiqc_files = Channel.empty()
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect())
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}.ifEmpty([]))
ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config, checkIfExists: true) : Channel.empty()
ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath(params.multiqc_logo, checkIfExists: true) : Channel.empty()
summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json")
ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params))
ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)
ch_methods_description = Channel.value(methodsDescriptionText(ch_multiqc_custom_methods_description))
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions)
ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml', sort: false))

MULTIQC (
ch_multiqc_files.collect(),
ch_multiqc_config.toList(),
ch_multiqc_custom_config.toList(),
ch_multiqc_logo.toList()
)
multiqc_report = MULTIQC.out.report.toList()

emit:
simulated_reads = ch_simulated_reads
samplesheet = ch_final_samplesheet
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMPLETION EMAIL AND SUMMARY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

workflow.onComplete {
if (params.email || params.email_on_fail) {
NfcoreTemplate.email(workflow, params, summary_params, projectDir, log, multiqc_report)
}
NfcoreTemplate.dump_parameters(workflow, params)
NfcoreTemplate.summary(workflow, params, log)
if (params.hook_url) {
NfcoreTemplate.IM_notification(workflow, params, summary_params, projectDir, log)
}
}

workflow.onError {
if (workflow.errorReport.contains("Process requirement exceeds available memory")) {
println("🛑 Default resources exceed availability 🛑 ")
println("💡 See here on how to configure pipeline: https://nf-co.re/docs/usage/configuration#tuning-workflow-resources 💡")
}
multiqc_report = MULTIQC.out.report.toList() // channel: /path/to/multiqc_report.html
versions = ch_versions // channel: [ path(versions.yml) ]
}

/*
Expand Down

0 comments on commit b57d2fa

Please sign in to comment.