<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>nbproject/project.properties</filename>
    </added>
    <added>
      <filename>nbproject/project.xml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -138,7 +138,7 @@ class LabController &lt; ApplicationController
         :het =&gt; @species.phenotype_from(character, 1,0).to_s, 
         :rec =&gt; @species.phenotype_from(character, 0,0).to_s,
         :location =&gt; @species.position_of(@species.gene_number_of(character)), 
-        :sex_linked =&gt; @species.is_sex_linked?(character) ? &quot;yes&quot; : &quot;no&quot;,
+        :sex_linked =&gt; @species.sex_linked?(character) ? &quot;yes&quot; : &quot;no&quot;,
         :randomizable =&gt; @species.alternate_phenotypes(character) != [] ? &quot;yes&quot; : &quot;no&quot; }
     end
   end</diff>
      <filename>app/controllers/lab_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,11 @@
 class Genotype &lt; ActiveRecord::Base
+  belongs_to :fly
+  
+  def genotype_for?(character)
+    gene_number == species.gene_number_of(character)
+  end
+  
+  def species
+    fly.species
+  end
 end</diff>
      <filename>app/models/genotype.rb</filename>
    </modified>
    <modified>
      <diff>@@ -38,8 +38,12 @@ class Species
     @gene_numbers[character]
   end
   
-  def is_sex_linked?(character)
-    character != :sex and position_of(gene_number_of(character)) == 0.0
+  def sex_linked?(character)
+    character != :sex and position_of(gene_number_of(character)) == position_of(gene_number_of(:sex))
+  end
+  
+  def sex_linked_characters
+    @sex_linked_character ||= @characters.select { |c| sex_linked?(c) }
   end
   
   def position_of(gene_number)</diff>
      <filename>app/models/species.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,10 +11,10 @@ class Vial &lt; ActiveRecord::Base
   validates_presence_of :label
   validates_presence_of :rack_id
   validates_numericality_of :number_of_requested_flies, :only_integer =&gt; true,
-      :on =&gt; :create
+    :on =&gt; :create
   validates_inclusion_of :number_of_requested_flies, :in =&gt; 0..255,
-      :message =&gt; &quot;should be between 0 and 255&quot;,
-      :on =&gt; :create
+    :message =&gt; &quot;should be between 0 and 255&quot;,
+    :on =&gt; :create
   validates_presence_of :mom_id, :if =&gt; Proc.new { |vial| vial.offspring_vial? }
   validates_presence_of :dad_id, :if =&gt; Proc.new { |vial| vial.offspring_vial? }
 
@@ -22,7 +22,7 @@ class Vial &lt; ActiveRecord::Base
     vial = Vial.new(vial_params)
     allele_frequencies[:sex] = 0.5 unless allele_frequencies[:sex]
     vial.species.characters.each do |character|
-      allele_frequencies[character] = 0.13 + (rand 37) / 100.0 unless allele_frequencies[character]
+      allele_frequencies[character] = 0.13 + (rand * (0.50 - 0.13)) unless allele_frequencies[character]
     end
     if vial.save
       vial.fill_from_field(bit_generator, allele_frequencies)
@@ -96,8 +96,8 @@ class Vial &lt; ActiveRecord::Base
   
   def combinations_of_phenotypes(characters = species.characters)
     cartesian_product( characters.collect do |character| 
-      phenotypes = phenotypes_for_table(character)
-    end )
+        phenotypes_for_table(character)
+      end )
   end
   
   def number_of_flies (characters, phenotypes)
@@ -136,9 +136,9 @@ class Vial &lt; ActiveRecord::Base
     species.phenotypes(row_character).each do |row_phenotype|
       species.phenotypes(column_character).each do |column_phenotype|
         key = renamed_phenotype(row_character, row_phenotype).to_s + &quot;$&quot; + 
-            renamed_phenotype(column_character, column_phenotype).to_s
+          renamed_phenotype(column_character, column_phenotype).to_s
         counts[key] = number_of_flies([row_character, column_character], 
-            [row_phenotype, column_phenotype])
+          [row_phenotype, column_phenotype])
       end
     end
     counts
@@ -147,7 +147,7 @@ class Vial &lt; ActiveRecord::Base
   def renamed_phenotype(character, phenotype)
     phenotype_alternate = owner.phenotype_alternates.select do |pa|
       pa.scenario_id == owner.current_scenario.id and 
-          pa.affected_character.intern == character and pa.original_phenotype.intern == phenotype
+        pa.affected_character.intern == character and pa.original_phenotype.intern == phenotype
     end.first
     if phenotype_alternate
       phenotype_alternate.renamed_phenotype.intern
@@ -158,23 +158,28 @@ class Vial &lt; ActiveRecord::Base
 
   def fill_from_field(bit_generator, allele_frequencies)
     number_of_requested_flies.times do |i|
-       new_fly = Fly.create!
-       species.characters.each do |character|
-         if character == :sex # could this be handled better?
-           new_fly.genotypes &lt;&lt; Genotype.create!(:fly_id =&gt; new_fly.id, :gene_number =&gt; species.gene_number_of(:sex), 
-               :mom_allele =&gt; 1, :dad_allele =&gt; bit_generator.random_bit(allele_frequencies[:sex]))
-         else
-           new_fly.genotypes &lt;&lt; Genotype.create!(:fly_id =&gt; new_fly.id, :gene_number =&gt; species.gene_number_of(character), 
-               :mom_allele =&gt; bit_generator.random_bit(allele_frequencies[character]), 
-               :dad_allele =&gt; bit_generator.random_bit(allele_frequencies[character]))
-         end
-       end
-       species.characters.each do |character|
-         if species.is_sex_linked?(character) and new_fly.male?
-           new_fly.genotypes.select { |g| g.gene_number == species.gene_number_of(character) }.first.dad_allele = 0
-         end                          # this assumes that 0 represents recessiveness... and some other things
-       end
-       flies &lt;&lt; new_fly
+      new_fly = Fly.create!
+      species.characters.each do |character|
+        if character == :sex
+          new_fly.genotypes &lt;&lt; Genotype.create!(:fly_id =&gt; new_fly.id,
+            :gene_number =&gt; species.gene_number_of(:sex), 
+            :mom_allele =&gt; 1,
+            :dad_allele =&gt; bit_generator.random_bit(allele_frequencies[:sex]))
+        else
+          new_fly.genotypes &lt;&lt; Genotype.create!(:fly_id =&gt; new_fly.id,
+            :gene_number =&gt; species.gene_number_of(character), 
+            :mom_allele =&gt; bit_generator.random_bit(allele_frequencies[character]), 
+            :dad_allele =&gt; bit_generator.random_bit(allele_frequencies[character]))
+        end
+      end
+      if new_fly.male?
+        species.sex_linked_characters.each do |character|
+          genotype = new_fly.genotypes.detect { |g| g.genotype_for?(character) }
+          genotype.dad_allele = 0
+          genotype.save!
+        end
+      end
+      flies &lt;&lt; new_fly
     end
     self
   end</diff>
      <filename>app/models/vial.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,19 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 class GenotypeTest &lt; Test::Unit::TestCase
-  fixtures :genotypes
+  fixtures :genotypes, :flies, :vials
 
-  # Replace this with your real tests.
-  def test_truth
-    assert true
+  def test_belongs_to_fly
+    assert_equal flies(:fly_00), genotypes(:fly_00_eye_color).fly
+  end
+  
+  def test_genotype_for?
+    assert  genotypes(:fly_00_eye_color).genotype_for?(:&quot;eye color&quot;)
+    assert !genotypes(:fly_00_eye_color).genotype_for?(:antenna)
+    assert !genotypes(:fly_00_eye_color).genotype_for?(:sex)
+
+    assert !genotypes(:fly_00_antenna).genotype_for?(:&quot;eyecolor&quot;)
+    assert  genotypes(:fly_00_antenna).genotype_for?(:antenna)
+    assert !genotypes(:fly_00_antenna).genotype_for?(:sex)
   end
 end</diff>
      <filename>test/unit/genotype_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,14 +62,19 @@ class SpeciesTest &lt; Test::Unit::TestCase
     # is it ok to get negatives when the gene_numbers are backwards?
   end
   
-  def test_is_sex_linked?
-    assert !Species.singleton.is_sex_linked?(:&quot;eye color&quot;)
-    assert !Species.singleton.is_sex_linked?(:wings)
-    assert !Species.singleton.is_sex_linked?(:legs)
-    assert !Species.singleton.is_sex_linked?(:sex)
-    assert !Species.singleton.is_sex_linked?(:seizure)
+  def test_sex_linked?
+    assert !Species.singleton.sex_linked?(:&quot;eye color&quot;)
+    assert !Species.singleton.sex_linked?(:wings)
+    assert !Species.singleton.sex_linked?(:legs)
+    assert !Species.singleton.sex_linked?(:sex)
+    assert !Species.singleton.sex_linked?(:seizure)
     
-    assert Species.singleton.is_sex_linked?(:antenna)
+    assert Species.singleton.sex_linked?(:antenna)
+  end
+  
+  def test_sex_linked
+    assert_equal [:antenna], Species.singleton.sex_linked_characters
+    assert_equal [:antenna], Species.singleton.sex_linked_characters, &quot;shouldn't break with caching&quot;
   end
   
 end
\ No newline at end of file</diff>
      <filename>test/unit/species_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,16 +21,16 @@ class VialTest &lt; Test::Unit::TestCase
   def test_number_requested_validations
     [&quot;4&quot;, &quot;0&quot;, &quot;255&quot;].each do |number|
       vial = Vial.new(:label =&gt; 'foo', :rack_id =&gt; 1,
-                      :number_of_requested_flies =&gt; number
-                      )
+        :number_of_requested_flies =&gt; number
+      )
       assert  vial.valid?, &quot;should be valid&quot;
       assert !vial.errors.invalid?(:number_of_requested_flies)
     end
         
     ['xxx', '-4', '-1', '256', '888'].each do |number|
       vial = Vial.new(:label =&gt; 'foo', :rack_id =&gt; 1,
-                      :number_of_requested_flies =&gt; number
-                      )
+        :number_of_requested_flies =&gt; number
+      )
       assert !vial.valid?
       assert  vial.errors.invalid?(:number_of_requested_flies)
     end
@@ -59,7 +59,7 @@ class VialTest &lt; Test::Unit::TestCase
     assert_equal 0, vials(:vial_empty).flies.size, &quot;should be no flies&quot;
     assert_equal [flies(:fly_01)].to_set, vials(:vial_with_a_fly).flies.to_set
     assert_equal [flies(:fly_00), flies(:fly_10), flies(:fly_11), flies(:bob)].to_set,
-        vials(:vial_with_many_flies).flies.to_set 
+      vials(:vial_with_many_flies).flies.to_set 
   end
   
   def test_count_of_flies
