Skip to content

Workflow clustering#59

Merged
KarinSchork merged 11 commits intomainfrom
workflow_clustering
Jan 21, 2026
Merged

Workflow clustering#59
KarinSchork merged 11 commits intomainfrom
workflow_clustering

Conversation

@KarinSchork
Copy link
Member

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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(), and Lineplots()
  • Updated documentation for better clarity and added the id parameter 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.


lineplots <- Lineplots(D_zscore = D_zscore, cluster_colours = clust$cluster_colours)

grDevices::pdf(paste0(output_path, "/Lineplots", suffix, "_", nr_clusters, ".pdf"),
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

row_gap = grid::unit(5, "mm"),
...)

grDevices::png(paste0(output_path, "/heatmap", suffix, "_", nr_clusters, ".png"),
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines 95 to 113
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"),
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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"),

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI commented Jan 21, 2026

@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.

KarinSchork and others added 8 commits January 21, 2026 14:35
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>
@KarinSchork KarinSchork merged commit 4f8f12a into main Jan 21, 2026
1 check passed
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