Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Attributes
Bio.Graphics.GenomeDiagram._Track.Track Class Reference

List of all members.

Public Member Functions

def __init__
def add_set
def new_set
def del_set
def get_sets
def get_ids
def range
def to_string
def __getitem__
def __str__

Public Attributes

 height
 name
 hide
 start
 end
 greytrack
 greytrack_labels
 greytrack_fontsize
 greytrack_font
 greytrack_font_rotation
 greytrack_fontcolor
 scale
 scale_format
 scale_color
 scale_font
 scale_fontsize
 scale_fontangle
 scale_ticks
 scale_largeticks
 scale_smallticks
 scale_largetick_interval
 scale_smalltick_interval
 scale_largetick_labels
 scale_smalltick_labels
 axis_labels

Private Attributes

 _next_id
 _sets

Detailed Description

Track

    Provides:

    Methods:

    o __init__(self, name=None, ...) Called on instantiation

    o add_set(self, set)    Add a FeatureSet or GraphSet to the diagram

    o del_set(self, set_id) Delete a FeatureSet or GraphSet from the
                            diagram

    o get_sets(self)    Returns a list of the sets in the track

    o get_ids(self)     Returns a list of the ids for sets in the track

    o range(self)   Returns the base/position range covered by the data in
                    the track

    o to_string(self, verbose=0)    Returns a string describing the data in
                                    the track

    o __getitem__(self, key)    Returns the set with the passed id

    o __str__(self) Returns a formatted string describing the track

    Attributes:

    o height    Int describing the relative height to other trackscale_fontsizes in the
                diagram

    o name      String describing the track

    o hide      Boolean, 0 if the track is not to be drawn
    
    o start, end    Integers (or None) specifying start/end to draw just
                    a partial track.

    o greytrack     Boolean, 1 if a grey background to the track is to be
                    drawn

    o greytrack_labels  Int describing how many track-identifying labels
                        should be placed on the track at regular intervals

    o greytrack_font    String describing the font to use for the greytrack
                        labels

    o greytrack_fontsize    Int describing the font size to display the
                            labels on the grey track

    o greytrack_font_rotation   Int describing the angle through which to
                                rotate the grey track labels

    o greytrack_font_color     colors.Color describing the color to draw
                                the grey track labels

    o scale     Boolean, 1 if a scale is to be drawn on the track

    o scale_format  String, defaults to None, when scale values are written
                    as numerals.  Setting this to 'SInt' invokes SI
                    unit-like multiples, such as Mbp, Kbp and so on.

    o scale_color  colors.Color to draw the elemnts of the scale

    o scale_font    String describing the font to use for the scale labels

    o scale_fontsize    Int describing the size of the scale label font

    o scale_fontangle   Int describing the angle at which to draw the scale
                        labels (linear only)

    o scale_ticks       Boolean, 1 if ticks should be drawn at all on the
                        scale

    o scale_largeticks  Float (0->1) describing the height of large
                        scale ticks relative to the track height.

    o scale_smallticks  Float (0->1) describing the height of large
                        scale ticks relative to the track height.

    o scale_largetick_interval  Int, describing the number of bases that
                                should separate large ticks

    o scale_smalltick_interval  Int, describing the number of bases that
                                should separate small ticks

    o scale_largetick_labels    Boolean describing whether position labels
                                should be written over large ticks
                                
    o scale_smalltick_labels    Boolean describing whether position labels
                                should be written over small ticks

    o axis_labels       Boolean describing whether the value labels should
                        be placed on the Y axes

Definition at line 37 of file _Track.py.


Constructor & Destructor Documentation

def Bio.Graphics.GenomeDiagram._Track.Track.__init__ (   self,
  name = None,
  height = 1,
  hide = 0,
  greytrack = 0,
  greytrack_labels = 5,
  greytrack_fontsize = 8,
  greytrack_font = 'Helvetica',
  greytrack_font_rotation = 0,
  greytrack_font_color = colors.Color(0.6, 0.6,
  scale = 1,
  scale_format = None,
  scale_color = colors.black,
  scale_font = 'Helvetica',
  scale_fontsize = 6,
  scale_fontangle = 45,
  scale_largeticks = 0.5,
  scale_ticks = 1,
  scale_smallticks = 0.3,
  scale_largetick_interval = 1e6,
  scale_smalltick_interval = 1e4,
  scale_largetick_labels = 1,
  scale_smalltick_labels = 0,
  axis_labels = 1,
  start = None,
  end = None,
  greytrack_font_colour = None,
  scale_colour = None 
)
__init__(self, name=None, ...)

    o height    Int describing the relative height to other tracks in the
        diagram

    o name      String describing the track

    o hide      Boolean, 0 if the track is not to be drawn

    o greytrack     Boolean, 1 if a grey background to the track is to be
            drawn

    o greytrack_labels  Int describing how many track-identifying labels
                should be placed on the track at regular intervals

    o greytrack_font    String describing the font to use for the greytrack
                labels

    o greytrack_fontsize    Int describing the font size to display the
                    labels on the grey track

    o greytrack_font_rotation   Int describing the angle through which to
                        rotate the grey track labels

    o greytrack_font_color     colors.Color describing the color to draw
                       the grey track labels (overridden by
                       backwards compatible argument with UK
                       spelling, colour).

    o scale     Boolean, 1 if a scale is to be drawn on the track

    o scale_color  colors.Color to draw the elemnts of the scale
           (overridden by backwards compatible argument with UK
           spelling, colour).

    o scale_font    String describing the font to use for the scale labels

    o scale_fontsize    Int describing the size of the scale label font

    o scale_fontangle   Int describing the angle at which to draw the scale
                labels (linear only)

    o scale_ticks       Boolean, 1 if ticks should be drawn at all on the
                scale

    o scale_largeticks  Float (0->1) describing the height of large
                scale ticks relative to the track height.

    o scale_smallticks  Float (0->1) describing the height of large
                scale ticks relative to the track height.

    o scale_largetick_interval  Int, describing the number of bases that
                        should separate large ticks

    o scale_smalltick_interval  Int, describing the number of bases that
                        should separate small ticks

    o scale_largetick_labels    Boolean describing whether position labels
                        should be written over large ticks
                        
    o scale_smalltick_labels    Boolean describing whether position labels
                        should be written over small ticks

    o name          String to help identify the track
    
    o height        Relative height to draw the track

    o axis_labels       Boolean describing whether the value labels should
                be placed on the Y axes

Definition at line 145 of file _Track.py.

00145 
00146                  greytrack_font_colour = None, scale_colour=None):
00147         """ __init__(self, name=None, ...)
00148 
00149             o height    Int describing the relative height to other tracks in the
00150                         diagram
00151 
00152             o name      String describing the track
00153 
00154             o hide      Boolean, 0 if the track is not to be drawn
00155 
00156             o greytrack     Boolean, 1 if a grey background to the track is to be
00157                             drawn
00158 
00159             o greytrack_labels  Int describing how many track-identifying labels
00160                                 should be placed on the track at regular intervals
00161 
00162             o greytrack_font    String describing the font to use for the greytrack
00163                                 labels
00164 
00165             o greytrack_fontsize    Int describing the font size to display the
00166                                     labels on the grey track
00167 
00168             o greytrack_font_rotation   Int describing the angle through which to
00169                                         rotate the grey track labels
00170 
00171             o greytrack_font_color     colors.Color describing the color to draw
00172                                        the grey track labels (overridden by
00173                                        backwards compatible argument with UK
00174                                        spelling, colour).
00175 
00176             o scale     Boolean, 1 if a scale is to be drawn on the track
00177 
00178             o scale_color  colors.Color to draw the elemnts of the scale
00179                            (overridden by backwards compatible argument with UK
00180                            spelling, colour).
00181 
00182             o scale_font    String describing the font to use for the scale labels
00183 
00184             o scale_fontsize    Int describing the size of the scale label font
00185 
00186             o scale_fontangle   Int describing the angle at which to draw the scale
00187                                 labels (linear only)
00188 
00189             o scale_ticks       Boolean, 1 if ticks should be drawn at all on the
00190                                 scale
00191 
00192             o scale_largeticks  Float (0->1) describing the height of large
00193                                 scale ticks relative to the track height.
00194 
00195             o scale_smallticks  Float (0->1) describing the height of large
00196                                 scale ticks relative to the track height.
00197 
00198             o scale_largetick_interval  Int, describing the number of bases that
00199                                         should separate large ticks
00200 
00201             o scale_smalltick_interval  Int, describing the number of bases that
00202                                         should separate small ticks
00203 
00204             o scale_largetick_labels    Boolean describing whether position labels
00205                                         should be written over large ticks
00206                                         
00207             o scale_smalltick_labels    Boolean describing whether position labels
00208                                         should be written over small ticks
00209 
00210             o name          String to help identify the track
00211             
00212             o height        Relative height to draw the track
00213 
00214             o axis_labels       Boolean describing whether the value labels should
00215                                 be placed on the Y axes
00216         """
00217         #Let the UK spelling (colour) override the USA spelling (color)
00218         if greytrack_font_colour is not None:
00219             greytrack_font_color = greytrack_font_colour
00220         if scale_colour is not None:
00221             scale_color = scale_colour
00222 
00223         self._next_id = 0       # This will count sets as they are added to the track
00224         self._sets = {}         # Holds sets, keyed by unique ID
00225 
00226         # Assign attribute values from instantiation
00227         self.height = height
00228         if name is not None:
00229             self.name = str(name)
00230         else:
00231             self.name = "Track"
00232         self.hide = hide
00233         self.start = start
00234         self.end = end
00235 
00236         # Attributes for the grey track background and labels
00237         self.greytrack = greytrack
00238         self.greytrack_labels = greytrack_labels
00239         self.greytrack_fontsize = greytrack_fontsize
00240         self.greytrack_font = greytrack_font
00241         self.greytrack_font_rotation = greytrack_font_rotation
00242         self.greytrack_fontcolor = greytrack_font_color
00243 
00244         # Attributes for the track scale
00245         self.scale = scale
00246         self.scale_format = scale_format
00247         self.scale_color = scale_color
00248         self.scale_font = scale_font
00249         self.scale_fontsize = scale_fontsize
00250         self.scale_fontangle = scale_fontangle
00251         self.scale_ticks = scale_ticks
00252         self.scale_largeticks = scale_largeticks
00253         self.scale_smallticks = scale_smallticks
00254         self.scale_largetick_interval = scale_largetick_interval
00255         self.scale_smalltick_interval = scale_smalltick_interval
00256         self.scale_largetick_labels = scale_largetick_labels
00257         self.scale_smalltick_labels = scale_smalltick_labels
00258         self.axis_labels = axis_labels
00259         

Here is the caller graph for this function:


Member Function Documentation

__getitem__(self, key) -> int

    o key       The id of a set in the track

    Return the set with the passed id

Definition at line 361 of file _Track.py.

00361 
00362     def __getitem__(self, key):
00363         """ __getitem__(self, key) -> int
00364 
00365             o key       The id of a set in the track
00366 
00367             Return the set with the passed id
00368         """
00369         return self._sets[key]
00370 

Here is the caller graph for this function:

__str__(self) -> ""

    Returns a formatted string with information about the Track

Definition at line 371 of file _Track.py.

00371 
00372     def __str__(self):
00373         """ __str__(self) -> ""
00374 
00375             Returns a formatted string with information about the Track
00376         """
00377         outstr = ["\n<%s: %s>" % (self.__class__, self.name)]
00378         outstr.append("%d sets" % len(self._sets))
00379         return "\n".join(outstr)
00380     
00381 

Here is the caller graph for this function:

add_set(self, set)

    o set       A FeatureSet or GraphSet object

    Add a preexisting FeatureSet or GraphSet object to the track

Definition at line 260 of file _Track.py.

00260 
00261     def add_set(self, set):
00262         """ add_set(self, set)
00263 
00264             o set       A FeatureSet or GraphSet object
00265 
00266             Add a preexisting FeatureSet or GraphSet object to the track
00267         """
00268         set.id = self._next_id          # Assign unique id to set
00269         set.parent = self               # Make set's parent this track
00270         self._sets[self._next_id] = set # Add set, keyed by unique id
00271         self._next_id += 1              # Increment unique set ids
00272 

del_set(self, set_id)

    o set_id        The unique id for the set in this track

    Remove the set with the passed id from the track

Definition at line 292 of file _Track.py.

00292 
00293     def del_set(self, set_id):
00294         """ del_set(self, set_id)
00295 
00296             o set_id        The unique id for the set in this track
00297 
00298             Remove the set with the passed id from the track
00299         """
00300         del self._sets[set_id]
00301 

get_ids(self) -> [int, int, ...]

    Return the ids of all sets contained in this track

Definition at line 310 of file _Track.py.

00310 
00311     def get_ids(self):
00312         """ get_ids(self) -> [int, int, ...]
00313 
00314             Return the ids of all sets contained in this track
00315         """
00316         return self._sets.keys()
00317 

get_sets(self) -> FeatureSet or GraphSet

    Return the sets contained in this track

Definition at line 302 of file _Track.py.

00302 
00303     def get_sets(self):
00304         """ get_sets(self) -> FeatureSet or GraphSet
00305 
00306             Return the sets contained in this track
00307         """
00308         return self._sets.values()
00309 

def Bio.Graphics.GenomeDiagram._Track.Track.new_set (   self,
  type = 'feature',
  args 
)
new_set(self, type='feature') -> FeatureSet or GraphSet

    Create a new FeatureSet or GraphSet object, add it to the
    track, and return for user manipulation

Definition at line 273 of file _Track.py.

00273 
00274     def new_set(self, type='feature', **args):
00275         """ new_set(self, type='feature') -> FeatureSet or GraphSet
00276 
00277             Create a new FeatureSet or GraphSet object, add it to the
00278             track, and return for user manipulation
00279         """
00280         type_dict = {'feature': FeatureSet,
00281                      'graph': GraphSet
00282                      }        
00283         set = type_dict[type]()
00284         for key in args:
00285             setattr(set, key, args[key])        
00286         set.id = self._next_id          # Assign unique id to set
00287         set.parent = self               # Make set's parent this track
00288         self._sets[self._next_id] = set # Add set, keyed by unique id
00289         self._next_id += 1              # Increment unique set ids
00290         return set
00291 

range(self) -> (int, int)

    Returns the lowest and highest base (or mark) numbers as a tuple

Definition at line 318 of file _Track.py.

00318 
00319     def range(self):
00320         """ range(self) -> (int, int)
00321 
00322             Returns the lowest and highest base (or mark) numbers as a tuple
00323         """
00324         lows, highs = [], []            # Holds set of low and high values from sets
00325         if self.start is not None:
00326             lows.append(self.start)
00327         if self.end is not None:
00328             highs.append(self.end)
00329         for set in self._sets.values():
00330             low, high = set.range()     # Get each set range
00331             lows.append(low)
00332             highs.append(high)
00333         if lows:
00334             low = min(lows)
00335         else:
00336             low = None
00337         if highs:
00338             high = max(highs)
00339         else:
00340             high = None
00341         return low, high  # Return lowest and highest values
00342     

def Bio.Graphics.GenomeDiagram._Track.Track.to_string (   self,
  verbose = 0 
)
to_string(self, verbose=0) -> ""

    o verbose       Boolean indicating whether a short or complete
            account of the track is required

    Returns a formatted string with information about the track

Definition at line 343 of file _Track.py.

00343 
00344     def to_string(self, verbose=0):
00345         """ to_string(self, verbose=0) -> ""
00346 
00347             o verbose       Boolean indicating whether a short or complete
00348                             account of the track is required
00349 
00350             Returns a formatted string with information about the track
00351         """
00352         if not verbose:             # Return the short description
00353             return "%s" % self      # Use __str__ method instead
00354         else:                       # Return the long desription
00355             outstr = ["\n<%s: %s>" % (self.__class__, self.name)]
00356             outstr.append("%d sets" % len(self._sets))
00357             for key in self._sets:
00358                 outstr.append("set: %s" % self._sets[key])
00359             return "\n".join(outstr)      
00360 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 222 of file _Track.py.

Definition at line 223 of file _Track.py.

Definition at line 257 of file _Track.py.

Definition at line 233 of file _Track.py.

Definition at line 236 of file _Track.py.

Definition at line 239 of file _Track.py.

Definition at line 240 of file _Track.py.

Definition at line 241 of file _Track.py.

Definition at line 238 of file _Track.py.

Definition at line 237 of file _Track.py.

Definition at line 226 of file _Track.py.

Definition at line 231 of file _Track.py.

Definition at line 228 of file _Track.py.

Definition at line 244 of file _Track.py.

Definition at line 246 of file _Track.py.

Definition at line 247 of file _Track.py.

Definition at line 249 of file _Track.py.

Definition at line 248 of file _Track.py.

Definition at line 245 of file _Track.py.

Definition at line 253 of file _Track.py.

Definition at line 255 of file _Track.py.

Definition at line 251 of file _Track.py.

Definition at line 254 of file _Track.py.

Definition at line 256 of file _Track.py.

Definition at line 252 of file _Track.py.

Definition at line 250 of file _Track.py.

Definition at line 232 of file _Track.py.


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