Esempio n. 1
0
def getSingleMutants(genotype):

  muts = []

  seq = genotype.sequence
  for pos in range(len(seq)):
    for inst in 'abcdefghijklmnopqrstuvwxyz':
      if seq[pos] != inst:
        mutSeq = avida.mutate(seq, pos, inst)
        muts.append(Genotype(mutSeq, genotype))

  return muts
Esempio n. 2
0
def getMutants(genotype, m, n):

  mutants = []

  for i in range(m):

    # Initialize mutant to-be
    mutant = Genotype(genotype, genotype)

    for j in range(n):
    
      # Get a random position and instruction (except on previous mutation)
      randPos = avida.rand_pos_except(mutant.sequence, mutant.mutations())
      randInst = avida.rand_inst_except(mutant.sequence[randPos])

      # Mutate the genotype
      mutant.sequence = avida.mutate(mutant.sequence, randPos, randInst)

    mutants.append(mutant)

  return mutants