Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Sequence:
- def generate(length, alphabet):
- AllSeq = []
- for j in range(length):
- number = random.randint(0,len(alphabet)-1)
- AllSeq.append(alphabet[number])
- return AllSeq
- def Dictionary(Seq):
- SequenceOfNucleotides = []
- CountA = 0
- CountC = 0
- CountT = 0
- CountG = 0
- for j in range(len(Seq)):
- if(Seq[j] == 'A'):
- CountA = CountA + 1
- if(Seq[j] == 'C'):
- CountC = CountC + 1
- if(Seq[j] == 'T'):
- CountT = CountT + 1
- if(Seq[j] == 'G'):
- CountG = CountG + 1
- Dictionary = dict(A=0, C=0, T=0, G=0)
- Dictionary['A'] = CountA
- Dictionary['C'] = CountC
- Dictionary['T'] = CountT
- Dictionary['G'] = CountG
- SequenceOfNucleotides.append(Dictionary)
- return SequenceOfNucleotides
- #def getDictionary():
- #Рабочая область
- Lists = ['A','C','T','G']
- Length = int(input('Введите длину последовательности:'))
- Seq = Sequence.generate(Length,Lists)
- Dictionary = Sequence.Dictionary(Seq)
- print(Dictionary)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement