From 11a2719167c43962e1e289b268f278841f2a4cd0 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 7 May 2024 09:19:31 -0700 Subject: [PATCH 1/2] put PhoSin qc where it should go --- qc/PhoSin.py | 72 ------------------------------------------ stdpopsim/qc/PhoSin.py | 27 ++++++++++++++++ 2 files changed, 27 insertions(+), 72 deletions(-) delete mode 100644 qc/PhoSin.py diff --git a/qc/PhoSin.py b/qc/PhoSin.py deleted file mode 100644 index 69c541a2c..000000000 --- a/qc/PhoSin.py +++ /dev/null @@ -1,72 +0,0 @@ -import msprime - -import stdpopsim - - -_species = stdpopsim.get_species("PhoSin") - - -def Robinson2022_TwoEpoch(): - id = "QC-Vaquita2Epoch_1R22" - - populations = [ - stdpopsim.Population(id="Vaquita", description=""), - ] - - # Time of second epoch - T_2 = 2162 - # population sizes - N_ANC = 4485 - N_2 = 2807 - - return stdpopsim.DemographicModel( - id=id, - description=id, - long_description=id, - generation_time=_species.generation_time, - mutation_rate=5.83e-9, - populations=populations, - population_configurations=[ - msprime.PopulationConfiguration( - initial_size=N_2, metadata=populations[0].asdict() - ), - ], - demographic_events=[ - msprime.PopulationParametersChange( - time=T_2, initial_size=N_ANC, population_id=0 - ), - ], - population_id_map=[{"Vaquita": 0}] * 2, - ) - - -_species.get_demographic_model("Vaquita2Epoch_1R22").register_qc( - Robinson2022_TwoEpoch() -) - - -def Robinson2022(): - """ - Gamma DFE from Robinson et al. 2022 Science. - """ - - id = "Robinson2022_gamma_dfe" - neutral = stdpopsim.MutationType() - - negative = stdpopsim.MutationType( - dominance_coeff_list=[0.0, 0.01, 0.1, 0.4], - dominance_coeff_breaks=[-0.1, -0.01, -0.001], - distribution_type="g", # gamma distribution - distribution_args=[-0.0257, 0.131], - ) - - return stdpopsim.DFE( - id=id, - description=id, - long_description=id, - mutation_types=[neutral, negative], - proportions=[0.3, 0.7], - ) - - -_species.get_dfe("Gamma_R22").register_qc(Robinson2022()) diff --git a/stdpopsim/qc/PhoSin.py b/stdpopsim/qc/PhoSin.py index 28c0e25b8..69c541a2c 100644 --- a/stdpopsim/qc/PhoSin.py +++ b/stdpopsim/qc/PhoSin.py @@ -43,3 +43,30 @@ def Robinson2022_TwoEpoch(): _species.get_demographic_model("Vaquita2Epoch_1R22").register_qc( Robinson2022_TwoEpoch() ) + + +def Robinson2022(): + """ + Gamma DFE from Robinson et al. 2022 Science. + """ + + id = "Robinson2022_gamma_dfe" + neutral = stdpopsim.MutationType() + + negative = stdpopsim.MutationType( + dominance_coeff_list=[0.0, 0.01, 0.1, 0.4], + dominance_coeff_breaks=[-0.1, -0.01, -0.001], + distribution_type="g", # gamma distribution + distribution_args=[-0.0257, 0.131], + ) + + return stdpopsim.DFE( + id=id, + description=id, + long_description=id, + mutation_types=[neutral, negative], + proportions=[0.3, 0.7], + ) + + +_species.get_dfe("Gamma_R22").register_qc(Robinson2022()) From c1d44ca1913a98d129c63ca5f45102830b12b520 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 7 May 2024 21:36:18 -0700 Subject: [PATCH 2/2] fixup of coefficient --- stdpopsim/catalog/PhoSin/dfes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdpopsim/catalog/PhoSin/dfes.py b/stdpopsim/catalog/PhoSin/dfes.py index a8cf2fb7b..cc6fd6339 100644 --- a/stdpopsim/catalog/PhoSin/dfes.py +++ b/stdpopsim/catalog/PhoSin/dfes.py @@ -48,7 +48,7 @@ def _RobinsonDFE(): # is defined in fitDadi and in SLiM ] # Since the inferred value of Na is not reported in the supplement, we use # here the value of the mean as reported in the supp info - gamma_mean = -0.00971 # mean of gamma (see bottom of page 12 in supp) + gamma_mean = -0.0257 # mean of gamma (see bottom of page 12 in supp) # dominance coefficient assumed in fitDadi inference was fully additive (h=0.5). # However, in the simulations described by Robinson et al. (2022), they used