From 5026f8ef7eb0b18c61d4d91c88b18ae734da182f Mon Sep 17 00:00:00 2001 From: Alejandra Hernandez-Agreda Date: Tue, 24 Aug 2021 17:39:51 -0700 Subject: [PATCH] Fix the error in proportion calculation Changes in the threshold argument didn't modify outcomes because the function num_in_pop_genotyped returned an integer of the count of the number of individuals in which SNP was found, instead of the proportion of individuals in which an SNP was found. --- vcf_minrep_filter_abs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcf_minrep_filter_abs.py b/vcf_minrep_filter_abs.py index 6e00710..2170050 100755 --- a/vcf_minrep_filter_abs.py +++ b/vcf_minrep_filter_abs.py @@ -47,7 +47,7 @@ def num_in_pop_genotyped(record, indvs): count_genotyped += 1 else: sys.exit('Unexpected value: {0}:{1}'.format(indiv, record.CHROM)) - return int(count_genotyped) + return float(count_genotyped / (count_genotyped + count_missing)) def prop_of_overall_genotyped(record, pops_indivs):