@@ -101,24 +101,24 @@ class VialTest &lt; Test::Unit::TestCase
   
   def test_flies_are_destroyed_along_with_vial
     assert_dependents_destroyed(Vial, Fly, :foreign_key =&gt; &quot;vial_id&quot;, 
-        :fixture_id =&gt; 6, :number_of_dependents =&gt; 2)
+      :fixture_id =&gt; 6, :number_of_dependents =&gt; 2)
   end
   
   def test_combinations_of_phenotypes
     assert_equal [:sex, :&quot;eye color&quot;, :wings, :legs, :antenna, :seizure], vials(:vial_one).species.characters
     assert_equal cartesian_product([[:female, :male],
-                                   [:red, :white], 
-                                   [:curly, :straight],
-                                   [:hairy, :smooth],
-                                   [:long, :short],
-                                   [:&quot;20% seizure&quot;, :&quot;40% seizure&quot;, :&quot;no seizure&quot;]]),
-                                   vials(:vial_one).combinations_of_phenotypes
+        [:red, :white], 
+        [:curly, :straight],
+        [:hairy, :smooth],
+        [:long, :short],
+        [:&quot;20% seizure&quot;, :&quot;40% seizure&quot;, :&quot;no seizure&quot;]]),
+      vials(:vial_one).combinations_of_phenotypes
     assert_equal cartesian_product([[:female, :male],
-                                   [:red, :white]]),
-                                   vials(:vial_one).combinations_of_phenotypes([:sex, :&quot;eye color&quot;])
+        [:red, :white]]),
+      vials(:vial_one).combinations_of_phenotypes([:sex, :&quot;eye color&quot;])
     assert_equal cartesian_product([[:red, :white],
-                                   [:hairy, :smooth]]),
-                                   vials(:vial_one).combinations_of_phenotypes([:&quot;eye color&quot;, :legs])
+        [:hairy, :smooth]]),
+      vials(:vial_one).combinations_of_phenotypes([:&quot;eye color&quot;, :legs])
   end
 
   def test_phenotypes_for_table
@@ -154,10 +154,10 @@ class VialTest &lt; Test::Unit::TestCase
   
   def test_collect_four_flies_from_field
     new_vial = Vial.collect_from_field({
-                  :label =&gt; &quot;four fly vial&quot;, :rack_id =&gt; 1,
-                  :number_of_requested_flies =&gt; &quot;4&quot; 
-                  },
-                  CookedBitGenerator.new([1]))
+        :label =&gt; &quot;four fly vial&quot;, :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; &quot;4&quot; 
+      },
+      CookedBitGenerator.new([1]))
     assert_equal(([:female] * 4), phenotypes_of(new_vial, :sex))
     assert_equal(([:red] * 4), phenotypes_of(new_vial, :&quot;eye color&quot;))
     assert_equal(([:straight] * 4), phenotypes_of(new_vial, :wings))
@@ -167,73 +167,89 @@ class VialTest &lt; Test::Unit::TestCase
   
   def test_collect_nine_flies_from_field
     new_vial = Vial.collect_from_field({
-                 :label =&gt; &quot;nine fly vial&quot;, :rack_id =&gt; 1,
-                 :number_of_requested_flies =&gt; &quot;9&quot; },
-                 CookedBitGenerator.new([0, 1, 0, 0]))
+        :label =&gt; &quot;nine fly vial&quot;, :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; &quot;9&quot; },
+      CookedBitGenerator.new([0, 1, 0, 0]))
     assert_equal_set(([:male] * 7 + [:female] * 2), 
-        new_vial.flies.map {|fly| fly.phenotype(:sex)})
+      new_vial.flies.map {|fly| fly.phenotype(:sex)})
     assert_equal_set(([:red] * 5 + [:white] * 4),
-        new_vial.flies.map {|fly| fly.phenotype(:&quot;eye color&quot;)})
+      new_vial.flies.map {|fly| fly.phenotype(:&quot;eye color&quot;)})
     assert_equal_set(([:straight] * 4 + [:curly] * 5),
-        new_vial.flies.map {|fly| fly.phenotype(:wings)})
+      new_vial.flies.map {|fly| fly.phenotype(:wings)})
     assert_equal_set(([:hairy] * 5 + [:smooth] * 4),
-        new_vial.flies.map {|fly| fly.phenotype(:legs)})
+      new_vial.flies.map {|fly| fly.phenotype(:legs)})
     assert_equal_set(([:long] * 4 + [:short] * 5),
-        new_vial.flies.map {|fly| fly.phenotype(:antenna)})
+      new_vial.flies.map {|fly| fly.phenotype(:antenna)})
     assert_equal 2, new_vial.flies_of_type([:sex, :legs],[:female, :smooth]).size
     assert_equal 1, new_vial.pedigree_number
   end
   
   def test_collecting_field_vial_with_allele_frequencies
     recessive_vial = Vial.collect_from_field({
-                        :label =&gt; &quot;white-eyed curly and shaven flies&quot;,
-                        :rack_id =&gt; 1,
-                        :number_of_requested_flies =&gt; &quot;14&quot; },
-                        RandomBitGenerator.new,
-                        { :&quot;eye color&quot; =&gt; 0.0, :wings =&gt; 0.0, :legs =&gt; 0.0} )
+        :label =&gt; &quot;white-eyed curly and shaven flies&quot;,
+        :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; &quot;14&quot; },
+      RandomBitGenerator.new,
+      { :&quot;eye color&quot; =&gt; 0.0, :wings =&gt; 0.0, :legs =&gt; 0.0} )
     assert_equal 14, recessive_vial.number_of_flies([:&quot;eye color&quot;],[:white])
     assert_equal 14, recessive_vial.number_of_flies([:wings],[:curly])
     assert_equal 14, recessive_vial.number_of_flies([:legs],[:smooth])
     
     dominant_vial = Vial.collect_from_field({
-                       :label =&gt; &quot;red-eyed gruff flies&quot;, :rack_id =&gt; 1,
-                       :number_of_requested_flies =&gt; '15' },
-                       RandomBitGenerator.new,
-                       { :&quot;eye color&quot; =&gt; 1.0, :wings =&gt; 1.0, :legs =&gt; 1.0} )
+        :label =&gt; &quot;red-eyed gruff flies&quot;, :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; '15' },
+      RandomBitGenerator.new,
+      { :&quot;eye color&quot; =&gt; 1.0, :wings =&gt; 1.0, :legs =&gt; 1.0} )
     assert_equal 15, dominant_vial.number_of_flies([:&quot;eye color&quot;],[:red])
     assert_equal 15, dominant_vial.number_of_flies([:wings],[:straight])
     assert_equal 15, dominant_vial.number_of_flies([:legs],[:hairy])
     
     strange_male_vial = Vial.collect_from_field({
-                           :label =&gt; &quot;wasp flies&quot;, :rack_id =&gt; 1,
-                           :number_of_requested_flies =&gt; 16 },
-                           RandomBitGenerator.new,
-                           { :&quot;eye color&quot; =&gt; 0.0, :sex =&gt; 0.0} )
+        :label =&gt; &quot;wasp flies&quot;, :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; 16 },
+      RandomBitGenerator.new,
+      { :&quot;eye color&quot; =&gt; 0.0, :sex =&gt; 0.0} )
     assert_equal 16, strange_male_vial.number_of_flies([:&quot;eye color&quot;],[:white])
     assert_equal 16, strange_male_vial.number_of_flies([:sex],[:male])
   end
   
-  def test_sex_linkage_in_field_vials
+  def test_sex_linkage_in_field_vials_with_males
     antenna_flies_vial = Vial.collect_from_field({
-                            :label =&gt; &quot;flies with antenna&quot;, :rack_id =&gt; 1,
-                            :number_of_requested_flies =&gt; &quot;11&quot; },
-                            RandomBitGenerator.new,
-                            { :sex =&gt; 0.0 } )
+        :label =&gt; &quot;flies with antenna&quot;, :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; &quot;11&quot; },
+      RandomBitGenerator.new,
+      { :sex =&gt; 0.0, :antenna =&gt; 1.0 } )
+                          
+    antenna_flies_vial.reload
     antenna_flies_vial.flies.each do |fly|
-      fly_dad_allele = fly.genotypes.select do |g| 
-        g.gene_number == fly.species.gene_number_of(:antenna) 
-      end.first.dad_allele
-      assert_equal 0, fly_dad_allele
+      assert fly.male?
+      assert_equal 0, 
+        fly.genotypes.detect { |g| g.genotype_for?(:antenna) }.dad_allele
+    end
+  end
+  
+  def test_sex_linkage_in_field_vials_with_females
+    antenna_flies_vial = Vial.collect_from_field({
+        :label =&gt; &quot;flies with antenna&quot;, :rack_id =&gt; 1,
+        :number_of_requested_flies =&gt; &quot;11&quot; },
+      RandomBitGenerator.new,
+      { :sex =&gt; 1.0, :antenna =&gt; 1.0 } )
+                          
+    antenna_flies_vial.reload
+    antenna_flies_vial.flies.each do |fly|
+      assert fly.female?
+      assert_equal 1, 
+        fly.genotypes.detect { |g| g.genotype_for?(:antenna) }.dad_allele
     end
   end
   
   def test_making_three_babies_and_a_vial
     new_vial = Vial.make_babies_and_vial({
-                  :label =&gt; &quot;three fly syblings&quot;, :rack_id =&gt; 1, 
-                  :mom_id =&gt; &quot;6&quot;, :dad_id =&gt; &quot;1&quot;,
-                  :number_of_requested_flies =&gt; &quot;3&quot;,
-                  :creator =&gt; users(:steve) }, 
-                  CookedBitGenerator.new([0]) )
+        :label =&gt; &quot;three fly syblings&quot;, :rack_id =&gt; 1, 
+        :mom_id =&gt; &quot;6&quot;, :dad_id =&gt; &quot;1&quot;,
+        :number_of_requested_flies =&gt; &quot;3&quot;,
+        :creator =&gt; users(:steve) }, 
+      CookedBitGenerator.new([0]) )
                   
     assert new_vial.valid?
     assert_equal(([:female] * 3), phenotypes_of(new_vial, :sex))
@@ -245,50 +261,50 @@ class VialTest &lt; Test::Unit::TestCase
   
   def test_making_seven_babies_and_a_vial
     new_vial = Vial.make_babies_and_vial({
-                  :label =&gt; &quot;seven fly syblings&quot;, :rack_id =&gt; 1,
-                  :mom_id =&gt; &quot;4&quot;, :dad_id =&gt; &quot;3&quot;,
-                  :number_of_requested_flies =&gt; &quot;7&quot;,
-                  :creator =&gt; users(:steve) },
-                  CookedBitGenerator.new([0,1,1,0,0,0,1]) )
+        :label =&gt; &quot;seven fly syblings&quot;, :rack_id =&gt; 1,
+        :mom_id =&gt; &quot;4&quot;, :dad_id =&gt; &quot;3&quot;,
+        :number_of_requested_flies =&gt; &quot;7&quot;,
+        :creator =&gt; users(:steve) },
+      CookedBitGenerator.new([0,1,1,0,0,0,1]) )
                   
     assert new_vial.valid?
     assert_equal_set(([:male] * 3 + [:female] * 4), 
-        new_vial.flies.map {|fly| fly.phenotype(:sex)})
+      new_vial.flies.map {|fly| fly.phenotype(:sex)})
     assert_equal_set(([:red] * 7 + [:white] * 0),
-        new_vial.flies.map {|fly| fly.phenotype(:&quot;eye color&quot;)})
+      new_vial.flies.map {|fly| fly.phenotype(:&quot;eye color&quot;)})
     assert_equal_set(([:straight] * 3 + [:curly] * 4),
-        new_vial.flies.map {|fly| fly.phenotype(:wings)})
+      new_vial.flies.map {|fly| fly.phenotype(:wings)})
     assert_equal_set(([:hairy] * 4 + [:smooth] * 3),
-        new_vial.flies.map {|fly| fly.phenotype(:legs)})
+      new_vial.flies.map {|fly| fly.phenotype(:legs)})
     assert_equal_set(([:long] * 7 + [:short] * 0),
-        new_vial.flies.map {|fly| fly.phenotype(:antenna)})
+      new_vial.flies.map {|fly| fly.phenotype(:antenna)})
     assert_equal_set(([:&quot;no seizure&quot;] * 1 + [:&quot;20% seizure&quot;] * 4 + [:&quot;40% seizure&quot;] * 2),
-        new_vial.flies.map {|fly| fly.phenotype(:seizure)})
+      new_vial.flies.map {|fly| fly.phenotype(:seizure)})
     assert_equal 2, new_vial.flies_of_type([:wings, :legs],[:curly, :smooth]).size
     assert_equal 2, new_vial.pedigree_number
   end
   
   def test_offspring_vial?
     new_vial = Vial.make_babies_and_vial({
-                  :label =&gt; &quot;three fly syblings&quot;, :rack_id =&gt; 1, 
-                  :mom_id =&gt; &quot;6&quot;, :dad_id =&gt; &quot;1&quot;,
-                  :number_of_requested_flies =&gt; &quot;3&quot; }, 
-                  CookedBitGenerator.new([0]) )
+        :label =&gt; &quot;three fly syblings&quot;, :rack_id =&gt; 1, 
+        :mom_id =&gt; &quot;6&quot;, :dad_id =&gt; &quot;1&quot;,
+        :number_of_requested_flies =&gt; &quot;3&quot; }, 
+      CookedBitGenerator.new([0]) )
     assert new_vial.offspring_vial?,
