Skip to content

NOT MERGE 478 qc plot on omega vs dndscv values comparison - #479

Open
FerriolCalvet wants to merge 23 commits into
devfrom
478-qc-plot-on-omega-vs-dndscv-values-comparison
Open

NOT MERGE 478 qc plot on omega vs dndscv values comparison#479
FerriolCalvet wants to merge 23 commits into
devfrom
478-qc-plot-on-omega-vs-dndscv-values-comparison

Conversation

@FerriolCalvet

Copy link
Copy Markdown
Member

No description provided.

@FerriolCalvet FerriolCalvet changed the title 478 qc plot on omega vs dndscv values comparison NOT MERGE 478 qc plot on omega vs dndscv values comparison Jul 2, 2026
@efigb efigb linked an issue Jul 2, 2026 that may be closed by this pull request
@efigb efigb self-assigned this Jul 2, 2026
@efigb efigb added the plot For plotting related issues label Jul 2, 2026
@efigb

efigb commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

@FerriolCalvet I fixed all errors, tests seeem to work fine 🥳

Should I add someone as reviewer before proceeding with the PR?

@efigb

efigb commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

new related tasks:

  • add comparison omega vs omegagglobal same way we did for omega vs dndscv
  • store omega_vs_omegaglobal and omega_vs_dndscv outputs in the same parent directory qc/omega_qc together with omega_flagged output

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the DeepCSA QC plotting workflow to add new omega comparison plots (omega vs dNdScv and omega vs omegaglobal) and wires dNdScv results into the plotting subworkflow, with corresponding output publishing updates.

Changes:

  • Plumb dNdScv combined results (all_dNdScv.cv.tsv) into PLOTTING_QC and add an omega-vs-dNdScv QC plotting step (conditional on params.dnds).
  • Add an omega-vs-omegaglobal QC plotting step and publish both new plot outputs under qc/omegaqc/....
  • Extend omega annotation QC outputs to emit a “flagged synonymous” debug TSV used for filtering/annotation in the new plots.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
workflows/deepcsa.nf Adds a dndscv_table channel and passes it into the QC plotting subworkflow when dNdScv runs.
subworkflows/local/plotting_qc/main.nf Adds module includes and wiring for omega-vs-dNdScv and omega-vs-omegaglobal QC plots.
modules/local/plot/qc/omega_vs_omegaglobal/main.nf New Nextflow process wrapper for running omega_vs_omegaglobal_qc.py.
modules/local/plot/qc/omega_vs_dndscv/main.nf New Nextflow process wrapper for running omega_vs_dndscv_qc.py.
modules/local/plot/qc/annotate_omega/main.nf Updates emitted debug outputs from omega QC annotation to expose flagged synonymous genes.
conf/results_outputs.config Publishes new QC plot outputs to dedicated qc/omegaqc/... directories; updates omega flagged publish path.
bin/plot_explore_variability.py Adds a comment (no functional change).
bin/omega_vs_omegaglobal_qc.py New plotting script for omega vs omegaglobal comparison and correlation plots.
bin/omega_vs_dndscv_qc.py New plotting script for omega vs dNdScv comparison and correlation plots.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread subworkflows/local/plotting_qc/main.nf Outdated
Comment thread modules/local/plot/qc/annotate_omega/main.nf

@m-huertasp m-huertasp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hola!!

I think it is a very nice job, Bet! I know it is fun when you start understanding a bit more how everything is connected.
I've added some comments, they have some questions in them just to understand what you want exactly. I've also tested the problem Copilot indicated and it is true. In fact, it might be the most important thing to tackle. But it should be quite simple.

If you need some help with something, tell me!

Comment thread bin/omega_vs_dndscv_qc.py Outdated
Comment on lines +129 to +130
sample_groups = flagged_genes_df['cohort'].unique().tolist()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I understand that the idea of this line is to get the name of the sample groups that you'll use later to generate the plot, right? Is the idea to plot only groups in which there is at least one flagged gene or you want to plot them all? Because by getting the groups from the flagged_genes_df you are getting only those with at least one flagged gene.

If you want to plot all, maybe you can get the groups from the omega_df or the dndscv_df??

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I understand that the idea of this line is to get the name of the sample groups that you'll use later to generate the plot, right?
yes!

Is the idea to plot only groups in which there is at least one flagged gene or you want to plot them all?
Clarification here: the ideas is to discard those genes that are flagged per group to only plot those not flagged

@m-huertasp m-huertasp Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see.. What I was trying to say is that with the current strategy, from what I understand, you are only going to plot sample_groups in which there's at least one flagged gene. Because you are getting the sample_groups from the flagged_genes_df.
Groups in which there's not a flagged gene are not going to appear in the plot.

Maybe it is clearer with an exampe, imagine you have this table:

group gene omega flagged
A TP53 2 No
B KRAS 1 Yes
B TERT 2.5 No

In this case, you would want to plot TP53 for group A and TERT for group B. But, you are using flagged_genes_df to extract the sample group names that you are going to plot, which includes only:

group gene omega flagged
B KRAS 1 Yes

Then, the only group that you are going to get is B. Therefore, you are going to plot only TERT for group B,

Is this clearer?

@efigb efigb Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Exactly, now I see your point, it's totally true that if any group is not flagged (like A in the example) with this strategy we will miss that group for plotting. Since we are doing the 'all_samples' comparison the gene comparison will be done for that gene, but you're right that we would miss the group comparison for that particular gene. The solution would be to extract the group information from a predefined variable for groups in deepCSA (not sure if it exists) or from the features table, but not sure which is the best way tbh...

Comment thread bin/omega_vs_dndscv_qc.py Outdated
Comment thread bin/plot_explore_variability.py Outdated
Comment thread subworkflows/local/plotting_qc/main.nf Outdated
efigb and others added 3 commits July 14, 2026 12:19
Make this plot conditional (similar to the dNdScv plot) and emit an empty channel when not applicable.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Removed legend from scatter plot for clarity
Comment thread subworkflows/local/plotting_qc/main.nf Outdated
Comment thread bin/omega_vs_dndscv_qc.py Outdated
Comment on lines +129 to +130
sample_groups = flagged_genes_df['cohort'].unique().tolist()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I understand that the idea of this line is to get the name of the sample groups that you'll use later to generate the plot, right?
yes!

Is the idea to plot only groups in which there is at least one flagged gene or you want to plot them all?
Clarification here: the ideas is to discard those genes that are flagged per group to only plot those not flagged

Comment thread bin/plot_explore_variability.py Outdated
@efigb
efigb marked this pull request as ready for review July 21, 2026 13:31
@efigb

efigb commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

@m-huertasp in principle it is ready to review but very few changes added, not sure if this copilot revision was applied

@m-huertasp

m-huertasp commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Hi! Nice to see that you could find some time to do this jeje @efigb

The copilot comment is not implemented. It is simple though! You just need to add the tsv to the stub block, which is almost at the end of the module main.nf file. We don't really make use of this, but the stub block is used to be able to do "dummy" runs to test the entire structure, channel logic, etc. without using any real data.

I've clarified a comment I did about the sample groups to be plot. Just to make sure.

added code to stub block to ensure non optional tsv files are generated in stub mode
@efigb

efigb commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Hi! Nice to see that you could find some time to do this jeje @efigb

The copilot comment is not implemented. It is simple though! You just need to add the tsv to the stub block, which is almost at the end of the module main.nf file. We don't really make use of this, but the stub block is used to be able to do "dummy" runs to test the entire structure, channel logic, etc. without using any real data.

I've clarified a comment I did about the sample groups to be plot. Just to make sure.

Thanks for the explanation! Now I've added the line in the stub block (just in case we run in stub mode at some point), hope it is now correct!

@FerriolCalvet

Copy link
Copy Markdown
Member Author

Hi! sorry for joining to this PR a bit late, I think all looks good, but the two python scripts are intended to do a very similar thing and some pieces of code are even the same (I think)
Do you think that we could combine them in order to simplify the overall code of the pipeline? I know that there are many things that could be done better also in other places, but now that we are adding this one maybe it makes sense to try to do it better.
let me know what you think!

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

Labels

plot For plotting related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QC plot on omega vs dndscv values comparison

4 participants