Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosemeis committed Feb 19, 2019
1 parent 5815621 commit 2cd0ee2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bed2npy.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def convertPlink_inner(G, D, S, N):
for c in tqdm(range(args.chunks), desc="Reading chunks"):
G_chunk = G[idx_split[c], :].compute().T
D[:, idx_split[c]] = convertPlink(G_chunk, args.t)
del G, G_chunk
del G, G_chunk

# Saving 8-bit integer matrix
np.save(args.o, D)
9 changes: 4 additions & 5 deletions flashpcangsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ def computeSVD(D, E, f, e, chunks, chunk_N, method, power):
for thread in threads:
thread.join()

U = None
return W, s
return W

# Update E directly from SVD
@jit("void(i1[:, :], f4[:, :], f4[:], f4[:, :], f4[:], f4[:, :], i8, i8)", nopython=True, nogil=True, cache=True)
Expand Down Expand Up @@ -300,13 +299,13 @@ def flashPCAngsd(D, f, e, K, F=None, Pvec=None, M=100, M_tole=1e-5, method="arpa
return V, s, U
else:
# Estimate initial individual allele frequencies
W, s = computeSVD(D, E, f, e, chunks, chunk_N, method, svd_iter)
W = computeSVD(D, E, f, e, chunks, chunk_N, method, svd_iter)
prevW = np.copy(W)
print "Individual allele frequencies estimated (1)"

# Iterative estimation of individual allele frequencies
for iteration in xrange(2, M+1):
W, s = computeSVD(D, E, f, e, chunks, chunk_N, method, svd_iter)
W = computeSVD(D, E, f, e, chunks, chunk_N, method, svd_iter)

# Break iterative update if converged
diff = rmse(W, prevW, chunks, chunk_N)
Expand All @@ -315,7 +314,7 @@ def flashPCAngsd(D, f, e, K, F=None, Pvec=None, M=100, M_tole=1e-5, method="arpa
print "Estimation of individual allele frequencies has converged."
break
prevW = np.copy(W)
del W, s, U, prevW
del W, prevW

# Estimate eigenvectors
print "Inferring final set of eigenvector(s)."
Expand Down

0 comments on commit 2cd0ee2

Please sign in to comment.