type=int,
                    default=5,
                    metavar='<int>',
                    help='sequences to generate [%(default)i]')
parser.add_argument('--iterations',
                    required=False,
                    type=int,
                    default=5,
                    metavar='<int>',
                    help='sequences to generate [%(default)i]')
arg = parser.parse_args()

n = arg.iterations
num_seq = arg.seqs
#creates the initial pwm
motif = motiflib.read_JASPAR(arg.file)
print('number of seqs', 'distance', sep=', ')
for i in range(1, num_seq + 1):
    distances = []
    for k in range(n):
        sites = []
        for l in range(i):
            #a single motif from the initial pwm
            site = motiflib.generate_site(motif)
            #sites is a list of all motifs generated
            sites.append(site)
        pwm = motiflib.new_pwm(sites)
        distance = motiflib.compare_motifs(motif, pwm)
        distances.append(distance)
    avg_distance = statistics.mean(distances)
    print(i, f'{avg_distance:.3f}', sep=', ')
Beispiel #2
0
	print('promoter_file','motif','number_of_sites','jaspar_file_info',\
	'jaspar_info_percentage','e_val','motif_score','motif_score_percentage',\
	'failure_rate','success_rate','false_positive_rate','false_negative',\
	'promoter_size','number_of_sequences','model','markov_order','iterations'\
	,'stdev(avg_eval)','stdev(avg_score)','stdev(avg_pscore)',\
	'stdev(avg_frate)','stdev(avg_srate)','stdev(avg_fprate)','stdev(avg_fn)'\
	,sep=', ')
else:
	#seq, motif,nsites,m_pos, m_strand,meme_wid,j_pos,j_strand,len(jpwm),p_val\
	#,score,p_score,meme_eval,fpos,0,posdis,fl,overlap,overlap_p,p,n,m,o
	print('file','sequence','motif','number_of_sites','meme_position', 'meme_strand'\
	,'meme_width','j_position','j_strand','j_width','p_value','score',\
	'score_percentage','e_value','false_pos','false_neg','positional_distance'\
	,'fail','overlap','overlap percentage', 'promoter length',\
	'number_of_sequences','model', 'markov_order','iterations',sep=', ')
jpwm = motiflib.read_JASPAR(arg.jasparfile)
bits, p_bits = motiflib.score_motifbit(jpwm)
for p in promoter:
	for n in numseq:
		for m in model:
			#for o in markov_order:
			if arg.condenseddata:
				final = []
			for r in range(iterations):
				#(p,n,m,o,r)
				#print('	ALL INFO !!!!!!!!!!!!!!!!')
				#print('r',r)
				promoter_file = memepipelib.generate_promoter_bg\
				(arg.jasparfile,p,n,freq,background,r+1,arg.condenseddata)
				#print('file',promoter_file)
				#print('')
Beispiel #3
0
directory = 'Jaspar'
model = ['zoops', 'oops', 'anr']

jasparfiles = os.listdir(directory)
jasparfiles.sort()
print('file',
      'length motif',
      'information in bits',
      'percentage bit score',
      'performance',
      'performance percentage',
      'model',
      sep=', ')
for fl in jasparfiles:
    filepath = f'Jaspar/{fl}'
    motif = motiflib.read_JASPAR(filepath)
    bits, p_bits = motiflib.score_motifbit(motif)
    for m in model:
        modscore = []
        modscorep = []
        for i in range(arg.numiterations):
            tmpfile = f'/tmp/testmotif{fl}_{i}.fa'
            cmd = f'python3 markov_motifapalooza.py --jasparfile {filepath} \
			--dnafile {arg.dnafile} --markov_order {o} --numseq {n} --seqlen {p} --freq {freq} > {tmpfile} '

            os.system(cmd)
            cmd = f'{arg.memepath} {tmpfile} -dna -markov_order {o} -mod {m}'
            os.system(cmd)
            memetxt = 'meme_out/meme.txt'
            motifs, motif_stats = motiflib.memepwm(memetxt)
            for mot in motifs: