Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_GraphicsChromosome.ChromosomeCountTest Class Reference

List of all members.

Public Member Functions

def setUp
def test_add_count
def test_add_label
def test_set_scale
def test_color_from_count
def test_fill_chromosome
def test_get_segment_info

Public Attributes

 names
 count_display

Detailed Description

Test the display representation for simple counts on a chromosome.

Definition at line 341 of file test_GraphicsChromosome.py.


Member Function Documentation

Definition at line 344 of file test_GraphicsChromosome.py.

00344 
00345     def setUp(self):
00346         self.names = ["Bob", "Dylan", "Doesn't", "Like", "Spam"]
00347         self.count_display = ChromosomeCounts(self.names)

Add counts to specific chromosome segments.

Definition at line 348 of file test_GraphicsChromosome.py.

00348 
00349     def test_add_count(self):
00350         """Add counts to specific chromosome segments.
00351         """
00352         self.count_display.add_count(self.names[1])
00353         self.count_display.add_count(self.names[2], 5)
00354 
00355         try:
00356             self.count_display.add_count("Non-existent")
00357             raise AssertionError("Didn't raise a KeyError on a fake key")
00358         except KeyError:
00359             pass

Add labels to chromosome segments.

Definition at line 360 of file test_GraphicsChromosome.py.

00360 
00361     def test_add_label(self):
00362         """Add labels to chromosome segments.
00363         """
00364         self.count_display.add_label(self.names[1], "Rules")
00365 
00366         try:
00367             self.count_display.add_label("Non-existent", "Elephant")
00368             raise AssertionError("Didn't raise a KeyError on a fake key")
00369         except KeyError:
00370             pass

Retrieve a color from a count number with the default color scheme.

Definition at line 382 of file test_GraphicsChromosome.py.

00382 
00383     def test_color_from_count(self):
00384         """Retrieve a color from a count number with the default color scheme.
00385         """
00386         test_color = self.count_display._color_from_count(3)
00387         assert test_color == colors.blue, "Unexpected color %s" % test_color
00388 
00389         test_color = self.count_display._color_from_count(9)
00390         assert test_color == colors.red, "Unexpected color %s" % test_color
00391 
00392         try:
00393             self.count_display._color_from_count(200)
00394             raise AssertionError("Didn't raise an error for bad count.")
00395         except ValueError:
00396             pass

Test filling out the information on a chromosome.

Definition at line 397 of file test_GraphicsChromosome.py.

00397 
00398     def test_fill_chromosome(self):
00399         """Test filling out the information on a chromosome.
00400         """
00401         test_chr = BasicChromosome.Chromosome("1")
00402         self.count_display.add_count(self.names[2], 5)
00403         self.count_display.add_count(self.names[1], 2)
00404         self.count_display.add_label(self.names[3], "Test-Label")
00405 
00406         new_chr = self.count_display.fill_chromosome(test_chr)

Test retrieval of segment information.

Definition at line 407 of file test_GraphicsChromosome.py.

00407 
00408     def test_get_segment_info(self):
00409         """Test retrieval of segment information.
00410         """
00411         test_count_num = 1
00412         test_count_value = 5
00413         
00414         test_label_num = 3
00415         test_label_value = "BigBird"
00416         
00417         self.count_display.add_count(self.names[test_count_num],
00418                                      test_count_value)
00419         self.count_display.add_label(self.names[test_label_num],
00420                                      test_label_value)
00421 
00422         seg_info = self.count_display.get_segment_info()
00423         
00424         assert seg_info[test_count_num][0] == test_count_value, \
00425                "Did not set and retrieve counts correctly."
00426         assert seg_info[test_label_num][1] == test_label_value, \
00427                "Did not set and retrieve label correctly."

Set the scale for a chromosome segment.

Definition at line 371 of file test_GraphicsChromosome.py.

00371 
00372     def test_set_scale(self):
00373         """Set the scale for a chromosome segment.
00374         """
00375         self.count_display.set_scale(self.names[1], 1.5)
00376 
00377         try:
00378             self.count_display.set_scale("Non-existant", 5)
00379             raise AssertionError("Didn't raise a KeyError on a fake key.")
00380         except KeyError:
00381             pass


Member Data Documentation

Definition at line 346 of file test_GraphicsChromosome.py.

Definition at line 345 of file test_GraphicsChromosome.py.


The documentation for this class was generated from the following file: