Skip to content

Commit

Permalink
fix the default pca impute_method
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacovercast committed Nov 6, 2024
1 parent c1190f2 commit 2e0fc64
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ipyrad/analysis/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def __init__(
index=self.names, columns=["missing"])

# impute missing data
if self._mvals:
if (self.impute_method is not False) and self._mvals:
self._impute_data()


Expand Down Expand Up @@ -231,14 +231,16 @@ def _impute_data(self):

elif self.impute_method == "random":
missing = self.snps == 9
self.snps[missing] = 0
self.snps[missing] += np.random.choice([0,1,2], self.snps.shape)[missing].astype(np.uint64)
self._print(
"Imputation (Random; sets to ~U[0,1,2]): {:.1f}%, {:.1f}%, {:.1f}%"
.format(33.3, 33.3, 33.3)
)

else:
self.snps[self.snps == 9] = 0
missing = self.snps == 9
self.snps[missing] = 0
self._print(
"Imputation (null; sets to 0): {:.1f}%, {:.1f}%, {:.1f}%"
.format(100, 0, 0)
Expand Down

0 comments on commit 2e0fc64

Please sign in to comment.