import gzip

proteome = gzip.open('UP000000537.swiss.gz', 'rt')
trans = helix = 0
t = h = 0
for line in proteome:
    if line.startswith('//'):
        if t:
            trans += 1
        if h:
            helix += 1
        t = 0
        h = 0
    elif line.startswith('FT'):
        if 'TRANSMEM' in line:
            t = 1
        if 'HELIX' in line:
            h = 1

proteome.close()
print(f"Trensmembrane: {trans}, Helix: {helix}")    