-        &quot;should be an offspring vial because of the method called to create it&quot;
+      &quot;should be an offspring vial because of the method called to create it&quot;
 
     new_vial = Vial.make_babies_and_vial({
-                  :label =&gt; &quot;seven fly syblings&quot;, :rack_id =&gt; 1,
-                  :mom_id =&gt; &quot;4&quot;, :dad_id =&gt; &quot;3&quot;,
-                  :number_of_requested_flies =&gt; &quot;7&quot; },
-                  CookedBitGenerator.new([0,1,1,0,0,0,1]) )
+        :label =&gt; &quot;seven fly syblings&quot;, :rack_id =&gt; 1,
+        :mom_id =&gt; &quot;4&quot;, :dad_id =&gt; &quot;3&quot;,
+        :number_of_requested_flies =&gt; &quot;7&quot; },
+      CookedBitGenerator.new([0,1,1,0,0,0,1]) )
     assert new_vial.offspring_vial?,
-        &quot;should be an offspring vial because of the method called to create it&quot;
+      &quot;should be an offspring vial because of the method called to create it&quot;
     
     assert !vials(:vial_one).offspring_vial?
     assert !vials(:vial_with_many_flies).offspring_vial?
     assert  vials(:destroyable_vial).offspring_vial?,
-        &quot;should give sane answer for vials from database with parents&quot;
+      &quot;should give sane answer for vials from database with parents&quot;
   end
   
   def test_sex_linkage_of_antenna
@@ -311,10 +327,10 @@ class VialTest &lt; Test::Unit::TestCase
   
   def test_make_babies_and_vial_fails_missing_data_validations
     vial = Vial.make_babies_and_vial({
-          :label =&gt; &quot;failure&quot;, :rack_id =&gt; 1, 
-          :mom_id =&gt; nil, :dad_id =&gt; nil,
-          :number_of_requested_flies =&gt; -12,
-          :creator =&gt; users(:steve) })
+        :label =&gt; &quot;failure&quot;, :rack_id =&gt; 1, 
+        :mom_id =&gt; nil, :dad_id =&gt; nil,
+        :number_of_requested_flies =&gt; -12,
+        :creator =&gt; users(:steve) })
     assert !vial.valid?
     assert  vial.errors.invalid?(:number_of_requested_flies)
     assert  vial.errors.invalid?(:mom_id), &quot;mom should not be missing&quot;
