Describe the bug
Make sure your bug is not addressed in the troubleshooting section or in previous issues. If not, provide a clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
I installed the developer version of peptdeep with pip install -e ".[stable,development-stable]". I tried peptdeep.pipeline_api.transfer_learn() and got prediction matrices of all zeros. I confirmed this behavior with multiple speclib.tsv and pepxml+mzml files I loaded into global_settings.
Expected behavior
Non-zero predictions
Logs
2025-07-25 17:48:11> [PeptDeep] Running train task ...
2025-07-25 17:48:14> Loading PSMs and extracting fragments ...
100%|█████████████████████████████████████████████████████████████████████████████████| 27848/27848 [00:11<00:00, 2421.25it/s]
Empty string is detected in the `mobility` column, fill with 0.0
2025-07-25 17:48:33> Loaded 27848 PSMs for training and testing
2025-07-25 17:48:33> Training RT model ...
2025-07-25 17:48:33> 1224 PSMs for RT model training/transfer learning
2025-07-25 17:48:33> Testing pretrained RT model:
R_square R slope intercept test_num
0 0.906195 0.951943 0.962368 0.231975 200
2025-07-25 17:48:33> Training with fixed sequence length: 0
2025-07-25 17:48:33> Testing refined RT model:
R_square R slope intercept test_num
0 0.906195 0.951943 0.962368 0.231975 200
2025-07-25 17:48:33> Finished training RT model
2025-07-25 17:48:33> Training MS2 model ...
2025-07-25 17:48:37> Testing pretrained MS2 model on testing df:
PCC COS SA SPC
count 200.0 200.0 200.0 200.000000
mean 0.0 0.0 0.0 0.051298
std 0.0 0.0 0.0 0.215521
min 0.0 0.0 0.0 -0.454129
25% 0.0 0.0 0.0 -0.085351
50% 0.0 0.0 0.0 0.046855
75% 0.0 0.0 0.0 0.214629
max 0.0 0.0 0.0 0.652426
>0.90 0.0 0.0 0.0 0.000000
>0.75 0.0 0.0 0.0 0.000000
2025-07-25 17:48:37> 1692 PSMs for MS2 model training/transfer learning
2025-07-25 17:48:37> Training with fixed sequence length: 0
[Training] Epoch=1, lr=4e-05, loss=0.03749007191509009
[Training] Epoch=2, lr=6e-05, loss=0.03095195721834898
[Training] Epoch=3, lr=8e-05, loss=0.023990619213630757
[Training] Epoch=4, lr=0.0001, loss=0.02098238399873177
[Training] Epoch=5, lr=0.0001, loss=0.01814938588067889
[Training] Epoch=6, lr=9.045084971874738e-05, loss=0.017319106155385573
[Training] Epoch=7, lr=6.545084971874738e-05, loss=0.015489165981610617
[Training] Epoch=8, lr=3.4549150281252636e-05, loss=0.015003920874247949
[Training] Epoch=9, lr=9.549150281252633e-06, loss=0.014223656989634037
[Training] Epoch=10, lr=1.0000000000000002e-14, loss=0.013656104945888122
2025-07-25 17:48:42> Testing refined MS2 model on training df:
PCC COS SA SPC
count 1692.0 1692.0 1692.0 1692.000000
mean 0.0 0.0 0.0 0.096597
std 0.0 0.0 0.0 0.211188
min 0.0 0.0 0.0 -0.483608
25% 0.0 0.0 0.0 -0.042768
50% 0.0 0.0 0.0 0.088416
75% 0.0 0.0 0.0 0.227828
max 0.0 0.0 0.0 0.735943
>0.90 0.0 0.0 0.0 0.000000
>0.75 0.0 0.0 0.0 0.000000
2025-07-25 17:48:42> Testing refined MS2 model on testing df:
PCC COS SA SPC
count 200.0 200.0 200.0 200.000000
mean 0.0 0.0 0.0 0.051298
std 0.0 0.0 0.0 0.215521
min 0.0 0.0 0.0 -0.454129
25% 0.0 0.0 0.0 -0.085351
50% 0.0 0.0 0.0 0.046855
75% 0.0 0.0 0.0 0.214629
max 0.0 0.0 0.0 0.652426
>0.90 0.0 0.0 0.0 0.000000
>0.75 0.0 0.0 0.0 0.000000
2025-07-25 17:48:42> Finished training MS2 model
Screenshots
If applicable, add screenshots to help explain your problem.
Version (please complete the following information):
- Installation Type [e.g. One-Click Installer / Pip / Developer]
- If no log is available, provide the following:
2025-07-25 17:42:49> Platform information:
2025-07-25 17:42:49> system - Windows
2025-07-25 17:42:49> release - 10
2025-07-25 17:42:49> version - 10.0.22621
2025-07-25 17:42:49> machine - AMD64
2025-07-25 17:42:49> processor - Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
2025-07-25 17:42:49> cpu count - 16
2025-07-25 17:42:49> ram - 53.4/95.7 Gb (available/total)
2025-07-25 17:42:49>
2025-07-25 17:42:49> Python information:
2025-07-25 17:42:49> alphabase> -
2025-07-25 17:42:49> alpharaw> -
2025-07-25 17:42:49> autodocsumm - 0.2.14
2025-07-25 17:42:49> click - 8.1.7
2025-07-25 17:42:49> contextfilter - 0.3.0
2025-07-25 17:42:49> furo - 2024.8.6
2025-07-25 17:42:49> jinja2 - 3.1.6
2025-07-25 17:42:49> lxml - 5.3.0
2025-07-25 17:42:49> myst_parser - 3.0.1
2025-07-25 17:42:49> nbmake -
2025-07-25 17:42:49> nbsphinx - 0.9.7
2025-07-25 17:42:49> numba - 0.60.0
2025-07-25 17:42:49> numpy<2 -
2025-07-25 17:42:49> pandas - 2.2.3
2025-07-25 17:42:49> peptdeep - 1.4.1-dev0
2025-07-25 17:42:49> pre-commit -
2025-07-25 17:42:49> psutil - 5.9.0
2025-07-25 17:42:49> pydivsufsort -
2025-07-25 17:42:49> pyteomics - 4.7.5
2025-07-25 17:42:49> pytest -
2025-07-25 17:42:49> python - 3.9.21
2025-07-25 17:42:49> scikit-learn - 1.6.0
2025-07-25 17:42:49> seaborn - 0.13.2
2025-07-25 17:42:49> sphinx - 7.4.7
2025-07-25 17:42:49> streamlit - 1.43.1
2025-07-25 17:42:49> streamlit-aggrid - 1.0.5
2025-07-25 17:42:49> streamlit> -
2025-07-25 17:42:49> torch - 2.5.1+cu121
2025-07-25 17:42:49> tqdm - 4.67.1
2025-07-25 17:42:49> transformers - 4.47.0
Additional context
This issue may be related to #224, MannLabs/alphadia#409, or MannLabs/alphadia#406.
I modified the function update_sliced_fragment_dataframe in alphabase.peptide.fragment.py at line 605 (https://github.com/MannLabs/alphabase/blob/2a758adcad512a60957960ffdf5ae1f07216c334/alphabase/peptide/fragment.py#L604C9-L604C25) to add a line that directly updates fragment_df instead of only fragment_df_vals:
if charged_frag_types is None or len(charged_frag_types) == 0:
fragment_df_vals[frag_slices, :] = values.astype(fragment_df_vals.dtype)
fragment_df.iloc[frag_slices, :] = values.astype(fragment_df_vals.dtype)
After adding this line, transfer learning runs smoothly
2025-07-25 17:42:49> [PeptDeep] Running train task ...
2025-07-25 17:42:52> Loading PSMs and extracting fragments ...
100%|█████████████████████████████████████████████████████████████████████████████████| 27848/27848 [00:11<00:00, 2390.36it/s]
Empty string is detected in the `mobility` column, fill with 0.0
2025-07-25 17:43:11> Loaded 27848 PSMs for training and testing
2025-07-25 17:43:11> Training RT model ...
2025-07-25 17:43:11> 1224 PSMs for RT model training/transfer learning
2025-07-25 17:43:11> Testing pretrained RT model:
R_square R slope intercept test_num
0 0.930724 0.96474 0.985213 0.224196 200
2025-07-25 17:43:11> Training with fixed sequence length: 0
2025-07-25 17:43:11> Testing refined RT model:
R_square R slope intercept test_num
0 0.930724 0.96474 0.985213 0.224196 200
2025-07-25 17:43:11> Finished training RT model
2025-07-25 17:43:11> Training MS2 model ...
2025-07-25 17:43:15> Testing pretrained MS2 model on testing df:
PCC COS SA SPC
count 200.000000 200.000000 200.000000 200.000000
mean 0.918067 0.925407 0.777811 0.782237
std 0.083174 0.075037 0.113016 0.160973
min 0.476020 0.511491 0.341813 0.099542
25% 0.894274 0.905665 0.721255 0.693150
50% 0.942028 0.945901 0.789638 0.809570
75% 0.972704 0.974979 0.857291 0.898580
max 0.998703 0.998764 0.968340 0.999954
>0.90 0.725000 0.770000 0.120000 0.245000
>0.75 0.955000 0.970000 0.645000 0.650000
2025-07-25 17:43:15> 1692 PSMs for MS2 model training/transfer learning
2025-07-25 17:43:15> Training with fixed sequence length: 0
[Training] Epoch=1, lr=4e-05, loss=0.024538329740365347
[Training] Epoch=2, lr=6e-05, loss=0.022115163567165533
[Training] Epoch=3, lr=8e-05, loss=0.019727862812578677
[Training] Epoch=4, lr=0.0001, loss=0.01797805226718386
[Training] Epoch=5, lr=0.0001, loss=0.016415516970058282
[Training] Epoch=6, lr=9.045084971874738e-05, loss=0.016211210160205762
[Training] Epoch=7, lr=6.545084971874738e-05, loss=0.014452268121143181
[Training] Epoch=8, lr=3.4549150281252636e-05, loss=0.014053952569762865
[Training] Epoch=9, lr=9.549150281252633e-06, loss=0.013430366354684035
[Training] Epoch=10, lr=1.0000000000000002e-14, loss=0.012770313334961732
2025-07-25 17:43:20> Testing refined MS2 model on training df:
PCC COS SA SPC
count 1692.000000 1692.000000 1692.000000 1692.000000
mean 0.936367 0.941652 0.822450 0.762332
std 0.102090 0.094025 0.132790 0.150148
min 0.146507 0.190090 0.121756 -0.042815
25% 0.932747 0.938469 0.775512 0.676017
50% 0.975781 0.977678 0.865236 0.784977
75% 0.990360 0.990995 0.914503 0.870501
max 0.999855 0.999859 0.989299 1.000000
>0.90 0.825059 0.835106 0.338652 0.169031
>0.75 0.942080 0.952128 0.790189 0.579196
2025-07-25 17:43:21> Testing refined MS2 model on testing df:
PCC COS SA SPC
count 200.000000 200.000000 200.000000 200.000000
mean 0.959992 0.963744 0.856733 0.794086
std 0.067847 0.060791 0.098201 0.128814
min 0.483538 0.516474 0.345511 0.295009
25% 0.960632 0.963947 0.828534 0.722612
50% 0.981664 0.983253 0.883327 0.806845
75% 0.991650 0.992322 0.921061 0.889037
max 0.999463 0.999478 0.979430 1.000000
>0.90 0.915000 0.925000 0.385000 0.225000
>0.75 0.975000 0.980000 0.895000 0.670000
2025-07-25 17:43:21> Finished training MS2 model
Describe the bug
Make sure your bug is not addressed in the troubleshooting section or in previous issues. If not, provide a clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
I installed the developer version of peptdeep with pip install -e ".[stable,development-stable]". I tried peptdeep.pipeline_api.transfer_learn() and got prediction matrices of all zeros. I confirmed this behavior with multiple speclib.tsv and pepxml+mzml files I loaded into global_settings.
Expected behavior
Non-zero predictions
Logs
Screenshots
If applicable, add screenshots to help explain your problem.
Version (please complete the following information):
2025-07-25 17:42:49> Platform information:
2025-07-25 17:42:49> system - Windows
2025-07-25 17:42:49> release - 10
2025-07-25 17:42:49> version - 10.0.22621
2025-07-25 17:42:49> machine - AMD64
2025-07-25 17:42:49> processor - Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
2025-07-25 17:42:49> cpu count - 16
2025-07-25 17:42:49> ram - 53.4/95.7 Gb (available/total)
2025-07-25 17:42:49>
2025-07-25 17:42:49> Python information:
2025-07-25 17:42:49> alphabase> -
2025-07-25 17:42:49> alpharaw> -
2025-07-25 17:42:49> autodocsumm - 0.2.14
2025-07-25 17:42:49> click - 8.1.7
2025-07-25 17:42:49> contextfilter - 0.3.0
2025-07-25 17:42:49> furo - 2024.8.6
2025-07-25 17:42:49> jinja2 - 3.1.6
2025-07-25 17:42:49> lxml - 5.3.0
2025-07-25 17:42:49> myst_parser - 3.0.1
2025-07-25 17:42:49> nbmake -
2025-07-25 17:42:49> nbsphinx - 0.9.7
2025-07-25 17:42:49> numba - 0.60.0
2025-07-25 17:42:49> numpy<2 -
2025-07-25 17:42:49> pandas - 2.2.3
2025-07-25 17:42:49> peptdeep - 1.4.1-dev0
2025-07-25 17:42:49> pre-commit -
2025-07-25 17:42:49> psutil - 5.9.0
2025-07-25 17:42:49> pydivsufsort -
2025-07-25 17:42:49> pyteomics - 4.7.5
2025-07-25 17:42:49> pytest -
2025-07-25 17:42:49> python - 3.9.21
2025-07-25 17:42:49> scikit-learn - 1.6.0
2025-07-25 17:42:49> seaborn - 0.13.2
2025-07-25 17:42:49> sphinx - 7.4.7
2025-07-25 17:42:49> streamlit - 1.43.1
2025-07-25 17:42:49> streamlit-aggrid - 1.0.5
2025-07-25 17:42:49> streamlit> -
2025-07-25 17:42:49> torch - 2.5.1+cu121
2025-07-25 17:42:49> tqdm - 4.67.1
2025-07-25 17:42:49> transformers - 4.47.0
Additional context
This issue may be related to #224, MannLabs/alphadia#409, or MannLabs/alphadia#406.
I modified the function update_sliced_fragment_dataframe in alphabase.peptide.fragment.py at line 605 (https://github.com/MannLabs/alphabase/blob/2a758adcad512a60957960ffdf5ae1f07216c334/alphabase/peptide/fragment.py#L604C9-L604C25) to add a line that directly updates fragment_df instead of only fragment_df_vals:
After adding this line, transfer learning runs smoothly