-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/refactor DIMS PeakFinding #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mraves2
wants to merge
33
commits into
develop
Choose a base branch
from
feature/refactor_DIMS_PeakFinding
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
0f724c4
GenerateBreaks output split into 2 files
mraves2 de495e3
AverageTechReplicates replaced by EvaluateTics
mraves2 434a41f
refactored PeakFinding, peak finding funtions moved to folder preproc…
mraves2 9d7a69f
refactor DIMS PeakFinding, flow between scripts
mraves2 62fc225
added unit tests for DIMS peak finding
mraves2 5d311a3
changed variable name tmp to replicates_persample
mraves2 708b872
omitted obsolete lines
mraves2 0521390
added weighted mean for half-bad TICs
mraves2 15403cd
replaced AverageTechReplicates step by EvaluateTics
mraves2 6a7ada6
replaced AverageTechReplicates step by EvaluateTics
mraves2 6438e0e
removed breaks as input for PeakFinding
mraves2 1ef197d
changed PeakFinding to new two-step method
mraves2 9272ec3
functions for new two-step PeakFinding method
mraves2 e006160
unit tests for new two-step PeakFinding method
mraves2 8102bdb
information for averaging peaks for technical replicates based on txt…
mraves2 d0ed769
modified input for PeakGrouping corresponding to new PeakFinding method
mraves2 a35c4ca
collect averaged peaks per biological sample, corresponding to new Pe…
mraves2 d903e1b
DIMS CustomModules merge conflicts resolved
mraves2 295e460
fixed path to DIMS peak_finding_functions
mraves2 109d664
created function for averaging peaks in DIMS/AveragePeaks.R
mraves2 cb33aba
added unit tests for average_peaks_functions
mraves2 db8633e
moved parameters matrix and nr_replicates from workflow into params
mraves2 004e3e9
refactored DIMS/EvaluateTics
mraves2 06e5e1a
moved functions for DIMS/EvaluateTics to separate file
mraves2 3f24b6d
added unit tests for DIMS/EvaluateTics
mraves2 c2c65dd
modifications suggested in code review DIMS/PeakFinding
mraves2 15a25ba
removed two obsolete lines
mraves2 527acf6
resolved merge conflict in DIMS/EvaluateTics.R
mraves2 007bea4
moved parameter ppm_peak from DIMS/AveragePeaks.R to inside function
mraves2 e58640b
added parameter sample_name to DIMS/preprocessing/average_peaks_funct…
mraves2 f0763a0
modified DIMS/tests/testthat/test_average_peaks.R for extra variable …
mraves2 ac9f43f
added fixture files for unit test for DIMS/EvaluateTics
mraves2 083aeac
added unit test for empty peaklist
mraves2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) { | ||
mraves2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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")) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| """ | ||
| } |
This file was deleted.
Oops, something went wrong.
mraves2 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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")) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
mraves2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| } | ||
fdekievit marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| process EvaluateTics { | ||
| tag "DIMS EvaluateTics" | ||
| label 'EvaluateTics' | ||
| container = 'docker://umcugenbioinf/dims:1.3' | ||
| shell = ['/bin/bash', '-euo', 'pipefail'] | ||
|
|
||
| input: | ||
| path(rdata_file) | ||
| path(tic_txt_files) | ||
| path(init_file) | ||
| val(analysis_id) | ||
| path(highest_mz_file) | ||
| path(trim_params_file) | ||
|
|
||
| output: | ||
| path('*_repl_pattern.RData'), emit: pattern_files | ||
| path('replicates_per_sample.txt'), emit: sample_techreps | ||
| path('miss_infusions_negative.txt') | ||
| path('miss_infusions_positive.txt') | ||
| path('*_TICplots.pdf'), emit: tic_plots_pdf | ||
|
|
||
| script: | ||
| """ | ||
| Rscript ${baseDir}/CustomModules/DIMS/EvaluateTics.R $init_file \ | ||
| $params.nr_replicates \ | ||
| $analysis_id \ | ||
| $params.matrix \ | ||
| $highest_mz_file \ | ||
| $trim_params_file | ||
| """ | ||
| } | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mraves2 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.