Package Bio :: Package Graphics :: Package GenomeDiagram :: Module _Diagram :: Class Diagram
[hide private]
[frames] | no frames]

Class Diagram

source code

object --+
         |
        Diagram

Diagram

Provides:

Attributes:

o name         String, identifier for the diagram

o tracks       List of Track objects comprising the diagram 

o format       String, format of the diagram (circular/linear)

o pagesize     String, the pagesize of output

o orientation  String, the page orientation (landscape/portrait)

o x            Float, the proportion of the page to take up with even 
                      X margins

o y            Float, the proportion of the page to take up with even 
                      Y margins

o xl           Float, the proportion of the page to take up with the 
                      left X margin

o xr           Float, the proportion of the page to take up with the 
                      right X margin

o yt           Float, the proportion of the page to take up with the 
                      top Y margin

o yb           Float, the proportion of the page to take up with the 
                      bottom Y margin

o start        Int, the base/aa position to start the diagram at

o end          Int, the base/aa position to end the diagram at

o tracklines   Boolean, True if track guidelines are to be drawn

o fragments    Int, for a linear diagram, the number of equal divisions
                        into which the sequence is divided

o fragment_size Float, the proportion of the space available to each 
                           fragment that should be used in drawing

o track_size   Float, the proportion of the space available to each 
                          track that should be used in drawing

o circular     Boolean, True if the genome/sequence to be drawn is, in 
                        reality, circular.  

Methods:

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

o draw(self, format='circular', pagesize='A3', orientation='landscape',
     x=0.05, y=0.05, xl=None, xr=None, yt=None, yb=None,
     start=None, end=None, tracklines=0, fragments=10,
     fragment_size=0.9, track_size=0.75) Instructs the package to draw
     the diagram

o write(self, filename='test1.ps', output='PS') Writes the drawn
    diagram to a specified file, in a specified format.

o add_track(self, track, track_level) Adds a Track object to the
    diagram, with instructions to place it at a particular level on
    the diagram

o del_track(self, track_level) Removes the track that is to be drawn
    at a particular level on the diagram

o get_tracks(self) Returns the list of Track objects to be drawn
    contained in the diagram

o renumber_tracks(self, low=1) Renumbers all tracks consecutively,
    optionally from a passed lowest number

o get_levels(self) Returns a list of levels currently occupied by
    Track objects

o get_drawn_levels(self) Returns a list of levels currently occupied
    by Track objects that will be shown in the drawn diagram (i.e.
    are not hidden)

o range(self) Returns the lowest- and highest-numbered positions
    contained within features in all tracks on the diagram as a tuple.

o __getitem__(self, key) Returns the track contained at the level of
    the passed key

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

Instance Methods [hide private]
 
__init__(self, name=None)
o name String describing the diagram
source code
 
set_all_tracks(self, attr, value)
o attr An attribute of the Track class
source code
 
draw(self, format=None, pagesize=None, orientation=None, x=None, y=None, xl=None, xr=None, yt=None, yb=None, start=None, end=None, tracklines=None, fragments=None, fragment_size=None, track_size=None)
Draws the diagram using the passed parameters, if any, to override previous settings for the diagram object.
source code
 
write(self, filename='test1.ps', output='PS', dpi=72)
o filename String indicating the name of the output file, or a handle to write to.
source code
 
write_to_string(self, output='PS')
o output String indicating output format, one of PS, PDF, SVG, JPG, BMP, GIF, PNG, TIFF or TIFF (as specified for the write method).
source code
 
add_track(self, track, track_level)
o track Track object to draw
source code
Track
new_track(self, track_level)
o track_level Int, the level at which the track will be drawn (above an arbitrary baseline)
source code
 
del_track(self, track_level)
o track_level Int, the level of the track on the diagram to delete
source code
list
get_tracks(self)
Returns a list of the tracks contained in the diagram
source code
 
move_track(self, from_level, to_level)
o from_level Int, the level at which the track to be moved is found
source code
 
