Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Bio.Seq import Seq
- from Bio import motifs
- import random as rd
- nuc = 'ATCG'
- s = ''
- N = 50
- for i in range(10):
- s += rd.choice(nuc)
- seq = []
- for i in range(1000):
- ss = ''
- for i in range(len(s)):
- odd = rd.randint(1, 101)
- if(odd>N): ss+=s[i:i+1]
- else:
- nuc_temp = nuc.replace(s[i:i+1], '')
- ss+=rd.choice(nuc_temp)
- seq.append(ss)
- #print(ss)
- print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n')
- m = motifs.create(seq)
- pwm = m.counts.normalize(pseudocounts=0.5)
- print(pwm)
- conts = pwm.degenerate_consensus
- print(conts)
- gc = []
- for i in range(len(conts)):
- k = 0
- if not (conts[i]== 'A' or conts[i] == 'T' or conts[i]== 'C' or conts[i]== 'G'):
- k=k+1
- gc.append(k)
- print("количество деградировавших нуклеотидов", gc)
- file = open('mish1.txt', 'w')
- for i in range(len(seq)):
- file.write(seq[i]+'\n')
- file.close()
- file = open('mish1.txt', 'r')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement