Repository: popsim-consortium/stdpopsim (language: python)

Issue:
fix AedAeg recombination rates
As discovered in #914, actually 0.306 is not approximately 0.306e-8 - whoops - and the [recombination rate values](https://github.com/popsim-consortium/stdpopsim/blob/5d4ba60449b220bfd7001ef5c79ff563ef2215c0/stdpopsim/catalog/AedAeg/species.py#L9) for AedAeg are in cM/Mb, so need a `e-8` appended.

Here's the relevant table, to confirm:
![Screenshot from 2021-04-13 03-53-09](https://user-images.githubusercontent.com/1046249/114541587-c8100b00-9c0b-11eb-988f-264f61553ed0.png)



Discussion / hints:

Fix patch:
diff --git a/maintenance/main.py b/maintenance/main.py
index 0af355e6d..c17de7524 100644
--- a/maintenance/main.py
+++ b/maintenance/main.py
@@ -140,14 +140,14 @@ class TestGenomeData(test_species.GenomeTestBase):
         ["name", "rate"],
         $chromosome_rate_dict.items())
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).recombination_rate)
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(
         ["name", "rate"],
         $chromosome_rate_dict.items())
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
 """
 )
 
diff --git a/stdpopsim/catalog/AedAeg/species.py b/stdpopsim/catalog/AedAeg/species.py
index e9c7c7bb9..2cc8ba363 100644
--- a/stdpopsim/catalog/AedAeg/species.py
+++ b/stdpopsim/catalog/AedAeg/species.py
@@ -3,7 +3,7 @@
 from . import genome_data
 
 # These are in Table 1 of Juneja et al:
-_recombination_rate = {"1": 0.306, "2": 0.249, "3": 0.291, "MT": 0}
+_recombination_rate = {"1": 0.306e-8, "2": 0.249e-8, "3": 0.291e-8, "MT": 0}
 
 _JunejaEtAl = stdpopsim.Citation(
     doi="https://doi.org/10.1371/journal.pntd.0002652",


Test patch:
diff --git a/tests/test_AedAeg.py b/tests/test_AedAeg.py
index ac43ae8d3..9c7ab65f0 100644
--- a/tests/test_AedAeg.py
+++ b/tests/test_AedAeg.py
@@ -33,10 +33,12 @@ class TestGenomeData(test_species.GenomeTestBase):
         {"1": 0.306e-8, "2": 0.249e-8, "3": 0.291e-8, "MT": 0.0}.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.parametrize(
         ["name", "rate"], {"1": 3.5e-9, "2": 3.5e-9, "3": 3.5e-9, "MT": 3.5e-9}.items()
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_AnaPla.py b/tests/test_AnaPla.py
index 0d619e6d4..5c8e91b0c 100644
--- a/tests/test_AnaPla.py
+++ b/tests/test_AnaPla.py
@@ -82,7 +82,9 @@ class TestGenomeData(test_species.GenomeTestBase):
         }.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(
@@ -132,4 +134,4 @@ def test_recombination_rate(self, name, rate):
         }.items(),
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_AnoCar.py b/tests/test_AnoCar.py
index bbdea139a..e3da2abcb 100644
--- a/tests/test_AnoCar.py
+++ b/tests/test_AnoCar.py
@@ -50,11 +50,13 @@ class TestGenomeData(test_species.GenomeTestBase):
             "LGf": rec_rate,
             "LGg": rec_rate,
             "LGh": rec_rate,
-            "MT": rec_rate,
+            "MT": 0,
         }.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     mu = 2.1e-10
 
@@ -78,4 +80,4 @@ def test_recombination_rate(self, name, rate):
         }.items(),
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_AnoGam.py b/tests/test_AnoGam.py
index 62da034b1..d3356d189 100644
--- a/tests/test_AnoGam.py
+++ b/tests/test_AnoGam.py
@@ -40,7 +40,9 @@ class TestGenomeData(test_species.GenomeTestBase):
         {"2L": -1, "2R": -1, "3L": -1, "3R": -1, "X": -1, "Mt": -1}.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(
@@ -48,4 +50,4 @@ def test_recombination_rate(self, name, rate):
         {"2L": -1, "2R": -1, "3L": -1, "3R": -1, "X": -1, "Mt": -1}.items(),
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_BosTau.py b/tests/test_BosTau.py
index fe6e58d9f..c1e130a3a 100644
--- a/tests/test_BosTau.py
+++ b/tests/test_BosTau.py
@@ -70,7 +70,9 @@ def test_basic_attributes(self):
         }.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(
@@ -110,4 +112,4 @@ def test_recombination_rate(self, name, rate):
         }.items(),
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_ChlRei.py b/tests/test_ChlRei.py
index 5bf36aa98..2e4cec0bb 100644
--- a/tests/test_ChlRei.py
+++ b/tests/test_ChlRei.py
@@ -58,7 +58,9 @@ class TestGenomeData(test_species.GenomeTestBase):
         }.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(
@@ -84,4 +86,4 @@ def test_recombination_rate(self, name, rate):
         }.items(),
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_DroSec.py b/tests/test_DroSec.py
index 536b925e3..c5e9593f8 100644
--- a/tests/test_DroSec.py
+++ b/tests/test_DroSec.py
@@ -37,9 +37,11 @@ class TestGenomeData(test_species.GenomeTestBase):
     @pytest.mark.skip("Recombination rate QC not done yet")
     @pytest.mark.parametrize(["name", "rate"], {}.items())
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(["name", "rate"], {}.items())
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_HelMel.py b/tests/test_HelMel.py
index 5fc91fa80..8fad20ec8 100644
--- a/tests/test_HelMel.py
+++ b/tests/test_HelMel.py
@@ -37,9 +37,11 @@ class TestGenomeData(test_species.GenomeTestBase):
     @pytest.mark.skip("Recombination rate QC not done yet")
     @pytest.mark.parametrize(["name", "rate"], {}.items())
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(["name", "rate"], {}.items())
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)
diff --git a/tests/test_HomSap.py b/tests/test_HomSap.py
index 2a19ec8a6..0c35de0fa 100644
--- a/tests/test_HomSap.py
+++ b/tests/test_HomSap.py
@@ -23,6 +23,7 @@ class TestGenome(test_species.GenomeTestBase):
     def test_basic_attributes(self):
         assert len(self.genome.chromosomes) == 25
 
+    @pytest.mark.skip("Failing - due to mismatching assembly?")
     @pytest.mark.parametrize("chr_id", [chrom.id for chrom in genome.chromosomes])
     def test_recombination_rates(self, chr_id):
         # We should recast this test and just hard code in the values.
@@ -45,7 +46,6 @@ def test_recombination_rates(self, chr_id):
             # lifted over map.
             with pytest.warns(UserWarning, match="longer than chromosome length"):
                 contig = species.get_contig(chr_id, genetic_map=genetic_map)
-        assert pytest.approx(
-            chrom.recombination_rate,
-            contig.recombination_map.mean_rate,
+        assert chrom.recombination_rate == pytest.approx(
+            contig.recombination_map.mean_rate, rel=1e-6
         )
diff --git a/tests/test_StrAga.py b/tests/test_StrAga.py
index 30402a9d0..9283de233 100644
--- a/tests/test_StrAga.py
+++ b/tests/test_StrAga.py
@@ -42,7 +42,9 @@ class TestGenomeData(test_species.GenomeTestBase):
         }.items(),
     )
     def test_recombination_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).recombination_rate)
+        assert rate == pytest.approx(
+            self.genome.get_chromosome(name).recombination_rate
+        )
 
     @pytest.mark.skip("Mutation rate QC not done yet")
     @pytest.mark.parametrize(
@@ -50,4 +52,4 @@ def test_recombination_rate(self, name, rate):
         {"1": -1}.items(),
     )
     def test_mutation_rate(self, name, rate):
-        assert pytest.approx(rate, self.genome.get_chromosome(name).mutation_rate)
+        assert rate == pytest.approx(self.genome.get_chromosome(name).mutation_rate)