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

Issue:
AraTha annotations
**Short description of what you'd like added:**
The catalog would benefit from annotations for Arabidopsis.

**Rationale and considerations:**
In particular, we'd like to have this for the analysis2 pipeline and paper. 



Discussion / hints:
I'll try to get this done in the next day, if no one else is currently at work on it

Fix patch:
diff --git a/maintenance/annotation_maint.py b/maintenance/annotation_maint.py
index 2f79e3039..38df36ce2 100644
--- a/maintenance/annotation_maint.py
+++ b/maintenance/annotation_maint.py
@@ -117,7 +117,7 @@ def download_process_annotations():
                         continue
                     intervals = gff_recarray_to_stdpopsim_intervals(chrom_exons)
                     # double check that the intervals can be used in stdpopsim
-                    stdpopsim.utils.check_intervals_validity(intervals)
+                    stdpopsim.utils._check_intervals_validity(intervals)
                     out_file = os.path.join(
                         spc_name_path, an.file_pattern.format(id=chrom_id)
                     )
diff --git a/stdpopsim/catalog/AraTha/__init__.py b/stdpopsim/catalog/AraTha/__init__.py
index 304063709..8ec56e2ad 100644
--- a/stdpopsim/catalog/AraTha/__init__.py
+++ b/stdpopsim/catalog/AraTha/__init__.py
@@ -4,3 +4,4 @@
 from . import species  # noqa: F401
 from . import genetic_maps  # noqa: F401
 from . import demographic_models  # noqa: F401
+from . import annotations  # noqa: F401
diff --git a/stdpopsim/catalog/AraTha/annotations.py b/stdpopsim/catalog/AraTha/annotations.py
new file mode 100644
index 000000000..d78171e38
--- /dev/null
+++ b/stdpopsim/catalog/AraTha/annotations.py
@@ -0,0 +1,60 @@
+import stdpopsim
+
+_species = stdpopsim.get_species("AraTha")
+
+_an = stdpopsim.Annotation(
+    species=_species,
+    id="araport_11_exons",
+    description="Araport11 exon annotations on TAIR10",
+    url=(
+        "http://ftp.ensemblgenomes.org/pub/plants/release-54/"
+        "gff3/arabidopsis_thaliana/Arabidopsis_thaliana.TAIR10.54.gff3.gz"
+    ),
+    gff_sha256="72dbbe75631b0c42499c65712911dc24c0da4a265275e415c4732ffe21c00425",
+    intervals_url=(
+        "https://stdpopsim.s3-us-west-2.amazonaws.com/"
+        "annotations/AraTha/araport_11_exons.tar.gz"
+    ),
+    intervals_sha256="235105850a365f7f171c459d4c5ee50483e0c17e3b2b0232412d22addca9915f",
+    citations=[
+        stdpopsim.Citation(
+            year=2017,
+            author="Cheng et al",
+            doi="http://dx.doi.org/10.1111/tpj.13415",
+            reasons={stdpopsim.CiteReason.ANNOTATION},
+        )
+    ],
+    file_pattern="araport_exons_{id}.txt",
+    annotation_source="araport11",
+    annotation_type="exon",
+)
+_species.add_annotations(_an)
+
+# add CDS
+_an2 = stdpopsim.Annotation(
+    species=_species,
+    id="araport_11_CDS",
+    description="Araport11 exon annotations on TAIR10",
+    url=(
+        "http://ftp.ensemblgenomes.org/pub/plants/release-54/"
+        "gff3/arabidopsis_thaliana/Arabidopsis_thaliana.TAIR10.54.gff3.gz"
+    ),
+    gff_sha256="72dbbe75631b0c42499c65712911dc24c0da4a265275e415c4732ffe21c00425",
+    intervals_url=(
+        "https://stdpopsim.s3-us-west-2.amazonaws.com/"
+        "annotations/AraTha/araport_11_CDS.tar.gz"
+    ),
+    intervals_sha256="c1e1c17a0bf3591e91a4cf85a0ad964d1e9205cc2788c40f855870c589cacca7",
+    citations=[
+        stdpopsim.Citation(
+            year=2017,
+            author="Cheng et al",
+            doi="http://dx.doi.org/10.1111/tpj.13415",
+            reasons={stdpopsim.CiteReason.ANNOTATION},
+        )
+    ],
+    file_pattern="araport_CDS_{id}.txt",
+    annotation_source="araport11",
+    annotation_type="CDS",
+)
+_species.add_annotations(_an2)
diff --git a/stdpopsim/catalog/DroMel/annotations.py b/stdpopsim/catalog/DroMel/annotations.py
index fa88446ed..bdadc59ba 100644
--- a/stdpopsim/catalog/DroMel/annotations.py
+++ b/stdpopsim/catalog/DroMel/annotations.py
@@ -7,16 +7,16 @@
     id="FlyBase_BDGP6.32.51_exons",
     description="FlyBase exon annotations on BDGP6",
     url=(
-        "http://ftp.ebi.ac.uk/ensemblgenomes/pub/current/metazoa/"
+        "http://ftp.ensembl.org/pub/release-104/"
         "gff3/drosophila_melanogaster/"
-        "Drosophila_melanogaster.BDGP6.32.51.gff3.gz"
+        "Drosophila_melanogaster.BDGP6.32.104.gff3.gz"
     ),
     gff_sha256="d882d9a2af1c090ad69b4c81e54b809506f7a8d5fdd90597c6ed05c79ad502bc",
     intervals_url=(
         "https://stdpopsim.s3-us-west-2.amazonaws.com/"
         "annotations/DroMel/FlyBase_BDGP6.32.51_exons.tar.gz"
     ),
