Package Bio :: Package Graphics :: Package GenomeDiagram :: Module _Graph :: Class GraphData
[hide private]
[frames] | no frames]

Class GraphData

source code

object --+
         |
        GraphData

GraphData

Provides:

Methods:

o __init__(self, id=None, data=None, name=None, style='bar',
         color=colors.lightgreen, altcolor=colors.darkseagreen)
         Called on instantiation

o set_data(self, data)  Load the object with data to be plotted

o get_data(self)    Returns the data to be plotted as a list of
                    (position, value) tuples

o add_point(self, point)    Add a single point to the data set

o quartiles(self)   Returns a tuple of the data quartiles

o range(self)   Returns a tuple of the base range covered by the graph
                data

o mean(self)    Returns a float of the mean data point value

o stdev(self)   Returns the sample standard deviation of the data values

o __len__(self) Returns the length of sequence covered by the data

o __getitem__(self, index)  Returns the value at the base specified,
                            or graph data in the base range

o __str__(self) Returns a formatted string describing the graph data

Attributes:

o id    Unique identifier for the data

o data  Dictionary of describing the data, keyed by position

o name  String describing the data

o style String ('bar', 'heat', 'line') describing how to draw the data

o poscolor     colors.Color for drawing high (some styles) or all
                values

o negcolor     colors.Color for drawing low values (some styles)

o linewidth     Int, thickness to draw the line in 'line' styles

Instance Methods [hide private]
 
__init__(self, id=None, data=None, name=None, style='bar', color=colors.lightgreen, altcolor=colors.darkseagreen)
o id Unique ID for the graph
source code
 
_set_centre(self, value) source code
 
set_data(self, data)
o data List of (position, value) tuples
source code
[(int, float), (int, float), ...]
get_data(self)
Return data as a list of sorted (position, value) tuples
source code
 
add_point(self, point)
o point (position, value) tuple
source code
(float, float, float, float, float)
quartiles(self)
Returns the (minimum, lowerQ, medianQ, upperQ, maximum) values as a tuple
source code
(int, int)
range(self)
Returns the range of the data, i.e.
source code
Float
mean(self)
Returns the mean value for the data points
source code
Float
stdev(self)
Returns the sample standard deviation for the data
source code
Int
__len__(self)
Returns the number of points in the data set
source code
Float or list of tuples
__getitem__(self, index)
Given an integer representing position on the sequence returns a float - the data value at the passed position.
source code
""
__str__(self)
Returns a string describing the graph data
source code

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

Properties [hide private]
  centre
Backwards compatible alias for center (DEPRECATED)

Inherited from object: __class__

Method Details [hide private]

__init__(self, id=None, data=None, name=None, style='bar', color=colors.lightgreen, altcolor=colors.darkseagreen)
(Constructor)

source code 
o id    Unique ID for the graph

o data  List of (position, value) tuples

o name  String describing the graph

o style String describing the presentation style ('bar', 'line',
        'heat')

o color   colors.Color describing the color to draw all or the
          'high' (some styles) values (overridden by backwards
          compatible argument with UK spelling, colour).

o altcolor colors.Color describing the color to draw the 'low'
           values (some styles only) (overridden by backwards
           compatible argument with UK spelling, colour).

o center Value at which x-axis crosses y-axis (overridden by
         backwards comparible argument with UK spelling, centre).

Overrides: object.__init__

set_data(self, data)

source code 

o data List of (position, value) tuples

Add data with a list of (position, value) tuples

add_point(self, point)

source code 

o point (position, value) tuple

Add a single point to the set of data

range(self)

source code 

Returns the range of the data, i.e. its start and end points on the genome as a (start, end) tuple

Returns: (int, int)

__getitem__(self, index)
(Indexing operator)

source code 

Given an integer representing position on the sequence returns a float - the data value at the passed position.

If a slice, returns graph data from the region as a list or (position, value) tuples. Slices with step are not supported.

Returns the data value at the passed position

Returns: Float or list of tuples

__str__(self)
(Informal representation operator)

source code 

Returns a string describing the graph data

Returns: ""
Overrides: object.__str__

Property Details [hide private]

centre

Backwards compatible alias for center (DEPRECATED)

Get Method:
unreachable(self)
Set Method:
_set_centre(self, value)