Commits

Giovanni Marco Dall'Olio  committed a0958b0

ADD: using GenomeBase instead of G2DList, and minor fixes

  • Participants
  • Parent commits 6e9c04c

Comments (0)

Files changed (1)

File src/genetics.py

 
 import pyevolve
 from pyevolve import GSimpleGA, GenomeBase, Consts, DBAdapters
-from pyevolve.G2DList import G2DList
 from launch_query import launch_query, print_fancy_results, get_key, GoogleQueryLimitsExceeded
 import random
 import re
         rep += ' '.join(list.__repr__(self))
         return rep
 
-class GoogleQueryGenome(pyevolve.G2DList.G2DList):
+class GoogleQueryGenome(pyevolve.GenomeBase.GenomeBase):
     """
     diploid genome, each chromosome is a string.
     """
     def __init__(self, seqlength, cloning=False):
        """
        """
-       pyevolve.G2DList.G2DList.__init__(self, 2, seqlength)
+       pyevolve.GenomeBase.GenomeBase.__init__(self)
+       self.seqlength = seqlength
        self.genomeList = [GoogleQueryChromosome([None])*seqlength, GoogleQueryChromosome([None])*seqlength]
 
        if not cloning:
     def __str__(self):
         """
         """
-        rep = "CHROMOSOME1:"
+        rep = "CHROMOSOME1: "
         rep += str(self.genomeList[0])
-        rep += "CHROMOSOME2:"
+        rep += "CHROMOSOME2: "
         rep += str(self.genomeList[1])
 #        rep = term.render("${BOLD}CHROMOSOME1:${NORMAL}"),
 #        rep += term.render(self.genomeList[0])
     genome = GoogleQueryGenome(seq_length)
     print genome
     genome.evaluator.set(count_results_by_query)
-    genome.setParams(rangemin=rangemin, rangemax=rangemax)
+#    genome.setParams(rangemin=rangemin, rangemax=rangemax)
     genome.initialize()
     ga = GSimpleGA.GSimpleGA(genome)
     ga.setGenerations(ngenerations)