-    intervals_sha256="680ee9b0a565f85c561cd3672927cb2bc8649405a750532f91e1717b3ed8b993",
+    intervals_sha256="f09b4684505c7c8c86c7739d632c79927b8d329fd60fd55ea3f610b944bb5856",
     citations=[
         stdpopsim.Citation(
             year=2014,
@@ -36,16 +36,16 @@
     id="FlyBase_BDGP6.32.51_CDS",
     description="FlyBase CDS annotations on BDGP6",
     url=(
-        "http://ftp.ebi.ac.uk/ensemblgenomes/pub/current/metazoa/"
+        "http://ftp.ensembl.org/pub/release-104/"
         "gff3/drosophila_melanogaster/"
-        "Drosophila_melanogaster.BDGP6.32.51.gff3.gz"
+        "Drosophila_melanogaster.BDGP6.32.104.gff3.gz"
     ),
     gff_sha256="d882d9a2af1c090ad69b4c81e54b809506f7a8d5fdd90597c6ed05c79ad502bc",
     intervals_url=(
         "https://stdpopsim.s3-us-west-2.amazonaws.com/"
         "annotations/DroMel/FlyBase_BDGP6.32.51_CDS.tar.gz"
     ),
-    intervals_sha256="5f202f454e7d0051f863a5146e775c85e4f3e39bab434cc96701d46026eb7364",
+    intervals_sha256="b993c8fc997e1c7ecdad626b7eeceae724cc0e0e477d8ab2f186866a6a0def15",
     citations=[
         stdpopsim.Citation(
             year=2014,
diff --git a/stdpopsim/catalog/HomSap/annotations.py b/stdpopsim/catalog/HomSap/annotations.py
index 698ffdb00..3e00964d0 100644
--- a/stdpopsim/catalog/HomSap/annotations.py
+++ b/stdpopsim/catalog/HomSap/annotations.py
@@ -15,7 +15,7 @@
         "https://stdpopsim.s3-us-west-2.amazonaws.com/"
         "annotations/HomSap/ensembl_havana_104_exons.tar.gz"
     ),
-    intervals_sha256="5c356d092b31fa40bfce434994de276e9040ed9a80fc047a5e3b94410157f1cf",
+    intervals_sha256="b9df30b3a37cdd26ec625fd80968ff2e412810c045a11dddc458dc606c702c96",
     citations=[
         stdpopsim.Citation(
             year=2018,
@@ -44,7 +44,7 @@
         "https://stdpopsim.s3-us-west-2.amazonaws.com/"
         "annotations/HomSap/ensembl_havana_104_CDS.tar.gz"
     ),
-    intervals_sha256="24b36e6f88a6d995ecaee7ef965baa4d2ea850058ee2f5084efdbb0ea47f1c8e",
+    intervals_sha256="237801b39642b91e733e155dc62960c0b097d3c144eea408327e9dc5f1ac84ae",
     citations=[
         stdpopsim.Citation(
             year=2018,


Test patch:
diff --git a/tests/test_annotations.py b/tests/test_annotations.py
index 718784d41..230501240 100644
--- a/tests/test_annotations.py
+++ b/tests/test_annotations.py
@@ -203,6 +203,31 @@ def test_unknown_chromosome(self):
                 self.an.get_chromosome_annotations(bad_chrom)
 
 
+class TestGetChromosomeAnnotationsAraTha(tests.CacheReadingTest):
+    """
+    Tests if we get chromosome level annotations
+    using the ara GFF.
+    """
+
+    @classmethod
+    def setup_class(cls):
+        species = stdpopsim.get_species("AraTha")
+        cls.an = species.get_annotations("araport_11_exons")
+
+    def test_known_chromosome(self):
+        cm = self.an.get_chromosome_annotations("2")
+        assert isinstance(cm, np.ndarray)
+
+    def test_known_chromosome_prefix(self):
+        cm = self.an.get_chromosome_annotations("chr2")
+        assert isinstance(cm, np.ndarray)
+
+    def test_unknown_chromosome(self):
+        for bad_chrom in ["", "ABDEFG", None]:
+            with pytest.raises(ValueError):
+                self.an.get_chromosome_annotations(bad_chrom)
+
+
 class TestIntervalMerge:
     """
     Tests for the Annotation stuff.