Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
725614c
Use datadir to discover testfiles
ellendejong Aug 21, 2024
b7e73dd
Resolve flake8 warnings and errors
ellendejong Aug 21, 2024
07bc221
add checkqc github action
ellendejong Sep 17, 2024
3a2ed71
change poetry venv, and use working directory
ellendejong Sep 18, 2024
b070824
add pyproject custommodules
ellendejong Sep 18, 2024
856b46e
run pytest in working dir
ellendejong Sep 20, 2024
52dc431
Restrict github action checkqc lint to changes in path
ellendejong Sep 20, 2024
64c1381
Add github workflow gendercheck test and lint
ellendejong Sep 20, 2024
6b836e8
add pyproject.toml and poetry.lock
ellendejong Sep 20, 2024
b412262
Add mosaichunter github actions workflow
ellendejong Sep 20, 2024
496bf9f
github workflows add on push
ellendejong Sep 27, 2024
4c678bb
Add poetry group dev dependencies and update conflicting package pluggy
ellendejong Sep 27, 2024
1705db1
add working dir ruff
ellendejong Sep 27, 2024
cef7272
fix incorrect type to array in filter paths
ellendejong Sep 27, 2024
5616285
add on push
ellendejong Sep 27, 2024
32b0a23
fix regex string
ellendejong Sep 27, 2024
27b9131
add pre-commit ruff
ellendejong Sep 27, 2024
6e4c3dc
Add authors
ellendejong Sep 27, 2024
940044c
filter paths on push
ellendejong Sep 30, 2024
da9f31d
move filter paths on push one row down.
ellendejong Sep 30, 2024
3005cb3
Use poetry in dockerfiles checkqc and gendercheck.
ellendejong Oct 11, 2024
f50de79
Remove requirements of MosaicHunter
ellendejong Oct 11, 2024
c5d878d
Update container version MosaicHunterGetGender.
ellendejong Oct 11, 2024
740e504
Use poetry to run pytest
ellendejong Oct 11, 2024
95b42b3
Remove setuptools.
ellendejong Oct 11, 2024
e455dc1
Merge remote-tracking branch 'origin/develop' into feature/add_github…
ellendejong Oct 23, 2024
d1206fb
Revert: checkqc settings yaml should not be stored in github
ellendejong Oct 23, 2024
1c25a90
Remove pytest-reqs.
ellendejong Oct 23, 2024
730a6eb
fix checkqc test by creating a valid qc metric (all required columns)
ellendejong Oct 23, 2024
efabe04
Merge remote-tracking branch 'origin/develop' into feature/add_github…
ellendejong Oct 23, 2024
b6dbcbf
Merge branch 'feature/add_github_actions_per_tool' into feature/use_p…
ellendejong Oct 23, 2024
59e1f59
move defaults outside jobs gendercheck_test
ellendejong Nov 4, 2024
0740cea
add working-directory to each step that includes a 'with'.
ellendejong Nov 4, 2024
1920f36
Add working directory as environment var and use to load cache.
ellendejong Nov 4, 2024
62db182
Merge branch 'feature/add_github_actions_per_tool' into feature/use_p…
ellendejong Nov 4, 2024
72f9854
replace source and pytest with poetry run
ellendejong Nov 11, 2024
e23aa0d
Merge pull request #49 from UMCUGenetics/feature/use_poetry_and_remov…
ellendejong Nov 11, 2024
8a4ab65
Merge remote-tracking branch 'origin/develop' into feature/add_github…
ellendejong Nov 18, 2024
0f724c4
GenerateBreaks output split into 2 files
mraves2 Jan 31, 2025
de495e3
AverageTechReplicates replaced by EvaluateTics
mraves2 Feb 3, 2025
434a41f
refactored PeakFinding, peak finding funtions moved to folder preproc…
mraves2 Feb 3, 2025
9d7a69f
refactor DIMS PeakFinding, flow between scripts
mraves2 Feb 10, 2025
62fc225
added unit tests for DIMS peak finding
mraves2 Feb 11, 2025
5d311a3
changed variable name tmp to replicates_persample
mraves2 Jul 8, 2025
708b872
omitted obsolete lines
mraves2 Jul 8, 2025
0521390
added weighted mean for half-bad TICs
mraves2 Jul 8, 2025
15403cd
replaced AverageTechReplicates step by EvaluateTics
mraves2 Jul 8, 2025
6a7ada6
replaced AverageTechReplicates step by EvaluateTics
mraves2 Jul 8, 2025
6438e0e
removed breaks as input for PeakFinding
mraves2 Jul 8, 2025
1ef197d
changed PeakFinding to new two-step method
mraves2 Jul 8, 2025
9272ec3
functions for new two-step PeakFinding method
mraves2 Jul 8, 2025
e006160
unit tests for new two-step PeakFinding method
mraves2 Jul 8, 2025
8102bdb
information for averaging peaks for technical replicates based on txt…
mraves2 Jul 8, 2025
d0ed769
modified input for PeakGrouping corresponding to new PeakFinding method
mraves2 Jul 8, 2025
a35c4ca
collect averaged peaks per biological sample, corresponding to new Pe…
mraves2 Jul 8, 2025
d903e1b
DIMS CustomModules merge conflicts resolved
mraves2 Jul 15, 2025
295e460
fixed path to DIMS peak_finding_functions
mraves2 Jul 15, 2025
6f8fc0c
refactored HMDBparts, segmentation by mz rather than by nr of lines
mraves2 Jul 15, 2025
da00467
obsolete parameter ppm removed
mraves2 Jul 15, 2025
e8d0a7f
Refactored code GenerateViolinPlots
ALuesink Aug 7, 2025
51de409
Merge pull request #79 from UMCUGenetics/hotfix/FranklinWES
rernst Aug 12, 2025
9ffd606
Fixed errors
ALuesink Aug 15, 2025
aede6ee
Fixed linting
ALuesink Aug 21, 2025
8094aed
Added new package for unit testing
ALuesink Aug 21, 2025
62160b2
Added unit tests and associated files for GenerateViolinPlots
ALuesink Aug 21, 2025
cf9f349
Fixed snapshot issues GenerateViolinPlots
ALuesink Aug 21, 2025
bd128dd
Changes to snapshots
ALuesink Aug 21, 2025
624d64a
Fixed snapshot issues, second try
ALuesink Aug 21, 2025
9a56d10
Fixing snapshot issue, third try
ALuesink Aug 21, 2025
936f292
Fixed snapshot issue, fourth try
ALuesink Aug 21, 2025
60a1099
Merge pull request #83 from UMCUGenetics/release/v2.6.0_DIMS
ALuesink Aug 22, 2025
a02016a
Merge branch 'develop' into feature/DIMS_refactor_GenerateViolinPlots
ALuesink Sep 5, 2025
926ad6d
Fixed issue if P1001 is present but no Z-scores
ALuesink Sep 8, 2025
b1a3858
print statement for testing
ALuesink Sep 8, 2025
ba47db5
Removed duplicated line & print statement
ALuesink Sep 11, 2025
57bf912
Merge pull request #85 from UMCUGenetics/hotfix/v2.6.1_DIMS
mraves2 Sep 19, 2025
4079ecc
Merge branch 'origin/develop' into feature/DIMS_refactor_GenerateViol…
ALuesink Sep 22, 2025
c1e79a5
rewritten selection of segment size for HMDB parts
mraves2 Sep 30, 2025
109d664
created function for averaging peaks in DIMS/AveragePeaks.R
mraves2 Oct 2, 2025
cb33aba
added unit tests for average_peaks_functions
mraves2 Oct 2, 2025
db8633e
moved parameters matrix and nr_replicates from workflow into params
mraves2 Oct 3, 2025
004e3e9
refactored DIMS/EvaluateTics
mraves2 Oct 3, 2025
06e5e1a
moved functions for DIMS/EvaluateTics to separate file
mraves2 Oct 3, 2025
3f24b6d
added unit tests for DIMS/EvaluateTics
mraves2 Oct 3, 2025
c2c65dd
modifications suggested in code review DIMS/PeakFinding
mraves2 Oct 3, 2025
000b178
added extra output on QC of SST sample to DIMS/GenerateQCOutput
mraves2 Oct 3, 2025
a61ac60
Merge pull request #87 from UMCUGenetics/feature/hotfix_DIMS_3.3.1
mraves2 Oct 13, 2025
15a25ba
removed two obsolete lines
mraves2 Oct 16, 2025
527acf6
resolved merge conflict in DIMS/EvaluateTics.R
mraves2 Oct 16, 2025
007bea4
moved parameter ppm_peak from DIMS/AveragePeaks.R to inside function
mraves2 Oct 16, 2025
e58640b
added parameter sample_name to DIMS/preprocessing/average_peaks_funct…
mraves2 Oct 16, 2025
f0763a0
modified DIMS/tests/testthat/test_average_peaks.R for extra variable …
mraves2 Oct 16, 2025
ac9f43f
added fixture files for unit test for DIMS/EvaluateTics
mraves2 Oct 17, 2025
7439b26
Merge remote-tracking branch 'origin/develop' into feature/DIMS_refac…
ALuesink Oct 27, 2025
3875aaf
Fix for error dIEM plots
ALuesink Oct 28, 2025
a4eaf1e
Merge remote-tracking branch 'origin/develop' into feature/add_github…
ellendejong Nov 17, 2025
3047676
Merge pull request #45 from UMCUGenetics/feature/add_github_actions_p…
ellendejong Nov 17, 2025
c1dcfe0
fix indentation env (line 13)
ellendejong Nov 24, 2025
a035f9b
Merge pull request #89 from UMCUGenetics/fix/github_actions_yaml_syntax
ellendejong Nov 24, 2025
c7edbb5
Removed unnecessary params
ALuesink Dec 4, 2025
f5210be
Removed unnecessary params, added comments and changed variable names
ALuesink Dec 4, 2025
204351e
Removed old, unused code
ALuesink Dec 4, 2025
4b395e1
old FillMissing functions replaced by new ones in preprocessing folder
mraves2 Dec 9, 2025
1f77b21
removed identification of noise peaks
mraves2 Dec 9, 2025
d0aff6c
added as.data.frame to avoid error of non-numeric argument
mraves2 Dec 9, 2025
519c5b7
linting modifications
mraves2 Dec 9, 2025
4bbccd8
added unit test for FillMissing
mraves2 Dec 9, 2025
6000929
Merge remote-tracking branch 'origin/develop' into feature/DIMS_QCinf…
mraves2 Dec 15, 2025
17b6d50
added output for QC on internal standards to include in mail
mraves2 Dec 15, 2025
195ed54
Removed SST mix and pos controls from plots
ALuesink Dec 15, 2025
aae998e
Styler and lintr changes
ALuesink Dec 15, 2025
cab9ce7
Added pipe_consistency_linter to default
ALuesink Dec 15, 2025
9588296
Lintr changes
ALuesink Dec 15, 2025
aa56eb2
Create separate plot for Helix Exel, moved code to functions and did …
ALuesink Dec 16, 2025
9e638ae
Added new functions and did styler and linter
ALuesink Dec 16, 2025
08dbf31
Added new unit tests and did styler and linter
ALuesink Dec 16, 2025
97ec94d
Added vdiffr to DIMS test dependencies
ALuesink Dec 16, 2025
1fc1d3a
Fix error numeric values
ALuesink Dec 16, 2025
bb007f0
Snapshot boxplot
ALuesink Dec 16, 2025
083aeac
added unit test for empty peaklist
mraves2 Dec 22, 2025
7ea64f0
removed unused variables
mraves2 Dec 22, 2025
14ce7e6
Merge branch 'feature/refactor_DIMS_FilMissing' of github.com:UMCUGen…
mraves2 Dec 22, 2025
c386ea3
moved CollectFilled functions to preprocessing folder
mraves2 Dec 22, 2025
1ff7e0e
refactored collect_filled_functions
mraves2 Dec 22, 2025
e813fe7
extra output peak list per technical replicate
mraves2 Jan 6, 2026
af62a0e
modified DIMS AverageTechReplicates for QC info in mail
mraves2 Jan 9, 2026
7c349ce
modified DIMS GenerateQCOutput for QC info in mail
mraves2 Jan 9, 2026
76baae9
moved generation of list of internal standards below threshold to fun…
mraves2 Jan 22, 2026
22140fb
added unit test for function find_is_below_threshold
mraves2 Jan 22, 2026
4501fd9
removed erroneous space
mraves2 Jan 23, 2026
5f32d2f
corrected typo
mraves2 Jan 23, 2026
534002e
added library data.table
mraves2 Jan 23, 2026
7c0d056
replaced library data.table with reshape2
mraves2 Jan 23, 2026
59423bd
Rename variables, move duplicate code to function + unit test
ALuesink Jan 23, 2026
84f317d
Changed function name
ALuesink Jan 23, 2026
d4bc6e1
Changed variable name
ALuesink Jan 23, 2026
276bd0e
refactored DIMS/HMDBparts_main
mraves2 Feb 10, 2026
cbbf429
added unit tests for CollectFilled
mraves2 Feb 13, 2026
22d8347
added test_peakgroup_list.txt to fixtures folder for unit tests
mraves2 Feb 13, 2026
367a5e5
refactored CollectFilled, code moved to functions
mraves2 Feb 13, 2026
408d33f
Merge pull request #76 from UMCUGenetics/feature/refactor_DIMS_PeakFi…
mraves2 Feb 16, 2026
50c205c
Merge pull request #77 from UMCUGenetics/feature/DIMS_HMDBparts_bymz
mraves2 Feb 16, 2026
502ca93
Merge pull request #91 from UMCUGenetics/feature/refactor_DIMS_FilMis…
mraves2 Feb 16, 2026
af4b576
Merge pull request #92 from UMCUGenetics/feature/DIMS_Excel_plots
mraves2 Feb 16, 2026
dc8250b
changes based on code review comments
mraves2 Feb 17, 2026
9235065
replaced parameter not_random with disable_randomness
mraves2 Feb 17, 2026
a90441d
removed AverageTechReplicates.nf
mraves2 Feb 20, 2026
1bcedbd
Merge pull request #93 from UMCUGenetics/feature/DIMS_QCinfo_in_mail
mraves2 Feb 20, 2026
ebdff9e
added source functions for EvaluateTics
mraves2 Feb 20, 2026
0a80791
removed obsolete parameter from calculate_zscores function
mraves2 Feb 23, 2026
d197b03
fixed error in arrange by converting table to data frame
mraves2 Feb 23, 2026
6c549a7
removed obsolete step SpectrumPeakFinding
mraves2 Feb 23, 2026
572f771
Merge pull request #99 from UMCUGenetics/feature/fix_DIMS_peak_findin…
mraves2 Feb 23, 2026
01d76f9
Refactor functions
ALuesink Feb 26, 2026
0660b1e
Moved variables to list
ALuesink Feb 26, 2026
062698c
Added new unit tests
ALuesink Feb 26, 2026
19ed907
Changed and added new test dataframes
ALuesink Feb 26, 2026
fb40e09
Changed and added new test files
ALuesink Feb 26, 2026
9edc7d3
Merge branch 'develop' into feature/DIMS_refactor_GenerateViolinPlots
ALuesink Feb 26, 2026
56c467d
Fixed issues occuring during testing
ALuesink Feb 26, 2026
0d8a5ef
Fixed missing comma
ALuesink Feb 26, 2026
df0edf3
Fixed missing variable and testing issues
ALuesink Feb 26, 2026
0a1eb5c
Fixed unit test issues
ALuesink Feb 26, 2026
34b26f7
Test files and snapshots
ALuesink Feb 26, 2026
b56fdfc
Styling and linting
ALuesink Mar 2, 2026
78285ff
Add theormz_HMDB to columns to remove
ALuesink Mar 2, 2026
a02deba
Revert "Add theormz_HMDB to columns to remove"
ALuesink Mar 2, 2026
eb62557
Changed get_colnames_samples to 2 functions and fixed unit tests
ALuesink Mar 12, 2026
b355166
Fixed linting errors
ALuesink Mar 12, 2026
f4b9e07
Merge pull request #82 from UMCUGenetics/feature/DIMS_refactor_Genera…
ALuesink Mar 12, 2026
ac061ac
renamed function collapse in DIMS/preprocessing/collect_filled_functi…
mraves2 Mar 12, 2026
ad2232c
refactored function calculate_ppm_deviation in DIMS/preprocessing/col…
mraves2 Mar 12, 2026
20c6539
Code review suggestion applied in DIMS/CollectFilled
mraves2 Mar 12, 2026
11d49dc
fixed merge conflicts in DIMS/CollectFilled
mraves2 Mar 12, 2026
3cb60ad
fixed typo in DIMS/CollectFilled.R
mraves2 Mar 13, 2026
7180353
removed obsolete line from DIMS/preprocessing/collect_filled_functions.R
mraves2 Mar 13, 2026
4d2e6d4
changed function name for collapse in DIMS test_collect_filled.R
mraves2 Mar 13, 2026
fc5bfb4
New snapshot for unit testing
ALuesink Mar 13, 2026
b26a2eb
Merge pull request #97 from UMCUGenetics/feature/refactor_DIMS_Collec…
mraves2 Mar 13, 2026
6948bd1
removed adding scanmode column in DIMS/GenerateQCOutput.R
mraves2 Mar 13, 2026
31c640d
bug fixes for DIMS/GenerateQCOutput.R
mraves2 Mar 17, 2026
9b5070d
bug fixes for DIMS/GenerateViolinPlots.R
mraves2 Mar 17, 2026
a350fc6
bug fixes for DIMS/export/generate_violin_plots_functions.R
mraves2 Mar 17, 2026
160fd0a
fixed bugs in DIMS/GenerateQCOutput.R
mraves2 Mar 19, 2026
5dc850a
modified sst components output for empty table in DIMS/GenerateQCOutp…
mraves2 Mar 19, 2026
035b1b9
fixed double entries in case of two of the same pos ctrl in DIMS/Gene…
mraves2 Mar 19, 2026
888db03
Merge pull request #100 from UMCUGenetics/develop
mraves2 Mar 20, 2026
fa6b477
Merge pull request #96 from UMCUGenetics/feature/refactor_DIMS_HMDBpa…
mraves2 Mar 20, 2026
bb23bb5
Merge branch 'develop' into feature/refactor_DIMS_FilMissing
mraves2 Mar 20, 2026
de6cad9
Merge pull request #98 from UMCUGenetics/feature/refactor_DIMS_FilMis…
mraves2 Mar 20, 2026
b08f5e9
Merge pull request #102 from UMCUGenetics/develop
mraves2 Mar 20, 2026
4bcc8eb
Revert "fix indentation env (line 13)"
BasMonkey Mar 23, 2026
cd031cf
Merge pull request #103 from UMCUGenetics/revert-89-fix/github_action…
BasMonkey Mar 23, 2026
df25d5b
Revert "Feature/add GitHub actions per tool"
BasMonkey Mar 23, 2026
0a64ed5
Merge pull request #105 from UMCUGenetics/revert-45-feature/add_githu…
BasMonkey Mar 23, 2026
e1baa76
Merge pull request #106 from UMCUGenetics/develop
mraves2 Mar 23, 2026
6db86f5
fixed subset for internal standards in DIMS/GenerateQCOutput.R
mraves2 Mar 24, 2026
3d527af
removed print statement in DIMS/export/generate_violin_plots_functions.R
mraves2 Mar 24, 2026
5dae7d2
Merge pull request #107 from UMCUGenetics/feature/fixes_for_release_D…
mraves2 Mar 24, 2026
599dc86
refactored positive control section in DIMS/GenerateQCOutput.R
mraves2 Mar 24, 2026
0bcd4ca
Merge pull request #109 from UMCUGenetics/feature/fixes_for_release_D…
mraves2 Mar 26, 2026
94fc3fe
added fix for empty output in DIMS/preprocessing/evaluate_tics_functi…
mraves2 Mar 27, 2026
d811108
Merge pull request #110 from UMCUGenetics/feature/DIMS_improve_QC_mail
mraves2 Mar 27, 2026
f29294e
Merge pull request #111 from UMCUGenetics/develop
mraves2 Mar 27, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/dims_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v4

- name: Install dependencies
run: Rscript -e "install.packages(c('testthat', 'withr'))"
run: Rscript -e "install.packages(c('testthat', 'withr', 'vdiffr', 'pdftools'))"

- name: Run tests
run: Rscript tests/testthat.R
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
linters: linters_with_defaults(
line_length_linter(127),
object_usage_linter = NULL,
return_linter = NULL
return_linter = NULL,
pipe_consistency_linter = lintr::pipe_consistency_linter("auto")
)
encoding: "UTF-8"
6 changes: 4 additions & 2 deletions DIMS/AssignToBins.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ cmd_args <- commandArgs(trailingOnly = TRUE)

mzml_filepath <- cmd_args[1]
breaks_filepath <- cmd_args[2]
resol <- as.numeric(cmd_args[3])
trim_parameters_filepath <- cmd_args[3]
resol <- as.numeric(cmd_args[4])

# load breaks_file: contains breaks_fwhm, breaks_fwhm_avg,
# trim_left_neg, trim_left_pos, trim_right_neg & trim_right_pos
load(breaks_filepath)
# load trim parameters file: contains trim_left_neg, trim_left_pos, trim_right_neg & trim_right_pos
load(trim_parameters_filepath)

# get sample name
techrep_name <- sub("\\..*$", "", basename(mzml_filepath))
Expand Down
4 changes: 2 additions & 2 deletions DIMS/AssignToBins.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ process AssignToBins {
shell = ['/bin/bash', '-euo', 'pipefail']

input:
tuple(val(file_id), path(mzML_file), path(breaks_file))
tuple(val(file_id), path(mzML_file), path(breaks_file), path(trim_params_file))

output:
path("${file_id}.RData"), emit: rdata_file
path("${file_id}_TIC.txt"), emit: tic_txt_file

script:
"""
Rscript ${baseDir}/CustomModules/DIMS/AssignToBins.R $mzML_file $breaks_file $params.resolution
Rscript ${baseDir}/CustomModules/DIMS/AssignToBins.R $mzML_file $breaks_file $trim_params_file $params.resolution
"""
}

