In [46]:
#takes .pwm files downloaded from yetfasco and converts to beeml format
import glob
import os
with open("pwm_beeml.txt", "w+") as outfile:
for fname in glob.glob('/Users/bergeric/Downloads/1.02/ALIGNED_ENOLOGO_FORMAT_PWMS/*'):
fname2 = (os.path.splitext(os.path.basename(fname)))
header = '# {}'.format(fname2[0])
filename = "%s" % fname
with open(filename) as f:
matrix = f.read()
s = "\n"
joined = s.join((header, matrix))
outfile.write(joined)
In [ ]: