私は与えられたシーケンスから要素を数えるために使用されるスクリプトを開発しています。私はすでにこの作業を改善する方法を見つけましたが、文字列に含まれている文字が実際に数えられるものではなく、どうにかして印刷するときに辞書を使用できるかどうかは疑問でした。次の文字列の辞書の使い方は?
sequence = str(input('Enter DNA sequence:'))
print ('Your sequence contain:',len(sequence), 'bases', 'with the following
structure:')
adenine = sequence.count("A") + sequence.count("a")
thymine = sequence.count("T") + sequence.count("t")
cytosine = sequence.count("C") + sequence.count("c")
guanine = sequence.count ("G") + sequence.count("g")
print("adenine =", adenine)
print("thymine=", thymine)
print("cytosine=", cytosine)
print("guanine=", guanine)
私はこのような辞書に考えていた: DICC = {アデニン:[ "A"、 ""]、チミン:例えば
[ "T"、 "T"] 、 シトシン:[ "C"、 "C"]、グアニン:[ "G"、 "G"]
}
しかし、私は、彼らがある場合はヌクレオチドではないこれらの文字を印刷する方法を知りませんたとえば、次のシーケンスで結果が次のようになります。
sequence = AacGTtxponwxs:
your sequence contain 13 bases with the following structure:
adenine = 2
thymine = 2
cytosine = 1
thymine = 2
p is not a DNA value
x is not a DNA value
o is not a DNA value
n is not a DNA value
w is not a DNA value
s is not a DNA value