Skip to content

Updating fms#16

Closed
nbedanova wants to merge 14 commits intomainfrom
Updating-FMS
Closed

Updating fms#16
nbedanova wants to merge 14 commits intomainfrom
Updating-FMS

Conversation

@nbedanova
Copy link
Contributor

Updating FMS-moving out of figure file and plotting functions

@nbedanova nbedanova requested a review from Copilot June 27, 2025 14:15
@nbedanova nbedanova closed this Jun 27, 2025
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 PR refactors the factor match score (FMS) functionality by extracting FMS calculations and plotting helpers from individual figure scripts into common modules, while also updating dataset import routines and dependencies.

  • Updated Python requirement and bumped core dependencies in pyproject.toml.
  • Reorganized pf2rnaseq/imports.py and added a new prepare_dataset_deviance function.
  • Moved FMS logic into factorization.py and added generic FMS plotting in commonFuncs/plotGeneral.py; cleaned up figure scripts.

Reviewed Changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyproject.toml Bumped Python version and upgraded dependency versions
pf2rnaseq/imports.py Cleaned imports; added prepare_dataset_deviance; updated import functions
pf2rnaseq/gating.py Removed obsolete gating definitions
pf2rnaseq/figures/figureHeiserR2XDev.py New deviance-based R2X figure
pf2rnaseq/figures/figureHeiserR2X.py Adjusted rank ranges and removed unused code
pf2rnaseq/figures/figureHeiserGenesDev.py New deviance-driven gene factors figure
pf2rnaseq/figures/figureHeiserGenes.py Switched to precomputed factor file for gene plotting
pf2rnaseq/figures/figureHeiserGenePac.py Added gene PaCMAP figure
pf2rnaseq/figures/figureHeiserFactors.py Added consolidated factors plotting from stored file
pf2rnaseq/figures/figureHeiserFMSDev.py Separated deviance FMS plots
pf2rnaseq/figures/figureHeiserFMS.py Refactored FMS plotting and removed inline utility functions
pf2rnaseq/figures/figureHeiserDevianceFactors.py Updated subplot sizing and deviance PF2 rank
pf2rnaseq/figures/figureHeiserCorrelation.py Minor import reorder
pf2rnaseq/figures/figureHeiserCorrFactors.py Added metadata extraction helpers for correlation factors
pf2rnaseq/figures/figureHeiserCondPac.py Updated condition PaCMAP source and label type
pf2rnaseq/figures/figureHeiserCompPac.py Updated dataset source and expanded component range
pf2rnaseq/figures/figureHeiserCellTypePer.py Streamlined imports
pf2rnaseq/figures/figureHeiserCellPac.py Streamlined imports
pf2rnaseq/figures/figureCytokine20.py Cleaned formatting in gene‐expression plotting
pf2rnaseq/figures/figureCITEseq4.py Removed obsolete CITEseq4 figure
pf2rnaseq/figures/figureCITEseq3.py Removed obsolete CITEseq3 figure
pf2rnaseq/figures/figureCITEseq2.py Removed obsolete CITEseq2 figure
pf2rnaseq/figures/figureAveGene.py Cleaned imports and formatting
pf2rnaseq/figures/commonFuncs/plotPaCMAP.py Added pre-check for missing gene and early exit
pf2rnaseq/figures/commonFuncs/plotGeneral.py Introduced generic FMS plot helpers
pf2rnaseq/factorization.py Extracted fms_percent_drop and fms_diff_ranks into standalone functions
Comments suppressed due to low confidence (2)

pf2rnaseq/imports.py:16

  • [nitpick] Parameter geneThreshold uses mixed casing. For consistency with Python conventions, use snake_case (e.g., gene_threshold).
def prepare_dataset_deviance(

pf2rnaseq/figures/figureHeiserCondPac.py:1

  • [nitpick] This bare string is not a proper module docstring. Wrap it in triple quotes ("""Plot condition pacmap""") so it’s recognized as documentation.
"Plot condition pacmap"

runs=3,
):
"""Plots FMS when using different Pf2 components"""
df = plot_fms_diff_ranks(X, ranksList, runs)
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

This function calls itself recursively, leading to infinite recursion. It should call the standalone helper (e.g., fms_diff_ranks) instead of plot_fms_diff_ranks.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
from pathlib import Path

Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

Duplicate import of Path from pathlib. Consider removing redundant imports to keep the module clean.

Suggested change
from pathlib import Path

Copilot uses AI. Check for mistakes.

ranks = list(range(1, 31))
ranks = list(range(10, 101, 10))
plot_r2x(X, ranks, ax[0])
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

Both R2X plots are drawn on the same axis ax[0]. Likely unintended overlap; consider using separate subplots or clearing the axis before the second plot.

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 4
"""
factorization score
factorization score
"""
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The docstring duplicates the description on two lines. Consider consolidating to one clear docstring line.

Suggested change
"""
factorization score
factorization score
"""
"""factorization score"""

Copilot uses AI. Check for mistakes.
@nbedanova nbedanova deleted the Updating-FMS branch June 27, 2025 21:14
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