cohorts
cohorts copied to clipboard
logging does not respond to user-configured level
The way our logging module is configured isn't quite right - I don't know what the best practice is (seems there are multiple recommendations on SO).
At the very least, I find this problematic when trying to debug certain errors.
For example, after adding various debug messages (e.g. here), I see the following:
# (note that my cohort is defined here in the object `rcc`)
import logging
logging.getLogger('cohorts.cohort').setLevel(logging.DEBUG)
x = rcc.cohort._load_single_patient_neoantigens(rcc.cohort.patient_from_id('4_54'),
only_expressed=True, epitope_lengths=[8,9,10,11],
ic50_cutoff=500, process_limit=10, max_file_records=None,
filter_fn=None)
The only output I see is a warning (also added in the same edit):
WARNING:cohorts.cohort:patient 4_54 has no expressed variants
I think this is in part because our get_logger
method sets the level to logging.INFO
pro-actively. It also could be a result of the logging.disable(logging.INFO)
line in cohorts.cohort.get_filtered_isovar_epitopes. This does not appear to have been reverted, and I'm also not sure what its purpose is.
At any rate, in general this leads to inconsistent behavior in the package. It would be helpful to figure out how to repair the logging & ensure that the user can capture relevant messages reliable.
Some resources I've been looking at include: