Conversation
There was a problem hiding this comment.
Pull request overview
This pull request introduces a new workflow for clustering proteins based on similar patterns across samples, producing heatmaps and line plots. The changes refactor the existing clustering functionality into modular, reusable components and provide a high-level workflow function for users.
Changes:
- Added new
workflow_clustering()function that provides a complete workflow for protein clustering analysis - Refactored the monolithic
Clustering_heatmap_lineplots()function into three separate, modular functions:clustering(),getClusterInfos(), andLineplots() - Updated documentation for better clarity and added the
idparameter to PCA-related functions
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| R/WIP_workflow_clustering_heatmap.R | New workflow function that orchestrates the clustering analysis |
| R/WIP_Clustering_Heatmap_Lineplots.R | Refactored clustering logic into modular functions |
| man/workflow_clustering.Rd | Documentation for the new workflow function |
| man/clustering.Rd | Documentation for the clustering function |
| man/getClusterInfos.Rd | Documentation for cluster information extraction |
| man/Lineplots.Rd | Documentation for lineplot generation |
| man/Clustering_heatmap_lineplots.Rd | Removed documentation for deprecated function |
| man/workflow_ttest.Rd | Improved suffix parameter description |
| R/workflow_ttest.R | Improved suffix parameter description |
| man/filter_PCA_data.Rd | Added new id parameter documentation |
| man/PCA_Plot.Rd | Added new id parameter documentation |
| NAMESPACE | Updated exports to reflect new and removed functions |
| DESCRIPTION | Version bump from 0.1.1 to 0.2.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
R/WIP_workflow_clustering_heatmap.R
Outdated
|
|
||
| lineplots <- Lineplots(D_zscore = D_zscore, cluster_colours = clust$cluster_colours) | ||
|
|
||
| grDevices::pdf(paste0(output_path, "/Lineplots", suffix, "_", nr_clusters, ".pdf"), |
There was a problem hiding this comment.
Inconsistent variable usage. The variable 'nr_clusters' is used here, but it may still be NULL at this point. You should use 'clust$nr_clusters' instead to ensure the correct value is used in the filename.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
R/WIP_workflow_clustering_heatmap.R
Outdated
| row_gap = grid::unit(5, "mm"), | ||
| ...) | ||
|
|
||
| grDevices::png(paste0(output_path, "/heatmap", suffix, "_", nr_clusters, ".png"), |
There was a problem hiding this comment.
Inconsistent variable usage. The variable 'nr_clusters' is used here, but it may still be NULL at this point. You should use 'clust$nr_clusters' instead to ensure the correct value is used in the filename.
R/WIP_workflow_clustering_heatmap.R
Outdated
| row_split = nr_clusters, | ||
| row_gap = grid::unit(5, "mm"), | ||
| ...) | ||
|
|
||
| grDevices::png(paste0(output_path, "/heatmap", suffix, "_", nr_clusters, ".png"), | ||
| height = plot_height_heatmap, | ||
| width = plot_width_heatmap, units = "cm", res = plot_dpi) | ||
| graphics::plot(ht) | ||
| grDevices::dev.off() | ||
|
|
||
|
|
||
| clusterInfo <- getClusterInfos(heatmap = ht, nr_clusters = nr_clusters, D = dataPrep$D, id = dataPrep$id) | ||
| openxlsx::write.xlsx(clusterInfo, paste0(output_path, "/cluster_table", suffix, "_", nr_clusters, ".xlsx")) | ||
|
|
||
| D_zscore <- cbind(ht@matrix, cluster = clusterInfo$cluster) | ||
|
|
||
| lineplots <- Lineplots(D_zscore = D_zscore, cluster_colours = clust$cluster_colours) | ||
|
|
||
| grDevices::pdf(paste0(output_path, "/Lineplots", suffix, "_", nr_clusters, ".pdf"), |
There was a problem hiding this comment.
Inconsistent variable usage. The variable 'nr_clusters' is used here, but it may still be NULL at this point. You should use 'clust$nr_clusters' instead to ensure the correct value is used in the filename.
| row_split = nr_clusters, | |
| row_gap = grid::unit(5, "mm"), | |
| ...) | |
| grDevices::png(paste0(output_path, "/heatmap", suffix, "_", nr_clusters, ".png"), | |
| height = plot_height_heatmap, | |
| width = plot_width_heatmap, units = "cm", res = plot_dpi) | |
| graphics::plot(ht) | |
| grDevices::dev.off() | |
| clusterInfo <- getClusterInfos(heatmap = ht, nr_clusters = nr_clusters, D = dataPrep$D, id = dataPrep$id) | |
| openxlsx::write.xlsx(clusterInfo, paste0(output_path, "/cluster_table", suffix, "_", nr_clusters, ".xlsx")) | |
| D_zscore <- cbind(ht@matrix, cluster = clusterInfo$cluster) | |
| lineplots <- Lineplots(D_zscore = D_zscore, cluster_colours = clust$cluster_colours) | |
| grDevices::pdf(paste0(output_path, "/Lineplots", suffix, "_", nr_clusters, ".pdf"), | |
| row_split = clust$nr_clusters, | |
| row_gap = grid::unit(5, "mm"), | |
| ...) | |
| grDevices::png(paste0(output_path, "/heatmap", suffix, "_", clust$nr_clusters, ".png"), | |
| height = plot_height_heatmap, | |
| width = plot_width_heatmap, units = "cm", res = plot_dpi) | |
| graphics::plot(ht) | |
| grDevices::dev.off() | |
| clusterInfo <- getClusterInfos(heatmap = ht, nr_clusters = clust$nr_clusters, D = dataPrep$D, id = dataPrep$id) | |
| openxlsx::write.xlsx(clusterInfo, paste0(output_path, "/cluster_table", suffix, "_", clust$nr_clusters, ".xlsx")) | |
| D_zscore <- cbind(ht@matrix, cluster = clusterInfo$cluster) | |
| lineplots <- Lineplots(D_zscore = D_zscore, cluster_colours = clust$cluster_colours) | |
| grDevices::pdf(paste0(output_path, "/Lineplots", suffix, "_", clust$nr_clusters, ".pdf"), |
|
@KarinSchork I've opened a new pull request, #60, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.