Expand Down
37 changes: 37 additions & 0 deletions DIMS/AveragePeaks.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
library(dplyr)

# define parameters
cmd_args <- commandArgs(trailingOnly = TRUE)

sample_name <- cmd_args[1]
techreps <- cmd_args[2]
scanmode <- cmd_args[3]
preprocessing_scripts_dir <- cmd_args[4]
tech_reps <- strsplit(techreps, ";")[[1]]

# load in function scripts
source(paste0(preprocessing_scripts_dir, "average_peaks_functions.R"))

# Initialize per sample
peaklist_allrepl <- NULL
nr_repl_persample <- 0
averaged_peaks <- matrix(0, nrow = 0, ncol = 6)
colnames(averaged_peaks) <- c("samplenr", "mzmed.pkt", "fq", "mzmin.pkt", "mzmax.pkt", "height.pkt")

# load RData files of technical replicates belonging to biological sample
for (file_nr in 1:length(tech_reps)) {
tech_repl_file <- paste0(tech_reps[file_nr], "_", scanmode, ".RData")
tech_repl <- get(load(tech_repl_file))
# combine data for all technical replicates
peaklist_allrepl <- rbind(peaklist_allrepl, tech_repl)
}
# sort on mass
peaklist_allrepl_df <- as.data.frame(peaklist_allrepl)
peaklist_allrepl_df$mzmed.pkt <- as.numeric(peaklist_allrepl_df$mzmed.pkt)
peaklist_allrepl_df$height.pkt <- as.numeric(peaklist_allrepl_df$height.pkt)
peaklist_allrepl_sorted <- peaklist_allrepl_df %>% arrange(mzmed.pkt)

