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

Class Diagram

source code

object --+
         |
        Diagram

Diagram container.

Arguments:
Instance Methods [hide private]
 
__init__(self, name=None, 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=False, fragments=10, fragment_size=0.9, track_size=0.75, circular=True, circle_core=0.0)
Called on instantiation.
source code
 
set_all_tracks(self, attr, value)
Set the passed attribute of all tracks in the set to the passed value.
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, circular=None, circle_core=None, cross_track_links=None)
Draw the diagram, with passed parameters overriding existing attributes.
source code
 
write(self, filename='test1.ps', output='PS', dpi=72)
Writes the drawn diagram to a specified file, in a specified format.
source code
 
write_to_string(self, output='PS', dpi=72)
Returns a byte string containing the diagram in the requested format.
source code
 
add_track(self, track, track_level)
Adds a Track object to the diagram.
source code
 
new_track(self, track_level, **args)
Add a new Track to the diagram at a given level.
source code
 
del_track(self, track_level)
Removes the track to be drawn at a particular level on the diagram.
source code
 
get_tracks(self)
Returns a list of the tracks contained in the diagram.
source code
 
move_track(self, from_level, to_level)
Moves a track from one level on the diagram to another.
source code
 
renumber_tracks(self, low=1, step=1)
Renumbers all tracks consecutively.
source code
 
get_levels(self)
Return a sorted list of levels occupied by tracks in the diagram.
source code
 
get_drawn_levels(self)
Return a sorted list of levels occupied by tracks.
source code
 
range(self)
Returns lowest and highest base numbers from track features.
source code
 
__getitem__(self, key)
Returns the track contained at the level of the passed key.
source code
 
__str__(self)
Returns a formatted string describing the diagram.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name=None, 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=False, fragments=10, fragment_size=0.9, track_size=0.75, circular=True, circle_core=0.0)
(Constructor)

source code 

Called on instantiation.

gdd = Diagram(name=None)

Overrides: object.__init__

set_all_tracks(self, attr, value)

source code 

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

Arguments:
  • attr - An attribute of the Track class.
  • value - The value to set that attribute.

set_all_tracks(self, attr, value)

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, circular=None, circle_core=None, cross_track_links=None)

source code 

Draw the diagram, with passed parameters overriding existing attributes.

gdd.draw(format='circular')

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

source code 

Writes the drawn diagram to a specified file, in a specified format.

Arguments:
  • filename - a string indicating the name of the output file, or a handle to write to.
  • output - a 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.
  • dpi - an integer. Resolution (dots per inch) for bitmap formats.
Returns:
No return value.

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

write_to_string(self, output='PS', dpi=72)

source code 

Returns a byte string containing the diagram in the requested format.

Arguments:
  • output - a string indicating output format, one of PS, PDF, SVG, JPG, BMP, GIF, PNG, TIFF or TIFF (as specified for the write method).
  • dpi - Resolution (dots per inch) for bitmap formats.
Returns:
Return the completed drawing as a bytes string in a prescribed format.

add_track(self, track, track_level)

source code 

Adds a Track object to the diagram.

It also accepts instructions to place it at a particular level on the diagram.

Arguments:
  • track - Track object to draw.
  • track_level - an integer. The level at which the track will be drawn (above an arbitrary baseline).

add_track(self, track, track_level)

new_track(self, track_level, **args)

source code 

Add a new Track to the diagram at a given level.

The track is returned for further user manipulation.

Arguments:
  • track_level - an integer. The level at which the track will be drawn (above an arbitrary baseline).

new_track(self, track_level)

del_track(self, track_level)

source code 

Removes the track to be drawn at a particular level on the diagram.

Arguments:
  • track_level - an integer. The level of the track on the diagram to delete.

del_track(self, track_level)

get_tracks(self)

source code 

Returns a list of the tracks contained in the diagram.

get_tracks(self)

move_track(self, from_level, to_level)

source code 

Moves a track from one level on the diagram to another.

Arguments:
  • from_level - an integer. The level at which the track to be moved is found.
  • to_level - an integer. The level to move the track to.

move_track(self, from_level, to_level)

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

source code 

Renumbers all tracks consecutively.

Optionally from a passed lowest number.

Arguments:
  • low - an integer. The track number to start from.
  • step - an integer. The track interval for separation of tracks.

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

get_levels(self)

source code 

Return a sorted list of levels occupied by tracks in the diagram.

get_levels(self)

get_drawn_levels(self)

source code 

Return a sorted list of levels occupied by tracks.

These tracks are not explicitly hidden.

get_drawn_levels(self)

range(self)

source code 

Returns lowest and highest base numbers from track features.

Returned type is a tuple.

range(self)

__getitem__(self, key)
(Indexing operator)

source code 

Returns the track contained at the level of the passed key.

Arguments:
  • key - The id of a track in the diagram.

__getitem__(self, key)

__str__(self)
(Informal representation operator)

source code 

Returns a formatted string describing the diagram.

__str__(self)

Overrides: object.__str__