how to split RNA-seq into codons by using python

I used the GitHub Copilot to answer this question:

first I typed

## how to split RNA-seq into codons

The copilot wrote me the code:

def codons(seq):
    codon_list = []
    for i in range(0, len(seq), 3):
    return codon_list

Let’s see how it works:

print (codons(seq))


['ACA', 'GUC', 'GAC', 'UAG', 'CUU', 'GCA', 'CGU', 'AC']

looks good to me, then I wrote:

#  count complete and incomplete codons

without batting an eye the Copilot suggested:

def count():
    codon_list = codons(seq)
    complete = 0
    incomplete = 0
    for codon in codon_list:
        if len(codon) == 3:
            complete += 1
            incomplete += 1
    return complete, incomplete

A new era has begun in computing. Remember this day, it is the first day of the new era.

Read more here: Source link