import gzip

input_file = "UP000002194.swiss.gz"

helix_count = 0
transmem_count = 0
both_count = 0

with gzip.open(input_file, "rt") as f:
    has_helix = False
    has_transmem = False

    for line in f:
        if line.startswith("FT   HELIX"):
            has_helix = True
        elif line.startswith("FT   TRANSMEM"):
            has_transmem = True
        elif line.startswith("//"):
            if has_helix:
                helix_count += 1
            if has_transmem:
                transmem_count += 1
            if has_helix and has_transmem:
                both_count += 1
            has_helix = False
            has_transmem = False

print(f"Белков с HELIX:    {helix_count}")
print(f"Белков с TRANSMEM: {transmem_count}")
print(f"Белков с обоими:   {both_count}")
