Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Heliconius melpomene #870

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stdpopsim/catalog/HelMel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
Catalog definitions for HelMel (Ensembl ID='heliconius_melpomene')
"""
from . import species # noqa: F401
35 changes: 35 additions & 0 deletions stdpopsim/catalog/HelMel/genome_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# File autogenerated from Ensembl REST API. Do not edit.
#
# Manually edited. See
# https://github.com/popsim-consortium/stdpopsim/issues/835#issuecomment-815854055
#
# Data source:
# http://ensembl.lepbase.org/Heliconius_melpomene_melpomene_hmel25/Info/Index
#
data = {
"assembly_accession": None, # No accession number available
"assembly_name": "Hmel2.5",
"chromosomes": {
"1": {"length": 17206585, "synonyms": []},
"2": {"length": 9045316, "synonyms": []},
"3": {"length": 10541528, "synonyms": []},
"4": {"length": 9662098, "synonyms": []},
"5": {"length": 9908586, "synonyms": []},
"6": {"length": 1405417, "synonyms": []},
"7": {"length": 1430885, "synonyms": []},
"8": {"length": 9320449, "synonyms": []},
"9": {"length": 8708747, "synonyms": []},
"10": {"length": 1796548, "synonyms": []},
"11": {"length": 1175927, "synonyms": []},
"12": {"length": 1632729, "synonyms": []},
"13": {"length": 1812731, "synonyms": []},
"14": {"length": 9174305, "synonyms": []},
"15": {"length": 1023575, "synonyms": []},
"16": {"length": 1008321, "synonyms": []},
"17": {"length": 1477329, "synonyms": []},
"18": {"length": 1680389, "synonyms": []},
"19": {"length": 1639934, "synonyms": []},
"20": {"length": 1487169, "synonyms": []},
"21": {"length": 1335969, "synonyms": []},
},
}
92 changes: 92 additions & 0 deletions stdpopsim/catalog/HelMel/species.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import stdpopsim

from . import genome_data

_recombination_rate = {
"1": 3.17e-8,
"2": 5.61e-8,
"3": 5.10e-8,
"4": 4.97e-8,
"5": 5.15e-8,
"6": 3.40e-8,
"7": 3.76e-8,
"8": 5.28e-8,
"9": 5.31e-8,
"10": 3.16e-8,
"11": 4.47e-8,
"12": 3.13e-8,
"13": 3.08e-8,
"14": 5.47e-8,
"15": 4.78e-8,
"16": 4.71e-8,
"17": 3.94e-8,
"18": 3.16e-8,
"19": 3.11e-8,
"20": 3.45e-8,
"21": 3.71e-8,
}

_overall_rate = 2.9e-9
_mutation_rate = {
"1": _overall_rate,
"2": _overall_rate,
"3": _overall_rate,
"4": _overall_rate,
"5": _overall_rate,
"6": _overall_rate,
"7": _overall_rate,
"8": _overall_rate,
"9": _overall_rate,
"10": _overall_rate,
"11": _overall_rate,
"12": _overall_rate,
"13": _overall_rate,
"14": _overall_rate,
"15": _overall_rate,
"16": _overall_rate,
"17": _overall_rate,
"18": _overall_rate,
"19": _overall_rate,
"20": _overall_rate,
"21": _overall_rate,
}

_genome = stdpopsim.Genome.from_data(
genome_data.data,
recombination_rate=_recombination_rate,
mutation_rate=_mutation_rate,
citations=[
stdpopsim.Citation(
author="Davey et al",
year=2017,
doi="https://doi.org/10.1002/evl3.12",
reasons={stdpopsim.CiteReason.ASSEMBLY, stdpopsim.CiteReason.REC_RATE},
),
stdpopsim.Citation(
author="Keightley et al",
year=2015,
doi="https://doi.org/10.1093/molbev/msu302",
reasons={stdpopsim.CiteReason.MUT_RATE},
),
],
)

_species = stdpopsim.Species(
id="HelMel",
ensembl_id="heliconius_melpomene",
name="Heliconius melpomene",
common_name="Heliconius melpomene",
genome=_genome,
generation_time=9.5 / 100,
population_size=2.1e6,
citations=[
stdpopsim.Citation(
author="Pardo-Diaz et al",
year=2012,
doi="https://doi.org/10.1371/journal.pgen.1002752",
reasons={stdpopsim.CiteReason.POP_SIZE, stdpopsim.CiteReason.GEN_TIME},
),
],
)

stdpopsim.register_species(_species)
45 changes: 45 additions & 0 deletions tests/test_HelMel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import pytest

import stdpopsim
from tests import test_species


class TestSpeciesData(test_species.SpeciesTestBase):

species = stdpopsim.get_species("HelMel")

def test_ensembl_id(self):
assert self.species.ensembl_id == "heliconius_melpomene"

def test_name(self):
assert self.species.name == "Heliconius melpomene"

def test_common_name(self):
assert self.species.common_name == "Heliconius melpomene"

# QC Tests. These tests are performed by another contributor
# independently referring to the citations provided in the
# species definition, filling in the appropriate values
# and deleting the pytest "skip" annotations.
@pytest.mark.skip("Population size QC not done yet")
def test_qc_population_size(self):
assert self.species.population_size == -1

@pytest.mark.skip("Generation time QC not done yet")
def test_qc_generation_time(self):
assert self.species.generation_time == -1


class TestGenomeData(test_species.GenomeTestBase):

genome = stdpopsim.get_species("HelMel").genome

@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)

@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)