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

Greater than or equal to character ≥ causes logging error in end of run report. #356

Closed
Lilferrit opened this issue Jul 10, 2024 · 0 comments · Fixed by #357
Closed

Greater than or equal to character ≥ causes logging error in end of run report. #356

Lilferrit opened this issue Jul 10, 2024 · 0 comments · Fixed by #357
Labels
bug Something isn't working

Comments

@Lilferrit
Copy link
Contributor

The greater than or equal to sign seems to be causing a logging error in the end of run report. I'm running Casanovo on Windows so this may be a platform specific bug. Regardless, here is the end of run report logging output:

INFO: ======= End of Run Report =======
INFO: Run Start Time: 24/07/10 16:32:03
INFO: Run End Time: 24/07/10 16:32:23
INFO: Time Elapsed: 0:00:19.993346
INFO: Executed Command: D:\anaconda3\envs\casanovo_env\Scripts\casanovo sequence sample_data\sample_preprocessed_spectra.mgf -o foo
INFO: Executed on Host Machine: DESKTOP-P03U1SR
INFO: Max GPU Memory Utilization: 381 MiB
INFO: Sequenced 128 spectra
INFO: Score Distribution:
INFO: 96 spectra (75.00%) scored ≥ 0.00
--- Logging error ---
Traceback (most recent call last):
  File "D:\anaconda3\envs\casanovo_env\lib\logging\__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "D:\anaconda3\envs\casanovo_env\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 109: character maps to <undefined>
Call stack:
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\anaconda3\envs\casanovo_env\Scripts\casanovo.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 152, in main
    rv = self.invoke(ctx)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\casanovo.py", line 152, in sequence
    utils.log_sequencing_report(
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\utils.py", line 238, in log_sequencing_report
    logger.info(
Message: '%d spectra (%.2f%%) scored ≥ %.2f'
Arguments: (96, 75.0, 0.0)
INFO: 96 spectra (75.00%) scored ≥ 0.50
--- Logging error ---
Traceback (most recent call last):
  File "D:\anaconda3\envs\casanovo_env\lib\logging\__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "D:\anaconda3\envs\casanovo_env\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 109: character maps to <undefined>
Call stack:
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\anaconda3\envs\casanovo_env\Scripts\casanovo.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 152, in main
    rv = self.invoke(ctx)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\casanovo.py", line 152, in sequence
    utils.log_sequencing_report(
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\utils.py", line 238, in log_sequencing_report
    logger.info(
Message: '%d spectra (%.2f%%) scored ≥ %.2f'
Arguments: (96, 75.0, 0.5)
INFO: 66 spectra (51.56%) scored ≥ 0.90
--- Logging error ---
Traceback (most recent call last):
  File "D:\anaconda3\envs\casanovo_env\lib\logging\__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "D:\anaconda3\envs\casanovo_env\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 109: character maps to <undefined>
Call stack:
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\anaconda3\envs\casanovo_env\Scripts\casanovo.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 152, in main
    rv = self.invoke(ctx)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\casanovo.py", line 152, in sequence
    utils.log_sequencing_report(
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\utils.py", line 238, in log_sequencing_report
    logger.info(
Message: '%d spectra (%.2f%%) scored ≥ %.2f'
Arguments: (66, 51.5625, 0.9)
INFO: 60 spectra (46.88%) scored ≥ 0.95
--- Logging error ---
Traceback (most recent call last):
  File "D:\anaconda3\envs\casanovo_env\lib\logging\__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "D:\anaconda3\envs\casanovo_env\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 109: character maps to <undefined>
Call stack:
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\anaconda3\envs\casanovo_env\Scripts\casanovo.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 152, in main
    rv = self.invoke(ctx)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\casanovo.py", line 152, in sequence
    utils.log_sequencing_report(
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\utils.py", line 238, in log_sequencing_report
    logger.info(
Message: '%d spectra (%.2f%%) scored ≥ %.2f'
Arguments: (60, 46.875, 0.95)
INFO: 8 spectra (6.25%) scored ≥ 0.99
--- Logging error ---
Traceback (most recent call last):
  File "D:\anaconda3\envs\casanovo_env\lib\logging\__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "D:\anaconda3\envs\casanovo_env\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 107: character maps to <undefined>
Call stack:
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda3\envs\casanovo_env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\anaconda3\envs\casanovo_env\Scripts\casanovo.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\rich_click\rich_command.py", line 152, in main
    rv = self.invoke(ctx)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\anaconda3\envs\casanovo_env\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\casanovo.py", line 152, in sequence
    utils.log_sequencing_report(
INFO: Min Peptide Length: 6
INFO: Max Peptide Length: 17
INFO: Median Peptide Length: 9

Changing the logging statement

logger.info(
    "%s spectra (%.2f%%) scored ≥ %.2f",
    pop,
    pop / num_spectra * 100,
    score,
)

to

logger.info(
    "%s spectra (%.2f%%) scored >= %.2f",
    pop,
    pop / num_spectra * 100,
    score,
)

seems to resolve this issue. This bug appeared for me after running the command casanovo sequence sample_data\sample_preprocessed_spectra.mgf -o foo.

@Lilferrit Lilferrit added the bug Something isn't working label Jul 10, 2024
@bittremieux bittremieux linked a pull request Jul 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant