MannLabs / directlfq

Fast and accurate label-free quantification for small and very large numbers of proteomes
https://doi.org/10.1101/2023.02.17.528962
Apache License 2.0
37 stars 4 forks source link

Default config.QUANT_ID and config.PROTEIN_ID not used on import #24

Closed GeorgWa closed 7 months ago

GeorgWa commented 9 months ago

Describe the bug Somehow the default values defined for config.QUANT_ID and config.PROTEIN_ID are not set when importing directlfq as module.

The result is a rather confusing pandas error None of [None, None] are in the columns for users. It can be mitigated by calling lfqconfig.set_global_protein_and_ion_id(protein_id = 'protein', quant_id = 'ion') before.

To Reproduce Steps to reproduce the behavior:

  1. import direct LFQ
  2. call directLFQ on a dataframe with default columns protein and ion.

Logs

Traceback (most recent call last):
  File "d:\alphadia\alphadia\planning.py", line 274, in run
    output.build(workflow_folder_list, base_spec_lib)
  File "d:\alphadia\alphadia\outputtransform.py", line 365, in build
    _ = self.build_protein_table(folder_list, psm_df=psm_df, save=True)
  File "d:\alphadia\alphadia\outputtransform.py", line 571, in build_protein_table
    protein_df = qb.lfq(
  File "d:\alphadia\alphadia\outputtransform.py", line 269, in lfq
    lfq_df = lfqutils.index_and_log_transform_input_df(intensity_df)
  File "D:\Maria\anaconda\envs\alpha\lib\site-packages\directlfq\utils.py", line 323, in index_and_log_transform_input_df
    data_df = data_df.set_index([config.PROTEIN_ID, config.QUANT_ID])
  File "D:\Maria\anaconda\envs\alpha\lib\site-packages\pandas\core\frame.py", line 5859, in set_index
    raise KeyError(f"None of {missing} are in the columns")
KeyError: 'None of [None, None] are in the columns'
0:00:57.756267 ERROR: Output failed with error 'None of [None, None] are in the columns'
'None of [None, None] are in the columns'

Version (please complete the following information):

ammarcsj commented 7 months ago

Zerwas Schorschä, thanks for the feedback! Should be fixed in the new version.