@@ -323,9 +339,9 @@ class VialTest &lt; Test::Unit::TestCase
     
   def test_make_babies_and_vial_fails_missing_creator
     vial = Vial.make_babies_and_vial({
-          :label =&gt; &quot;failure&quot;, :rack_id =&gt; 1, 
-          :mom_id =&gt; 6, :dad_id =&gt; 1,
-          :number_of_requested_flies =&gt; 12 })
+        :label =&gt; &quot;failure&quot;, :rack_id =&gt; 1, 
+        :mom_id =&gt; 6, :dad_id =&gt; 1,
+        :number_of_requested_flies =&gt; 12 })
     assert !vial.valid?
     assert  vial.errors.invalid?(:creator)
   end
@@ -333,30 +349,30 @@ class VialTest &lt; Test::Unit::TestCase
   def test_make_babies_and_vial_fails_when_creator_does_not_own_rack
     assert_raise ApplicationController::InvalidOwner do
       Vial.make_babies_and_vial({
-            :label =&gt; &quot;failure&quot;, :rack_id =&gt; 1, 
-            :mom_id =&gt; 8, :dad_id =&gt; 9,
-            :number_of_requested_flies =&gt; 12,
-            :creator =&gt; users(:jeremy) })
+          :label =&gt; &quot;failure&quot;, :rack_id =&gt; 1, 
+          :mom_id =&gt; 8, :dad_id =&gt; 9,
+          :number_of_requested_flies =&gt; 12,
+          :creator =&gt; users(:jeremy) })
     end
   end
   
   def test_make_babies_and_vial_fails_when_creator_does_not_own_mom
     assert_raise ApplicationController::InvalidOwner do
       Vial.make_babies_and_vial({
-            :label =&gt; &quot;failure&quot;, :rack_id =&gt; 4, 
-            :mom_id =&gt; 4, :dad_id =&gt; 9,
-            :number_of_requested_flies =&gt; 12,
-            :creator =&gt; users(:jeremy) })
+          :label =&gt; &quot;failure&quot;, :rack_id =&gt; 4, 
+          :mom_id =&gt; 4, :dad_id =&gt; 9,
+          :number_of_requested_flies =&gt; 12,
+          :creator =&gt; users(:jeremy) })
     end
   end
   
   def test_make_babies_and_vial_fails_when_creator_does_not_own_dad
     assert_raise ApplicationController::InvalidOwner do
       Vial.make_babies_and_vial({
-            :label =&gt; &quot;failure&quot;, :rack_id =&gt; 4, 
-            :mom_id =&gt; 8, :dad_id =&gt; 1,
-            :number_of_requested_flies =&gt; 12,
-            :creator =&gt; users(:jeremy) })
+          :label =&gt; &quot;failure&quot;, :rack_id =&gt; 4, 
+          :mom_id =&gt; 8, :dad_id =&gt; 1,
+          :number_of_requested_flies =&gt; 12,
+          :creator =&gt; users(:jeremy) })
     end
   end
   </diff>
      <filename>test/unit/vial_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1b4e2d7b21b698a85ef36991d3aedce64e9d6719</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy D. Frens</name>
    <email>jdfrens@gmail.com</email>
  </author>
  <url>http://github.com/jdfrens/yags/commit/b6c6e735b7b94d45a53b5fbac286c745d3d03137</url>
  <id>b6c6e735b7b94d45a53b5fbac286c745d3d03137</id>
  <committed-date>2008-02-22T14:22:19-08:00</committed-date>
  <authored-date>2008-02-22T14:22:19-08:00</authored-date>
  <message>Fixed bug with sex-linked genotype (test didn't reload vial and genotype save was needed).
Refactored and cleaned up some of the code.
Added NetBeans configuration</message>
  <tree>38a8622e8701cedc92fda04363efc6af685e035a</tree>
  <committer>
    <name>Jeremy D. Frens</name>
    <email>jdfrens@gmail.com</email>
  </committer>
</commit>
