@@ -57,6 +57,14 @@ def predict_ccs(
5757 use_charge_state = use_charge_state ,
5858 )
5959
60+ if ion_mobility :
61+ LOGGER .info ("Converting CCS to IM values..." )
62+ psm_list_pred_df ["predicted_im" ] = ccs2im (
63+ psm_list_pred_df ["predicted_ccs" ],
64+ psm_list_pred_df ["peptidoform" ].apply (lambda x : x .theoretical_mz ),
65+ psm_list_pred_df ["charge" ],
66+ )
67+
6068 if write_output :
6169 if not ion_mobility :
6270 LOGGER .info ("Writing output file..." )
@@ -70,12 +78,6 @@ def predict_ccs(
7078 output_file .write (f"{ peptidoform } ,{ charge } ,{ CCS } \n " )
7179 output_file .close ()
7280 else :
73- LOGGER .info ("Converting CCS to IM values..." )
74- psm_list_pred_df ["predicted_im" ] = ccs2im (
75- psm_list_pred_df ["predicted_ccs" ],
76- psm_list_pred_df ["peptidoform" ].apply (lambda x : x .theoretical_mz ),
77- psm_list_pred_df ["charge" ],
78- )
7981 LOGGER .info ("Writing output file..." )
8082 output_file = open (output_file , "w" )
8183 output_file .write ("modified_seq,charge,predicted IM\n " )
@@ -89,4 +91,7 @@ def predict_ccs(
8991
9092 LOGGER .info ("IM2Deep finished!" )
9193
92- return psm_list_pred_df ["predicted_ccs" ]
94+ if not ion_mobility :
95+ return psm_list_pred_df ["predicted_ccs" ]
96+ else :
97+ return psm_list_pred_df ["predicted_im" ]
0 commit comments