Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
lint:
actions_ci: false
multiqc_config: false
files_unchanged:
- .github/CONTRIBUTING.md
files_exist:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Initial release of nf-core/seqinspector, created with the [nf-core](https://nf-c
- [#96](https://github.com/nf-core/seqinspector/pull/96) Added missing citations to citation tool
- [#103](https://github.com/nf-core/seqinspector/pull/103) Configure full-tests
- [#110](https://github.com/nf-core/seqinspector/pull/110) Update input schema to accept either tar file or directory as rundir, and fastq messages and patterns.
- [#135](https://github.com/nf-core/seqinspector/pull/135) Added index section to MultiQC reports to facilitate report navigation (#125)

### `Fixed`

Expand Down
4 changes: 3 additions & 1 deletion assets/multiqc_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ report_comment: >
analysis pipeline. For information about how to interpret these results, please see the
<a href="https://nf-co.re/seqinspector/dev/docs/output" target="_blank">documentation</a>.
report_section_order:
"nf-core-seqinspector-index":
order: -999
"nf-core-seqinspector-methods-description":
order: -1000
software_versions:
multiqc_software_versions:
order: -1001
"nf-core-seqinspector-summary":
order: -1002
Expand Down
31 changes: 31 additions & 0 deletions subworkflows/local/utils_nfcore_seqinspector_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,34 @@ def methodsDescriptionText(mqc_methods_yaml) {
return description_html.toString()
}

//
// Generate report index for MultiQC
//
def reportIndexMultiqc(tags, global=true) {
def relative_path = global ? ".." : "../.."

def a_attrs = "target=\"_blank\" class=\"list-group-item list-group-item-action\""

// Global report path
def index_section = " <a href=\"${relative_path}/global_report/multiqc_report.html\" ${a_attrs}>Global report</a>\n"

// Group report paths
tags
.each { tag ->
index_section += " <a href=\"${relative_path}/group_reports/${tag}/multiqc_report.html\" ${a_attrs}>Group report: ${tag}</a>\n"
}

def yaml_file_text = "id: '${workflow.manifest.name.replace('/', '-')}-index'\n" as String
yaml_file_text += "description: 'MultiQC reports collected from running the pipeline.'\n"
yaml_file_text += "section_name: '${workflow.manifest.name} MultiQC Reports Index'\n"
yaml_file_text += "section_href: 'https://github.com/${workflow.manifest.name}'\n"
yaml_file_text += "plot_type: 'html'\n"
yaml_file_text += "data: |\n"
yaml_file_text += " <h4>Reports</h4>\n"
yaml_file_text += " <p>Select a report to view (open in a new tab):</p>\n"
yaml_file_text += " <div class=\"list-group\">\n"
yaml_file_text += "${index_section}"
yaml_file_text += " </div>\n"

return yaml_file_text
}
35 changes: 29 additions & 6 deletions workflows/seqinspector.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include { paramsSummaryMap } from 'plugin/nf-schema'
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_seqinspector_pipeline'
include { reportIndexMultiqc } from '../subworkflows/local/utils_nfcore_seqinspector_pipeline'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -148,6 +149,11 @@ workflow SEQINSPECTOR {
//
// MODULE: MultiQC
//
ch_tags = ch_multiqc_files
.map { meta, _sample -> meta.tags }
.flatten()
.unique()

ch_multiqc_config = params.multiqc_config ?
Channel.fromPath(params.multiqc_config, checkIfExists: true) :
Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
Expand All @@ -174,11 +180,22 @@ workflow SEQINSPECTOR {
sort: true
)
)
// Add index to other MultiQC reports
//ch_multiqc_extra_files_global = Channel.empty()
ch_multiqc_extra_files_global = ch_multiqc_extra_files.mix(
ch_tags.toList()
.map { tag_list ->
reportIndexMultiqc(tag_list)
}
.collectFile(
name: 'multiqc_index_mqc.yaml',
)
)

MULTIQC_GLOBAL (
ch_multiqc_files
.map { meta, file -> file }
.mix(ch_multiqc_extra_files)
.mix(ch_multiqc_extra_files_global)
.collect(),
ch_multiqc_config.toList(),
[],
Expand All @@ -187,13 +204,18 @@ workflow SEQINSPECTOR {
[]
)

ch_tags = ch_multiqc_files
.map { meta, _sample -> meta.tags }
.flatten()
.unique()
ch_multiqc_extra_files_tag = ch_multiqc_extra_files.mix(
ch_tags.toList()
.map { tag_list ->
reportIndexMultiqc(tag_list, false)
}
.collectFile(
name: 'multiqc_index_mqc.yaml',
)
)

multiqc_extra_files_per_tag = ch_tags
.combine(ch_multiqc_extra_files)
.combine(ch_multiqc_extra_files_tag)

// Group samples by tag
tagged_mqc_files = ch_tags
Expand Down Expand Up @@ -222,6 +244,7 @@ workflow SEQINSPECTOR {
config: config
}


MULTIQC_PER_TAG(
tagged_mqc_files.samples_per_tag,
ch_multiqc_config.toList(),
Expand Down