compomics / ms2rescore

Modular and user-friendly platform for AI-assisted rescoring of peptide identifications
https://ms2rescore.readthedocs.io
Apache License 2.0
39 stars 14 forks source link

MS2PIPFeatureGenerator and DeepLCFeatureGenerator, provide a progress callback #150

Open vrkosk opened 1 month ago

vrkosk commented 1 month ago

Currently (ms2rescore 3.0.3), MS2PIPFeatureGenerator has some code to provide a progress bar when running in a terminal. It's done using rich.progress.track. DeepLCFeatureGenerator seems to not use it.

When a script using MS2PIPFeatureGenerator is run with stderr and stdout is directed to something that isn't a terminal (e.g. pipe to a file or another process), there's no progress feedback printed. It would be nice to have some mechanism to print simple progress messages instead of a rich progress bar. For example, just provide a lambda argument like:

    MS2PIPFeatureGenerator(
        progress_callback=lambda percentage, text: print "PROGRESS:{}; {}".format(percentage, text)
   )

Pretty much any other way is fine, even sending them as logging.info() messages.