Displaying 1 result from an estimated 1 matches for "allele_f".
2007 Jan 21
2
efficient code. how to reduce running time?
...:", MAF));
# S: number of segregating sites
S = length(snp[1,]);
# N: number of samples
N = length(snp[,1]);
Dips = sample(1:N,N)
DipA = Dips[1:50]
DipB = Dips[51:100]
disnp = snp[DipA,]+snp[DipB,]
snp = as.data.frame(disnp, row.names=NULL);
N = length(snp[,1]);
# get allele freq for all SNPs
allele_f <- mean(snp[,1:S])/2;
print (allele_f);
sites = rfind(allele_f);
print(sites);
# collapse sites that have perfect correlation
newsites <- sites;
for (i in 1:(length(sites)-1))
{
for (j in (i+1):length(sites))
{
test = (snp[sites[i]] == snp[sites[j]])
if ( all(test) || all(!test)...