Skip to content

merge dev/deepcsa-integration into main#13

Open
rblancomi wants to merge 10 commits into
mainfrom
dev/deepcsa-integration
Open

merge dev/deepcsa-integration into main#13
rblancomi wants to merge 10 commits into
mainfrom
dev/deepcsa-integration

Conversation

@rblancomi
Copy link
Copy Markdown
Collaborator

Pull request to merge dev/deepcsa-integration into main with the following main changes:

  • Fix multivariate models run when no variables remaining. This should avoid a downstrem error in the plotting module when the number of variables cannot be used to decide plot height (@rochamorro1 could you check if this works? This should avoid the error you were getting when height = 0 in the plot module. Thanks!)
  • Add bypassing of Singular Matrix errors for LMEM
  • Fix bug when omega reader defines the elements
  • Fix bug when there are no variables for which to force a 0 intercept
  • Funcionality tested in https://github.com/bbglab/deepCSA

Copy link
Copy Markdown

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 merges the dev/deepcsa-integration branch into main, focusing on making the regression + plotting pipeline more robust to edge cases seen in deepCSA-derived inputs (e.g., no multivariate terms available, LMEM singular fits, omega element construction, intercept forcing config).

Changes:

  • Skip multivariate regression output generation when multi_rules() leaves no remaining elements/predictors, avoiding downstream plotting errors.
  • Add handling for LMEM “Singular matrix” linear algebra errors during model fitting.
  • Fix omega reader element list construction when config["elements"] is not provided; adjust intercept forcing logic when config is empty/None.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Removes ps from the lockfile dependency set.
src/regressions/utils.py Updates intercept-selection logic for cases where the config doesn’t specify intercept-0 predictors.
src/regressions/models.py Wraps model fitting to bypass singular-matrix errors for mixed models.
src/regressions/main.py Skips multivariate execution/output when rules leave no viable multivariate terms.
src/plot/coefplot/main.py Minor logging message tweak.
src/create_input/readers/clonalstructure.py Fixes omega element generation when elements are not explicitly provided.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/regressions/main.py
Comment on lines +83 to +89
if not elements or not predictors:
logger.info("Multivariate analysis not possible: no remaining variables after applying rules")

else:
output_dir_multi = os.path.join(output_dir, metric, "multivariate")
os.makedirs(output_dir_multi, exist_ok = True)

Comment thread src/regressions/utils.py
Comment on lines +67 to 75
# no predictors to force a 0 intercept in config
if config["predictors_intercept_0"] is None:
intercept = " + 1"
return intercept

# if predictors contain at least one that requires zero intercept forcing, force it
predictors_intercept_0 = config["predictors_intercept_0"]
if not isinstance(predictors_intercept_0, list):
predictors_intercept_0 = list(predictors_intercept_0)
Comment thread src/regressions/models.py
else:
raise
except Exception as e:
logger.error(f"Unexpected error for formula {formula}: {str(e)}")
Copy link
Copy Markdown
Collaborator

@rochamorro1 rochamorro1 left a comment

Choose a reason for hiding this comment

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

It works perfectly, Raquel. Now it just does not plot anything if height = 0, meaning if there are no results for multivariate analyses.

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.

3 participants