Skip to content

Commit

Permalink
Merge pull request #400 from TalusBio/fix/random-sample
Browse files Browse the repository at this point in the history
Make files selected with `random_preanalysis` reproducible.
  • Loading branch information
ypriverol authored Aug 10, 2024
2 parents de84abb + a69d08f commit 70bdb1e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#386](https://github.com/bigbio/quantms/pull/386) Make validation of ontology terms optional

### Fixed

- [#400](https://github.com/bigbio/quantms/pull/400) The random file selection when using `random_preanalysis` with DIANN is now reproducible.

### `Changed`

### `Fixed`
Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ params {
skip_preliminary_analysis = false
empirical_assembly_log = null
random_preanalysis = false
random_preanalysis_seed = 42
empirical_assembly_ms_n = 200


Expand Down
6 changes: 6 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,12 @@
"default": false,
"fa_icon": "far fa-check-square"
},
"random_preanalysis_seed": {
"type": "integer",
"description": "Set the random seed for the random selection of spectrum files to generate the empirical library.",
"default": 42,
"fa_icon": false
},
"empirical_assembly_ms_n": {
"type": "integer",
"description": "The number of randomly selected spectrum files.",
Expand Down
5 changes: 3 additions & 2 deletions workflows/dia.nf
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ workflow DIA {
// MODULE: DIANN_PRELIMINARY_ANALYSIS
//
if (params.random_preanalysis) {
preanalysis_seed = 2024
preanalysis_subset = ch_file_preparation_results
.randomSample(params.empirical_assembly_ms_n, preanalysis_seed)
.toSortedList()
.flatMap()
.randomSample(params.empirical_assembly_ms_n, params.random_preanalysis_seed)
empirical_lib_files = preanalysis_subset
.map { result -> result[1] }
.collect()
Expand Down

0 comments on commit 70bdb1e

Please sign in to comment.