2021年3月26日星期五

Begginer in Python - RNA transcript for a list of DNA sequences

I'm quite new to Python, and I'm trying to get the RNA transcription of a DNA sequence. Although I was able to do this for a single DNA sequence, I'm trying to find a way to do it for a list of DNA sequences. I hope you can please give me some guidance.

# Given this DNA sequence, get the RNA sequence:  dna = 'ACCTGACT'    # Defining the RNA transcription formula  def to_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  

Output:

RNA transcript= UGGACUGA  

What I have been trying to do, is to get a list of RNA transcription from a list of DNA sequences. I tried already to modify the code above, but I couldn't achieve any solution. I wonder if you could please help me with this question.

Input would be:

dna1= ['ACCTGACT','AATTGTCT']  

Expected outcome:

rna1 = ['UGGACUGA','UUAACAGA']   
https://stackoverflow.com/questions/66828236/begginer-in-python-rna-transcript-for-a-list-of-dna-sequences March 27, 2021 at 01:17PM

没有评论:

发表评论