renumber_tracks(self, low=1, step=1)
o low Int, the track number to start from
source code
[int, int, ...]
get_levels(self)
Return a sorted list of levels occupied by tracks in the diagram
source code
[int, int, ...]
get_drawn_levels(self)
Return a sorted list of levels occupied by tracks that are not explicitly hidden
source code
(int, int)
range(self)
Returns the lowest and highest base (or mark) numbers containd in track features as a tuple
source code
Track
__getitem__(self, key)
o key The id of a track in the diagram
source code
""
__str__(self)
Returns a formatted string with information about the diagram
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name=None)
(Constructor)

source code 
o name  String describing the diagram

o format    String: 'circular' or 'linear', depending on the sort of
            diagram required

o pagesize  String describing the ISO size of the image, or a tuple
            of pixels

o orientation   String describing the required orientation of the
                final drawing ('landscape' or 'portrait')

o x         Float (0->1) describing the relative size of the X
            margins to the page

o y         Float (0->1) describing the relative size of the Y
            margins to the page

o xl        Float (0->1) describing the relative size of the left X
            margin to the page (overrides x)

o xl        Float (0->1) describing the relative size of the left X
            margin to the page (overrides x)

o xr        Float (0->1) describing the relative size of the right X
            margin to the page (overrides x)

o yt        Float (0->1) describing the relative size of the top Y
            margin to the page (overrides y)

o yb        Float (0->1) describing the relative size of the lower Y
            margin to the page (overrides y)

o start     Int, the position to begin drawing the diagram at


o end       Int, the position to stop drawing the diagram at

o tracklines    Boolean flag to show (or not) lines delineating 
            tracks on the diagram

o fragments Int, for linear diagrams, the number of sections into
            which to break the sequence being drawn

o fragment_size     Float (0->1), for linear diagrams, describing 
                    the proportion of space in a fragment to take
                    up with tracks

o track_size        Float (0->1) describing the proportion of space
                    in a track to take up with sigils

o circular  Boolean flag to indicate whether the sequence being
            drawn is circular
            

Overrides: object.__init__

set_all_tracks(self, attr, value)

source code 

o attr An attribute of the Track class

o value The value to set that attribute

Set the passed attribute of all tracks in the set to the passed value

write(self, filename='test1.ps', output='PS', dpi=72)

source code 
o filename      String indicating the name of the output file,
                or a handle to write to.

o output        String indicating output format, one of PS, PDF,
                SVG, or provided the ReportLab renderPM module is
                installed, one of the bitmap formats JPG, BMP,
                GIF, PNG, TIFF or TIFF.  The format can be given
                in upper or lower case.

o dpi           Resolution (dots per inch) for bitmap formats.

Write the completed drawing out to a file in a prescribed format

No return value.

write_to_string(self, output='PS')

source code 
o output        String indicating output format, one of PS, PDF,
                SVG, JPG, BMP, GIF, PNG, TIFF or TIFF (as
                specified for the write method).

o dpi           Resolution (dots per inch) for bitmap formats.

Return the completed drawing as a string in a prescribed format

add_track(self, track, track_level)

source code 
o track         Track object to draw

o track_level   Int, the level at which the track will be drawn
                (above an arbitrary baseline)

Add a pre-existing Track to the diagram at a given level

new_track(self, track_level)

source code 
o track_level   Int, the level at which the track will be drawn
                (above an arbitrary baseline)

Add a new Track to the diagram at a given level and returns it for
further user manipulation.

Returns: Track

del_track(self, track_level)

source code 

o track_level Int, the level of the track on the diagram to delete

Remove the track at the passed level from the diagram

move_track(self, from_level, to_level)

source code 
o from_level    Int, the level at which the track to be moved is
                found

o to_level      Int, the level to move the track to

Moves a track from one level on the diagram to another

renumber_tracks(self, low=1, step=1)

source code 

o low Int, the track number to start from

o step Int, the track interval for separation of tracks

Reassigns all the tracks to run consecutively from the lowest value (low)

__getitem__(self, key)
(Indexing operator)

source code 

o key The id of a track in the diagram

Return the Track object with the passed id

Returns: Track

__str__(self)
(Informal representation operator)

source code 

Returns a formatted string with information about the diagram

Returns: ""
Overrides: object.__str__