def serialize(self,population_size): """Print self out per ESTReMo's population serialization format""" print population_size for i in range(population_size): print i print len(self.motif) for site in self.motif: # TODO we should probably define the organism to # include the ncr. For now, randomize the rest of the # ncr print site + random_site(self.ncr_size - len(site)) print 1 if type(self.recognizer) is SLP else 2 # TODO needs to be generalized to MLPs! weights = concat(map(list,transpose(self.recognizer.input_layer))) print len(weights) for weight in weights: print weight
import sys,os print os.getcwd() print sys.path sys.path.append("data/estremo_motifs") sys.path.append("src/generate_coevolved_motifs/estremo_files") from Organism import Organism print sys.path from alpha_sweep_motifs import texts from estremo_utils import random_site orgs = map(lambda text:Organism(text,random_site(100000),overshooting=False), texts) motifs = [org.motif for org in orgs] if __name__ == "__main__": outfile = sys.argv[1] motif_strings = map("\n".join,motifs) with open(outfile,'w') as f: f.write("\n\n".join(motif_strings))