Untitled

mail@pastecode.io avatar
unknown
python
10 months ago
1.4 kB
3
Indexable
# Initialize an empty string to store the formatted protein sequence
formatted_protein = ""

# Iterate over the protein sequence in chunks of 70 characters
for i in range(0, len(protein), 70):
    # Add the current chunk of 70 characters to the formatted protein sequence,
    # appending a newline character after each chunk
    formatted_protein += protein[i:i+70] + '\n'

# Join the formatted chunks into a single string with newline characters
formatted_proteinNEW = '\n'.join(formatted_protein)

# Display the formatted protein sequence
print(formatted_proteinNEW)
# ------------------------
# Initialize an empty string to store the formatted DNA sequence name
formatted_dna_name = ""

# Iterate over the DNA sequence name in chunks of 30 characters
for i in range(0, len(dna_name), 30):
    # Add the current chunk of 30 characters to the formatted DNA sequence name,
    # appending a newline character after each chunk
    formatted_dna_name += dna_name[i:i+30] + '\n'

# Join the formatted chunks into a single string with newline characters
formatted_dna_nameNEW = '\n'.join(formatted_dna_name)

# Display the formatted DNA sequence name
print(formatted_dna_nameNEW)



#-------
# The THIRD LINE IS NOT CHANGEABLE REALLY - it comes from a python function
# Create a list containing pairs of elements from dna_name and protein
# zip() function is used to pair corresponding elements from both lists
pair = list(zip({dna_name}, {protein}))
Leave a Comment