Attribute VB_Name = "Module6" ' Subroutine Name: FindFather() ' Parameters Byval: row, leftColumn, rightColumn, lociNum ' Description: Determines father 's allele contribution. Public Sub FindFather(ByVal row, ByVal leftColumn, ByVal rightColumn, ByVal lociNum) ' [DECLARE VARIABLES] Dim allele1 As Variant, allele2 As Variant, colony As Variant Dim colonyColumn As Integer, alleleNum As Integer, counter As Integer Dim specialCase As String, nullAllele As String Dim message1 As String, message2 As String Dim oneMaternalAllele As Boolean ' [INITIALISE VARAIBLES] alleleNum = 1 colonyColumn = 1 colony = ActiveSheet.Cells(row, colonyColumn).Value specialCase = "*" ' The astrix is used to simplify the task of storing a 2 different alleles as the one element. ' Ie: The individual carries both parental alleles at a single locus. nullAllele = "." counter = 1 ' message1 and message2 is displayed on the screen to the user. message1 = "Some fathers contain incomplete genotypes over the loci sampled." message2 = " Would you like EzyMate to automatically condense all possible data in order to minimise the number of potential fathers?" Do allele1 = ActiveSheet.Cells(row, leftColumn).Value allele2 = ActiveSheet.Cells(row, rightColumn).Value If ((allele1 <> nullAllele) And (allele2 <> nullAllele)) Then ' The following IF-statement is written using the "next line" break for readability purposes only. If (((allele1 = queenArray(lociNum, alleleNum)) Or (allele1 = queenArray(lociNum, alleleNum + 1))) _ And ((allele2 = queenArray(lociNum, alleleNum)) Or (allele2 = queenArray(lociNum, alleleNum + 1)))) Then oneMaternalAllele = False Else oneMaternalAllele = True End If ' oneMaternalAllele refers to whether the worker contains one or two maternal alleles. ' IF-statement adds the appropriate allele to the fatherArray. Ie: the allele that the father ' contributed. If (oneMaternalAllele) Then If ((allele1 = queenArray(lociNum, alleleNum)) Or (allele1 = queenArray(lociNum, alleleNum + 1))) Then fatherArray(lociNum, counter) = allele2 Else fatherArray(lociNum, counter) = allele1 End If Else If (allele1 = allele2) Then fatherArray(lociNum, counter) = allele1 Else fatherArray(lociNum, counter) = specialCase End If End If ElseIf (inputRequired) Then inputRequired = False condense = MsgBox(message1 & message2, vbYesNo + vbQuestion, "Please select an option") End If counter = counter + 1 row = row + 1 Loop While Module2.CheckColony(row, colony, colonyColumn) End Sub ' Subroutine Name: PrintQueenGenotype() ' Parameters Byval: numberOfLoci ' Description: Displays Queen 's genotype. Public Sub PrintQueenGenotype(ByVal numOfLoci) ' [DECLARE VARIABLES] Dim row As Integer, column As Integer, queenColumn As Integer Dim count As Integer, counter As Integer, alleleNum As Integer ' [INITIALISE VARAIBLES] row = 3 column = 3 alleleNum = 1 queenColumn = 1 For counter = 1 To (alleleNum + 1) ActiveSheet.Cells(row, queenColumn).Select Selection.ColumnWidth = 24 ' Text size. ActiveCell.Value = "Queen Allele " & counter ActiveSheet.Cells(row, column).Select For count = 1 To numOfLoci ActiveCell.HorizontalAlignment = xlCenter ' Center value in cell. ActiveCell.Value = queenArray(count, counter) ' Places value of element into selected cell. ActiveCell.Offset(0, 2).Select Next count row = row + 1 Next counter End Sub