Back to index

python-biopython  1.60
Classes | Functions | Variables
test_GraphicsChromosome Namespace Reference

Classes

class  OrganismGraphicTest
class  OrganismSubAnnotationsTest
class  ChromosomeCountTest

Functions

def load_chromosome
def get_random_id
def load_random_chromosome

Variables

tuple chr1_info
tuple chr2_info
tuple chr3_info
tuple chr4_info
dictionary all_chr_info
tuple color_choices = (colors.red, colors.blue)
string letter_choices = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
int num_possible_segments = 500
int color_prob = 3
int id_prob = 025
tuple runner = unittest.TextTestRunner(verbosity = 2)

Function Documentation

Generate a random id number.

Definition at line 117 of file test_GraphicsChromosome.py.

00117 
00118 def get_random_id():
00119     """Generate a random id number.
00120     """
00121     id = ''
00122     for n in range(6):
00123         letter = random.choice(letter_choices)
00124         id += letter
00125 
00126     return id

Here is the caller graph for this function:

Load a chromosome and all of its segments.

Definition at line 79 of file test_GraphicsChromosome.py.

00079 
00080 def load_chromosome(chr_name):
00081     """Load a chromosome and all of its segments.
00082     """
00083     cur_chromosome = BasicChromosome.Chromosome(chr_name)
00084 
00085     chr_segment_info = all_chr_info[chr_name]
00086 
00087     for seg_info_num in range(len(chr_segment_info)):
00088         label, fill_color, scale = chr_segment_info[seg_info_num]
00089         # make the top and bottom telomeres
00090         if seg_info_num == 0:
00091             cur_segment = BasicChromosome.TelomereSegment()
00092         elif seg_info_num == len(chr_segment_info) - 1:
00093             cur_segment = BasicChromosome.TelomereSegment(1)
00094         # otherwise, they are just regular segments
00095         else:
00096             cur_segment = BasicChromosome.ChromosomeSegment()
00097         if label != "":
00098             cur_segment.label = label
00099         if fill_color is not None:
00100             cur_segment.fill_color = fill_color
00101 
00102         cur_segment.scale = scale
00103 
00104         cur_chromosome.add(cur_segment)
00105 
00106     # scale by the size of chromosome 2
00107     cur_chromosome.scale_num = 19
00108 
00109     return cur_chromosome
00110 
# --- stuff for generating random organisms

Here is the caller graph for this function:

Generate a chromosome with random information about it.

Definition at line 127 of file test_GraphicsChromosome.py.

00127 
00128 def load_random_chromosome(chr_name):
00129     """Generate a chromosome with random information about it.
00130     """
00131     cur_chromosome = BasicChromosome.Chromosome(chr_name)
00132 
00133     num_segments = random.randrange(num_possible_segments)
00134     for seg in range(num_segments):
00135         # make the top and bottom telomeres
00136         if seg == 0:
00137             cur_segment = BasicChromosome.TelomereSegment()
00138         elif seg == num_segments - 1:
00139             cur_segment = BasicChromosome.TelomereSegment(1)
00140         # otherwise, they are just regular segments
00141         else:
00142             cur_segment = BasicChromosome.ChromosomeSegment()
00143             
00144         color_chance = random.random()
00145         if color_chance <= color_prob:
00146             fill_color = random.choice(color_choices)
00147             cur_segment.fill_color = fill_color
00148 
00149         id_chance = random.random()
00150         if id_chance <= id_prob:
00151             id = get_random_id()
00152             cur_segment.label = id
00153 
00154         cur_chromosome.add(cur_segment)
00155         
00156     return cur_chromosome, num_segments
00157 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Initial value:
00001 {"I" : chr1_info,
00002                 "II" : chr2_info,
00003                 "III" : chr3_info,
00004                 "IV" : chr4_info}

Definition at line 74 of file test_GraphicsChromosome.py.

Initial value:
00001 (("", None, 1),
00002              ("AC30001", None, 1),
00003              ("", colors.blue, 2),
00004              ("", colors.blue, 1.5),
00005              ("", colors.red, 2),
00006              ("AC12345", colors.blue, 1),
00007              ("", colors.blue, 1),
00008              ("", colors.blue, 1),
00009              ("", None, 1))

Definition at line 35 of file test_GraphicsChromosome.py.

Initial value:
00001 (("", None, 2),
00002              ("AC23456", None, 2),
00003              ("", colors.blue, 1),
00004              ("", colors.blue, 1),
00005              ("", colors.red, 1),
00006              ("AC00002", colors.blue, 1.5),
00007              ("", colors.blue, 1.5),
00008              ("", colors.blue, 2),
00009              ("", None, 1.5),
00010              ("", colors.red, 2),
00011              ("", colors.red, 1.5),
00012              ("AB0001", None, 1),
00013              ("", colors.red, 1))

Definition at line 45 of file test_GraphicsChromosome.py.

Initial value:
00001 (("", colors.green, 2),
00002              ("", colors.green, 1),
00003              ("AD00002", colors.blue, 1),
00004              ("", colors.blue, 1),
00005              ("", colors.red, 1))

Definition at line 59 of file test_GraphicsChromosome.py.

Initial value:
00001 (("", None, 1.5),
00002              ("", None, 1),
00003              ("AD11111", colors.blue, 2),
00004              ("", colors.blue, 1),
00005              ("", colors.red, 1.5),
00006              ("", colors.blue, 1),
00007              ("", colors.blue, 1),
00008              ("AC22222", colors.blue, 1))

Definition at line 65 of file test_GraphicsChromosome.py.

tuple test_GraphicsChromosome.color_choices = (colors.red, colors.blue)

Definition at line 111 of file test_GraphicsChromosome.py.

Definition at line 114 of file test_GraphicsChromosome.py.

Definition at line 115 of file test_GraphicsChromosome.py.

string test_GraphicsChromosome.letter_choices = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

Definition at line 112 of file test_GraphicsChromosome.py.

Definition at line 113 of file test_GraphicsChromosome.py.

tuple test_GraphicsChromosome.runner = unittest.TextTestRunner(verbosity = 2)

Definition at line 429 of file test_GraphicsChromosome.py.