Skip to content

Commit

Permalink
Added HL option for heterozygosity
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarleigh committed Jan 22, 2024
1 parent 5b09fa6 commit 1460ebd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/Heterozygosity.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Heterozygosity <- function(data, pops, statistic = 'all', missing_value = NA, wr
Individuals <- nrow(Loc_HL_mat)

# Get the number of loci
Nloc <- ncol(Loc_IR_mat)/2
Nloc <- ncol(Loc_HL_mat)/2

# Set up a results table
res_tab <- data.frame(HL = matrix(NA, nrow = Individuals, ncol = 1), row.names = Inds)
Expand Down Expand Up @@ -376,21 +376,21 @@ Heterozygosity <- function(data, pops, statistic = 'all', missing_value = NA, wr
}
}

res_tab[i] <- sum.Eh / (sum.Eh + sum.Ej)
res_tab[i,1] <- sum.Eh / (sum.Eh + sum.Ej)

}

return(res_tab)

}

HL_perind <- HL(Dat)

}

Output <- list(Obs_Het_res_avg, ObsHet_res_perloc, ExpHet_res_avg, ExpHet_res_perloc,
PropHt_res_perind, StHe_res_perind, StHo_res_perind, IR_perind)
PropHt_res_perind, StHe_res_perind, StHo_res_perind, IR_perind, HL_perind)

names(Output) <- c("Ho_perpop", "Ho_perloc", "He_perpop", "He_perloc", "PHt", "StHe", "StHo")
names(Output) <- c("Ho_perpop", "Ho_perloc", "He_perpop", "He_perloc", "PHt", "StHe", "StHo", "IR", "HL")

# Set list of possible statistics
Stat <- c("Ho", "He", "PHt", "StHe", "StHo", "IR", "HL")
Expand Down

0 comments on commit 1460ebd

Please sign in to comment.