code: def enrichment_from_msp(dfmsp, modification="Phospho (STY)"):
      
  
      dfmsp['Modifications'] = np.array([modification in m for m in dfmsp['Modifications']])
      dfmsp = dfmsp.set_index(['Modifications'])
      dfmsp = dfmsp.filter(regex='Intensity ')
  
      dfmsp[ dfmsp == 0] = np.nan
      df_r = dfmsp.sum(axis=0, level=0)
  
      modified = df_r.loc[True].values
      total = df_r.sum(axis=0).values
      enrichment = modified / total
  
      return pd.DataFrame([enrichment], columns=dfmsp.columns, index=['% Enrichment'])
docs: Calculate relative enrichment of peptide modifications from modificationSpecificPeptides.txt.
  
      Taking a modifiedsitepeptides ``DataFrame`` returns the relative enrichment of the specified
      modification in the table.
  
      The returned data columns are generated from the input data columns.
  
      :param df: Pandas ``DataFrame`` of modificationSpecificPeptides
      :return: Pandas ``DataFrame`` of percentage modifications in the supplied data.