# average over technical replicates
averaged_peaks <- average_peaks_per_sample(peaklist_allrepl_sorted, sample_name)
save(averaged_peaks, file = paste0("AvgPeaks_", sample_name, "_", scanmode, ".RData"))

18 changes: 18 additions & 0 deletions DIMS/AveragePeaks.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
process AveragePeaks {
tag "DIMS AveragePeaks"
label 'AveragePeaks'
container = 'docker://umcugenbioinf/dims:1.3'
shell = ['/bin/bash', '-euo', 'pipefail']

input:
path(rdata_files)
tuple val(sample_id), val(tech_reps), val(scanmode)

output:
path 'AvgPeaks_*.RData'

script:
"""
Rscript ${baseDir}/CustomModules/DIMS/AveragePeaks.R $sample_id $tech_reps $scanmode $params.preprocessing_scripts_dir
"""
}
36 changes: 0 additions & 36 deletions DIMS/AverageTechReplicates.nf

This file was deleted.

18 changes: 18 additions & 0 deletions DIMS/CollectAveraged.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# define parameters
cmd_args <- commandArgs(trailingOnly = TRUE)

scripts_dir <- cmd_args[1]

# for each scan mode, collect all averaged peak lists per biological sample
scanmodes <- c("positive", "negative")
for (scanmode in scanmodes) {
# get list of files
filled_files <- list.files("./", full.names = TRUE, pattern = paste0(scanmode, ".RData"))
# load files and combine into one object
outlist_total <- NULL
for (file_nr in 1:length(filled_files)) {
peaklist_averaged <- get(load(filled_files[file_nr]))
outlist_total <- rbind(outlist_total, peaklist_averaged)
}
save(outlist_total, file = paste0("AvgPeaks_", scanmode, ".RData"))
}
17 changes: 17 additions & 0 deletions DIMS/CollectAveraged.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
process CollectAveraged {
tag "DIMS CollectAveraged"
label 'CollectAveraged'
container = 'docker://umcugenbioinf/dims:1.3'
shell = ['/bin/bash', '-euo', 'pipefail']

input:
path(averaged_files)

output:
path('AvgPeaks*.RData'), emit: averaged_peaks

script:
"""
Rscript ${baseDir}/CustomModules/DIMS/CollectAveraged.R
"""
}
47 changes: 12 additions & 35 deletions DIMS/CollectFilled.R
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
## adapted from 10-collectSamplesFilled.R

# define parameters
cmd_args <- commandArgs(trailingOnly = TRUE)

scripts_dir <- cmd_args[1]
preprocessing_scripts_dir <- cmd_args[1]
ppm <- as.numeric(cmd_args[2])
z_score <- as.numeric(cmd_args[3])

source(paste0(scripts_dir, "merge_duplicate_rows.R"))
source(paste0(scripts_dir, "calculate_zscores.R"))
source(paste0(preprocessing_scripts_dir, "collect_filled_functions.R"))

# for each scan mode, collect all filled peak group lists
scanmodes <- c("positive", "negative")
Expand All @@ -17,7 +14,7 @@ for (scanmode in scanmodes) {
filled_files <- list.files("./", full.names = TRUE, pattern = paste0(scanmode, "_identified_filled"))
# load files and combine into one object
outlist_total <- NULL
for (file_nr in 1:length(filled_files)) {
for (file_nr in seq_along(filled_files)) {
peakgrouplist_filled <- get(load(filled_files[file_nr]))
outlist_total <- rbind(outlist_total, peakgrouplist_filled)
}
Expand All @@ -30,37 +27,17 @@ for (scanmode in scanmodes) {
repl_pattern <- get(load(pattern_file))
# calculate Z-scores
if (z_score == 1) {
outlist_stats <- calculate_zscores(outlist_total, adducts = FALSE)
nr_removed_samples <- length(which(repl_pattern[] == "character(0)"))
order_index_int <- order(colnames(outlist_stats)[8:(length(repl_pattern) - nr_removed_samples + 7)])
outlist_stats_more <- cbind(
outlist_stats[, 1:7],
outlist_stats[, (length(repl_pattern) - nr_removed_samples + 8):(length(repl_pattern) - nr_removed_samples + 8 + 6)],
outlist_stats[, 8:(length(repl_pattern) - nr_removed_samples + 7)][order_index_int],
outlist_stats[, (length(repl_pattern) - nr_removed_samples + 5 + 10):ncol(outlist_stats)]
)
# sort Z-score columns and append to peak group list
tmp_index <- grep("_Zscore", colnames(outlist_stats_more), fixed = TRUE)
tmp_index_order <- order(colnames(outlist_stats_more[, tmp_index]))
tmp <- outlist_stats_more[, tmp_index[tmp_index_order]]
outlist_stats_more <- outlist_stats_more[, -tmp_index]
outlist_stats_more <- cbind(outlist_stats_more, tmp)
outlist_total <- outlist_stats_more
outlist_stats <- calculate_zscores_peakgrouplist(outlist_total)
}

# make a copy of the outlist
outlist_ident <- outlist_total
# take care of NAs in theormz_noise
outlist_ident$theormz_noise[which(is.na(outlist_ident$theormz_noise))] <- 0
outlist_ident$theormz_noise <- as.numeric(outlist_ident$theormz_noise)
outlist_ident$theormz_noise[which(is.na(outlist_ident$theormz_noise))] <- 0
outlist_ident$theormz_noise <- as.numeric(outlist_ident$theormz_noise)
# calculate ppm deviation
outlist_withppm <- calculate_ppm_deviation(outlist_stats)
# put columns in correct order
outlist_ident <- order_columns_peakgrouplist(outlist_withppm)

# Extra output in Excel-readable format:
remove_columns <- c("fq.best", "fq.worst", "mzmin.pgrp", "mzmax.pgrp")
remove_colindex <- which(colnames(outlist_ident) %in% remove_columns)
outlist_ident <- outlist_ident[, -remove_colindex]
# generate output in Excel-readable format:
remove_columns <- c("mzmin.pgrp", "mzmax.pgrp")
outlist_ident <- outlist_ident[, -which(colnames(outlist_ident) %in% remove_columns)]
write.table(outlist_ident, file = paste0("outlist_identified_", scanmode, ".txt"), sep = "\t", row.names = FALSE)
# output in RData format
# export output in RData format
save(outlist_ident, file = paste0("outlist_identified_", scanmode, ".RData"))
}
2 changes: 1 addition & 1 deletion DIMS/CollectFilled.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ process CollectFilled {

script:
"""
Rscript ${baseDir}/CustomModules/DIMS/CollectFilled.R $params.scripts_dir $params.ppm $params.zscore
Rscript ${baseDir}/CustomModules/DIMS/CollectFilled.R $params.preprocessing_scripts_dir $params.ppm $params.zscore
"""
}
Loading
Loading