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

ZeroDivisionError #46

Open
mschwoer opened this issue Sep 18, 2024 · 0 comments
Open

ZeroDivisionError #46

mschwoer opened this issue Sep 18, 2024 · 0 comments

Comments

@mschwoer
Copy link
Contributor

Describe the bug
Hey, I rarely get ZeroDivisionError on some blank files, mb just adjust the logging message?
len(df_nonnans.columns)/len(df.columns) if len(df.columns) else -1 ?

[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO - 0:41:52.696888 INFO: Traceback (most recent call last):
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/alphadia/cli.py", line 341, in run
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     plan.run()
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/alphadia/planning.py", line 379, in run
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     output.build(workflow_folder_list, base_spec_lib)
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/alphadia/outputtransform.py", line 372, in build
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     _ = self.build_lfq_tables(folder_list, psm_df=psm_df, save=True)
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/alphadia/outputtransform.py", line 739, in build_lfq_tables
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     lfq_df = qb.lfq(
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -              ^^^^^^^
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/alphadia/outputtransform.py", line 273, in lfq
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     lfq_df = lfqnorm.NormalizationManagerSamplesOnSelectedProteins(
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/directlfq/normalization.py", line 323, in __init__
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     self._run_normalization()
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/directlfq/normalization.py", line 263, in _run_normalization
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     self._normalize_complete_input_quadratic()
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/directlfq/normalization.py", line 268, in _normalize_complete_input_quadratic
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     self.complete_dataframe =  self.normalization_function(self.complete_dataframe)
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/directlfq/normalization.py", line 345, in _normalization_function
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     sample2shift = get_normfacts(drop_nas_if_possible(ion_dataframe_selected).to_numpy())
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/directlfq/normalization.py", line 236, in drop_nas_if_possible
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     fraction_nonans = calculate_fraction_with_no_NAs(df, df_nonans)
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -   File "/fs/home/kraken/conda-envs/alphadia-1.7.2/lib/python3.11/site-packages/directlfq/normalization.py", line 245, in calculate_fraction_with_no_NAs
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -     return len(df_nonnans.columns)/len(df.columns)
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO -            ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
[2024-08-24, 23:19:08 UTC] {ssh.py:529} INFO - ZeroDivisionError: division by zero

To Reproduce
quant 20240822_OA1_Whisper80_MaOe_SA_M768_SCP_Evochip_E06_ProcessedBlank.raw with alphadia, cf. output files here: fs/pool/pool-mann-alphakraken/output/_FALLBACK/2024_08/out_20240822_OA1_Whisper80_MaOe_SA_M768_SCP_Evochip_E06_ProcessedBlank.raw

Expected behavior
A graceful exit

Version (please complete the following information):

  • Installation Type: pip, imported in alphadia
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