Skip to content

Commit 9c70ce0

Browse files
committed
Sort the contrasts table
1 parent 077a129 commit 9c70ce0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

assets/differentialabundance_report.qmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ datatable(
463463
contrasts_to_print,
464464
caption = "Table of contrasts",
465465
rownames = FALSE,
466-
options = list(dom = ifelse(nrow(contrasts_to_print) > 10, 'tp', 't'))
466+
options = list(
467+
dom = ifelse(nrow(contrasts_to_print) > 10, 'tp', 't'),
468+
ordering = FALSE
469+
)
467470
)
468471
```
469472

workflows/differentialabundance.nf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ workflow DIFFERENTIALABUNDANCE {
720720
ch_contrasts_sorted = differential_with_contrast.contrast_maps
721721
.collectFile { meta, contrast_map ->
722722
def header = contrast_map[0].keySet().join(',')
723-
def content = contrast_map.collect { it.values().join(',') }
723+
def content = contrast_map.collect { it.values().join(',') }.sort().reverse()
724724
def lines = header + '\n' + content.join('\n') + '\n'
725725
["${meta.paramset_name}.csv", lines]
726726
}
@@ -816,10 +816,12 @@ workflow DIFFERENTIALABUNDANCE {
816816
[meta, report_file]
817817

818818
report_params:
819-
def paramset = [paramset_name: meta.paramset_name] + meta.params.subMap('exploratory_assay_names') // flat the map
819+
def paramset = [paramset_name: meta.paramset_name] + meta.params.subMap('exploratory_assay_names') // flatten the map
820820
def report_file_names = ['logo','css','citations','versions_file','observations','features'] +
821821
paramset.exploratory_assay_names.split(',').collect { "${it}_matrix".toString() } +
822822
[ 'contrasts_file' ]
823+
// Create a map from expected report file names to actual file names.
824+
// This is used to parameterize the report generation, ensuring each logical input (e.g. 'logo', 'css', assay matrices) is mapped to its corresponding file.
823825
[report_file_names, files.collect{ f -> f.name}].transpose().collectEntries()
824826

825827
input_files:

0 commit comments

Comments
 (0)