Beispiel #1
0
 def recombination_map(self, map_name=None):
     """
     Returns an :class:`msprime.RecombinationMap` instance representing the
     recombination map for this chromosome. If ``map_name`` is provided,
     return the corresponding recombination map; if not, use the default
     recombination map for this species.
     """
     if map_name is None:
         map_name = self.default_genetic_map
     genetic_map = genetic_maps.get_genetic_map(self.species, map_name)
     return genetic_map.get_chromosome_map(self.name)
Beispiel #2
0
 def test_multiple_threads_downloading(self):
     gm = genetic_maps.get_genetic_map("drosophila_melanogaster", "Comeron2012_dm6")
     gm.download()
     saved = gm.is_cached
     try:
         # Trick the download code into thinking there's several happening
         # concurrently
         gm.is_cached = lambda: False
         with self.assertWarns(UserWarning):
             gm.download()
     finally:
         gm.is_cached = saved
Beispiel #3
0
 def recombination_map(self, map_name=None):
     """
     Returns an :class:`msprime.RecombinationMap` instance representing the
     recombination map for this chromosome. If ``map_name`` is provided,
     return the corresponding recombination map; if not, use the default
     recombination map for this species.
     """
     if map_name is None:
         map_name = self.default_genetic_map
     genetic_map = genetic_maps.get_genetic_map(self.species, map_name)
     if genetic_map.contains_chromosome_map(self.name):
         ret = genetic_map.get_chromosome_map(self.name)
     else:
         warnings.warn(
             "Warning: recombination map not found for chromosome: '{}'"
             " on map: '{}', substituting a zero"
             "-recombination map.".format(self.name, map_name))
         ret = msprime.RecombinationMap.uniform_map(self.length, 0)
     return ret
 def test_known_get_chromosome_map(self):
     default_map = homo_sapiens.genome.default_genetic_map
     HapmapII_GRCh37 = genetic_maps.get_genetic_map("homo_sapiens",
                                                    default_map)
     recombination_map = HapmapII_GRCh37.get_chromosome_map("chr1")
     self.assertIsInstance(recombination_map, msprime.RecombinationMap)
 def test_unknown_get_chromosome_map(self):
     default_map = homo_sapiens.genome.default_genetic_map
     HapmapII_GRCh37 = genetic_maps.get_genetic_map("homo_sapiens",
                                                    default_map)
     with self.assertRaises(ValueError):
         HapmapII_GRCh37.get_chromosome_map("jibberish")
 def test_get_genetic_map(self):
     default_map = homo_sapiens.genome.default_genetic_map
     HapmapII_GRCh37 = genetic_maps.get_genetic_map("homo_sapiens",
                                                    default_map)
     self.assertIsInstance(HapmapII_GRCh37, genetic_maps.GeneticMap)