Skip to content

Commit

Permalink
cleaned up codebase and major version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
JLSteenwyk committed Sep 19, 2024
1 parent 2efe242 commit 10b4db1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions phykit/services/alignment/compositional_bias_per_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,26 @@ def calculate_compositional_bias_per_site(
List[Power_divergenceResult],
List[Union[float, str]],
]:
# get aln length
aln_len = alignment.get_alignment_length()

stat_res = []
p_vals = []
nan_idx = []

for idx in range(aln_len):
# Count occurrences of each character at site idx
num_occurrences = self.get_number_of_occurrences_per_character(alignment, idx)
num_occurrences = \
self.get_number_of_occurrences_per_character(alignment, idx)

# Perform chi-square test on the counts
chisquare_res = chisquare(num_occurrences)
stat_res.append(chisquare_res)

# Collect p-values and track NaN values
if str(chisquare_res.pvalue) != "nan":
p_vals.append(chisquare_res.pvalue)
else:
nan_idx.append(idx)

# Correct p-values using false discovery control
p_vals_corrected = list(false_discovery_control(p_vals))

# Reinsert "nan" values at the appropriate positions
for idx in reversed(nan_idx):
p_vals_corrected.insert(idx, "nan")

Expand Down
2 changes: 1 addition & 1 deletion phykit/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.20.0"
__version__ = "2.0.0"

0 comments on commit 10b4db1

Please sign in to comment.