3
私はPythonを使用してDNA配列のセットをアミノ酸(タンパク質)配列に変換するプログラムを作成しています。次に、特定のサブシーケンスを見つけ、この特定のサブシーケンスが存在するシーケンスの数を数えます。Pythonプログラミングを使用して一連のDNA配列をタンパク質配列に変換する方法は?
#Open cDNA_sequences file and read in line by line
with open('cDNA_sequences.csv', 'r') as results:
for line in results:
columns = line.rstrip("\n").split(",") #remove end of line characters and split commas to produce a list
ensemblID = columns[0] #ensemblID is first element in our list
dna_seq = columns[1] #dna_seq is second element in our list
genetic code = {
"UUU":"F", "UUC":"F", "UUA":"L", "UUG":"L",
"UCU":"S", "UCC":"s", "UCA":"S", "UCG":"S",
"UAU":"Y", "UAC":"Y", "UAA":"STOP", "UAG":"STOP",
"UGU":"C", "UGC":"C", "UGA":"STOP", "UGG":"W",
"CUU":"L", "CUC":"L", "CUA":"L", "CUG":"L",
"CCU":"P", "CCC":"P", "CCA":"P", "CCG":"P",
"CAU":"H", "CAC":"H", "CAA":"Q", "CAG":"Q",
"CGU":"R", "CGC":"R", "CGA":"R", "CGG":"R",
"AUU":"I", "AUC":"I", "AUA":"I", "AUG":"M",
"ACU":"T", "ACC":"T", "ACA":"T", "ACG":"T",
"AAU":"N", "AAC":"N", "AAA":"K", "AAG":"K",
"AGU":"S", "AGC":"S", "AGA":"R", "AGG":"R",
"GUU":"V", "GUC":"V", "GUA":"V", "GUG":"V",
"GCU":"A", "GCC":"A", "GCA":"A", "GCG":"A",
"GAU":"D", "GAC":"D", "GAA":"E", "GAG":"E",
"GGU":"G", "GGC":"G", "GGA":"G", "GGG":"G",} #genetic code, telling into which amino acids the DNA triplets translate
for i in range (0, len(dna_seq), 3):
codon = dna_seq[i:i+3]
protein += genetic_code [codon]
print (protein)
enterokinase_motif = "DDDDK"
proline_motif = "DDDDKP"
motif_number = 0
if enterokinase_motif in line:
motif_number = motif_number + 1;
elif proline_number in line:
motif_number = motif_number;
else:
motif_number = motif_number
print ("The number of sequences containing one or more enterokinase motifs is []".format(motif_number))
私はトラブルタンパク質配列のDNA配列に変換するためのコードを書いを持っています:これは私がこれまで持っているコードです。
また、サンプル入力と所望の出力を明記してください –