def _spectra_summary(spectraf, data):
    """ Calculates metadata per spectra file.
    The return order is as follows:

    -minimum RT_min
    -maximum RT_min
    -min IonScore
    -max IonScore
    -min q_value
    -max q_value
    -min PEP
    -max PEP
    -min Area (precursor, exculding zeros)
    -max Area
    -PSM Count
    -median DeltaMassPPM
    """
    data      = data[data.SpectrumFile==spectraf]

    RT_min       = data.RTmin.min()
    RT_max       = data.RTmin.max()
    IonScore_min = data.IonScore.min()
    IonScore_max = data.IonScore.max()
    q_min        = data.q_value.min()
    q_max        = data.q_value.max()
    PEP_min      = data.PEP.min()
    PEP_max      = data.PEP.max()
    area_min     = data[data.PrecursorArea!=0].PrecursorArea.min()
    area_max     = data.PrecursorArea.max()
    count    = len(data[data.PSM_UseFLAG==1])
    dmass_median = data.DeltaMassPPM.median()
    return(RT_min, RT_max, IonScore_min, IonScore_max, q_min, q_max,
           PEP_min, PEP_max, area_min, area_max, count, dmass_median)