[Python] How to transcribe a list of DNA sequences to RNA in Python

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to return a list of RNA sequences transcribed from DNA sequences. Ideally it should look like:

    DNA_seq = ['AGGTC','TTGACT','ATGGCA']
    RNA_seq = ['UCCAG','AACUGA','UACCGU']


    From my understanding, a dictionary should help store the key-value pairs for each nucleotide and its corresponding base pair. Here is what I have so far:

    def RNA(DNA_strand):
    mapping = {'G':'C', 'C':'G', 'T':'A', 'A':'U'}
    rna_strand = ''
    for char in DNA_strand:
    rna_strand += mapping[char]
    return rna_strand

    RNA_seq = []
    for x in DNA_seq:
    RNA_seq.append(RNA(x))


    I kind of pieced this together, but I still does not seem to be effective enough.

    Continue reading...

Compartilhe esta Página