def read_ss2(file):
    """
    Read secondary structure scores produced by PSIPRED V4.0 from the .ss2 file.
    Inputs:
        - file: Filename of the .ss2 file output by PSIPRED V4.0
    Returns:
        - prot:  Protein sequence (string)
        - helix: List of predicted helix tendencies (values between 0 and 1)
        - coil:  List of predicted coil tendencies (values between 0 and 1)
    """
    
    f = open(file, 'r')
    helix, coil = [], [] # Ignores beta sheet score since the three scores sum to 1
    prot = ''
    
    for line in f:
        if '#' in line or len(line.split()) < 4:
            continue
        
        tokens = line.strip().split()
        assert len(tokens) == 6
        prot += tokens[1]
        helix.append(float(tokens[4]))
        coil.append(float(tokens[3]))
    f.close()
    
    return prot, helix, coil