def scan_spectrum_file(filename):
    """
    go over mgf file and return list with all spectrum titles
    """
    titles = []
    f = open(filename)
    while 1:
        rows = f.readlines(10000)
        if not rows:
            break
        for row in rows:
            if row[0] == 'T':
                if row[:5] == 'TITLE':
                    titles.append(row.rstrip()[6:])
    f.close()
    return titles
