Skip to content

Feature/DIMS refactor GenerateViolinPlots#82

Open
ALuesink wants to merge 34 commits intodevelopfrom
feature/DIMS_refactor_GenerateViolinPlots
Open

Feature/DIMS refactor GenerateViolinPlots#82
ALuesink wants to merge 34 commits intodevelopfrom
feature/DIMS_refactor_GenerateViolinPlots

Conversation

@ALuesink
Copy link
Contributor

@ALuesink ALuesink commented Aug 15, 2025

The refactor of GenerateViolinPlots:

  • code to functions
  • added unit tests

@ALuesink ALuesink marked this pull request as ready for review August 21, 2025 12:52
@ALuesink ALuesink changed the base branch from main to develop November 3, 2025 08:24
@rernst rernst self-requested a review November 18, 2025 14:54
Copy link
Member

@rernst rernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all lots of work done, good job! I feel like there is room for improvement, some general thoughts:

  1. Many parameters have names like metab_interest_sorted. In the context of a function, it’s not relevant whether the input is “of interest” or “sorted.” Use neutral, descriptive names that reflect the data type or role.

  2. Several functions are named after their use case rather than their functionality. name functions based on what they do, not where they are used.

  3. When breaking function calls across lines, maintain a consistent style. Preferred format:

Rfunction1(
   function_2(param_a),  
   param_b,  
   param_c,
)
  1. There is no error catching for missing files or invalid paths. Currently, the code will crash, making debugging difficult.

  2. There seems to be a lot of ad-hoc data transformations. It feels like the DIMS application is missing a standardized data format for saving and reusing data between steps.

@rernst rernst self-requested a review March 10, 2026 13:42
Copy link
Member

@rernst rernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome progress, just two comments. I did check only changed code compared to last review.

Secondly, we had discussion about docstrings in functions, looking at this code i personally realy prefer to have docstrings 'part' of the function not above...

And not for this PR, but you might want to take a look at https://covr.r-lib.org -> this can generate test coverage files which makes it easy to verify which code is tested. Personally I tent to focus on the 'regular' code and would just like to see test coverage.

sample_intersect <- intersect(paste0(intensity_cols, "_Zscore"), grep("_Zscore", colnames_zscore, value = TRUE))
return(sample_intersect)
#' @returns sample_colnames: a vector of column names all containing the prefix.
get_colnames_samples <- function(dataframe, sample_label) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to get_colnames_by_prefix, and sample_label => prefix.

Furthermore, this function now have sort of hidden functionally of also filtering '_Zscore' columns. I would suggests to or create a separate function to remove the suffix or change the name to reflect this behaviopur. I would prefer the first option.

For example:

sample_colnames = remove_suffix_from_items(get_colnames_by_prefix(df, 'P'), "_Zscore")

Comment on lines +192 to +195
list_of_dataframes <- lapply(txt_files_paths,
read.table,
sep = "\t", header = TRUE, quote = ""
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this fits one 1 row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants