Skip to content

Commit

Permalink
calculate p-value considering coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyuma committed Nov 8, 2023
1 parent 784ab89 commit a3f7270
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion srcs/hypothesis_recovery_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ def single_hyp_test(

# How many unique k-mers do I actually see?
num_matches = exclusive_hashes_info_org[1]
p_val = binom.cdf(num_matches, num_exclusive_kmers, non_mut_p)
# calculate the p-value considering the coverage
if num_matches <= num_exclusive_kmers_coverage:
p_val = binom.cdf(num_matches, num_exclusive_kmers_coverage, non_mut_p)
else:
p_val = 1.0
# is the genome present? Takes coverage into account
in_sample_est = (num_matches >= acceptance_threshold_with_coverage) and (num_matches != 0)
# return in_sample_est, p_val, num_exclusive_kmers, num_exclusive_kmers_coverage, num_matches, \
Expand Down

0 comments on commit a3f7270

Please sign in to comment.