Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalizing autosomes part of predict command not working #127

Open
Stikus opened this issue Oct 3, 2024 · 1 comment
Open

Normalizing autosomes part of predict command not working #127

Stikus opened this issue Oct 3, 2024 · 1 comment

Comments

@Stikus
Copy link

Stikus commented Oct 3, 2024

Hello again, we have another problem.

Installed packages:

joblib-1.4.2
numpy-2.1.1
pandas-2.2.3
pysam-0.22.1
python-dateutil-2.9.0.post0
pytz-2024.2
scikit-learn-1.5.2
scipy-1.14.1
threadpoolctl-3.5.0
tzdata-2024.2
wisecondorx-1.2.7 

WisecondorX is the latest version, but log show 1.2.7 (issue #126)

Error log:

  Command: 'WisecondorX predict /outputs/inputs/NPZ/E07002_normal_alignment.npz /outputs/reference.npz /outputs/E07002_normal_alignment --plot --bed'.
  PID=429 (last job)
[INFO - 2024-10-03 18:02:48]: Starting CNA prediction
[INFO - 2024-10-03 18:02:48]: Importing data ...
[INFO - 2024-10-03 18:02:48]: Normalizing autosomes ...
Traceback (most recent call last):
  File "/usr/local/bin/WisecondorX", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/wisecondorx/main.py", line 487, in main
    args.func(args)
  File "/usr/local/lib/python3.10/dist-packages/wisecondorx/main.py", line 187, in tool_test
    results_r, results_z, results_w, ref_sizes, m_lr, m_z = normalize(
  File "/usr/local/lib/python3.10/dist-packages/wisecondorx/predict_control.py", line 32, in normalize
    sample = project_pc(sample, ref_file, ap)
  File "/usr/local/lib/python3.10/dist-packages/wisecondorx/predict_tools.py", line 61, in project_pc
    transform = pca.transform(np.array([sample_data]))
  File "/usr/local/lib/python3.10/dist-packages/sklearn/utils/_set_output.py", line 316, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/sklearn/decomposition/_base.py", line 139, in transform
    xp, _ = get_namespace(X, self.components_, self.explained_variance_)
AttributeError: 'PCA' object has no attribute 'explained_variance_'

Can anyone help?

@Stikus
Copy link
Author

Stikus commented Oct 4, 2024

After some debug we've found, that with scikit-learn<1.4.0 all tests are good, with scikit-learn<1.5.0 there are small numerical changes (rounding) and with scikit-learn==1.5.0 we got this error.

I assume that some breaking changes for this code happened in v1.5.0. Maybe these: https://scikit-learn.org/stable/whats_new/v1.5.html#id9

I think that repository need either pin scikit-learn<1.5.0 or update code to modern standards.

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

No branches or pull requests

1 participant