Back to index

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

List of all members.

Public Member Functions

def setUp
def test_simple_organism
def test_simple_organism_ps
def test_simple_organism_pdf
def test_simple_organism_svg
def test_random_organism
def test_widget

Public Attributes

 test_file

Private Member Functions

def _simple_organism

Detailed Description

Test the creation of all chromosomes of an organism.

Definition at line 158 of file test_GraphicsChromosome.py.


Member Function Documentation

def test_GraphicsChromosome.OrganismGraphicTest._simple_organism (   self,
  filename,
  format 
) [private]
Output a simple organism to given format.

Definition at line 177 of file test_GraphicsChromosome.py.

00177 
00178     def _simple_organism(self, filename, format):
00179         """Output a simple organism to given format."""
00180         test_organism = BasicChromosome.Organism(format)
00181         test_file = os.path.join("Graphics", filename)
00182 
00183         # add chromosomes
00184         for chr_name in ["I", "II", "III", "IV"]:
00185             cur_chromosome = load_chromosome(chr_name)
00186             test_organism.add(cur_chromosome)
00187         test_organism.draw(test_file, "Test organism")
        

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 161 of file test_GraphicsChromosome.py.

00161 
00162     def setUp(self):
00163         self.test_file = os.path.join("Graphics", "organism.pdf")

Generate an organism with random chromosome info.

Definition at line 203 of file test_GraphicsChromosome.py.

00203 
00204     def test_random_organism(self):
00205         """Generate an organism with random chromosome info.
00206         """
00207         random_file = os.path.join("Graphics", "random_organism.pdf")
00208         pdf_organism = BasicChromosome.Organism()
00209 
00210         all_segs = []
00211         all_chrs = []
00212         
00213         num_chrs = random.randrange(1, 15)
00214         for chr_name in range(num_chrs):
00215             cur_chromosome, num_segs = load_random_chromosome(str(chr_name))
00216             all_chrs.append(cur_chromosome)
00217             all_segs.append(num_segs)
00218 
00219         # scale all of the chromosomes by the maximum number of segments
00220         max_segs = max(all_segs)
00221         for chr in all_chrs:
00222             chr.scale_num = max_segs
00223             pdf_organism.add(chr)
00224 
00225         pdf_organism.draw(random_file, "Randomly generated Organism")

Here is the call graph for this function:

Test the basic functionality of drawing an organism.

Definition at line 164 of file test_GraphicsChromosome.py.

00164 
00165     def test_simple_organism(self):
00166         """Test the basic functionality of drawing an organism.
00167         """
00168         pdf_organism = BasicChromosome.Organism()
00169 
00170         # add chromosomes
00171         for chr_name in ["I", "II", "III", "IV"]:
00172             cur_chromosome = load_chromosome(chr_name)
00173             pdf_organism.add(cur_chromosome)
00174 
00175         pdf_organism.draw(self.test_file, "Test organism")
00176 

Here is the call graph for this function:

Output a simple organism to a PDF file.

Definition at line 193 of file test_GraphicsChromosome.py.

00193 
00194     def test_simple_organism_pdf(self):
00195         """Output a simple organism to a PDF file.
00196         """
00197         self._simple_organism("organism.pdf", "pdf")

Here is the call graph for this function:

Output a simple organism to a postscript file.

Definition at line 188 of file test_GraphicsChromosome.py.

00188 
00189     def test_simple_organism_ps(self):
00190         """Output a simple organism to a postscript file.
00191         """
00192         self._simple_organism("organism.eps", "ps")

Here is the call graph for this function:

Output a simple organism to an SVG file.

Definition at line 198 of file test_GraphicsChromosome.py.

00198 
00199     def test_simple_organism_svg(self):
00200         """Output a simple organism to an SVG file.
00201         """
00202         self._simple_organism("organism.svg", "svg")
     

Here is the call graph for this function:

Try widget derived functionality.

Definition at line 226 of file test_GraphicsChromosome.py.

00226 
00227     def test_widget(self):
00228         """Try widget derived functionality.
00229         """
00230         test_widget = BasicChromosome.ChromosomeSegment()
00231 
00232         expected_string = "chr_percent = 0.25"
00233 
00234         # trick to write the properties to a string
00235         save_stdout = sys.stdout
00236         new_stdout = cStringIO.StringIO()
00237         sys.stdout = new_stdout
00238         
00239         test_widget.dumpProperties()
00240 
00241         properties = new_stdout.getvalue()
00242         sys.stdout = save_stdout
00243 
00244         self.assertTrue(properties.find(expected_string) >= 0,
00245                "Unexpected results from dumpProperties: \n %s" % properties)
00246 
00247         properties = test_widget.getProperties()
00248         self.assertEqual(properties["label_size"], 6, 
00249                "Unexpected results from getProperties: %s" % properties)
00250 
00251         test_widget.setProperties({"start_x_position" : 12})
00252         self.assertEqual(test_widget.start_x_position, 12,
00253                "setProperties doesn't seem to work right: %s" \
00254                % test_widget.start_x_position)
00255 


Member Data Documentation

Definition at line 162 of file test_GraphicsChromosome.py.


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