Table Of Contents

This Page

API

Release:1.0b
Date:September 08, 2011

Panel

Panel

class biograpy.drawer.Panel(fig_width=1500, fig_height=None, fig_dpi=80, **kwargs)

Bases: object

The Panel acts as a collector of tracks objects, and accounts for their correct arrangement and figure saving A Panel must be initialized before the tracks and features are created to link the drawn artists to the Panel

panel = Panel(fig_width=800, fig_height=600, fig_dpi=80)

gives a Panel object with a 800x600 pixel canvas at 80 dpi resolution

Valid keyword arguments for Panel are:

Key Description
fig_height figure height in pixel, default is 1500
fig_width figure width in pixel, default is None and will be autodetermined
fig_dpi default is 80
grid 'major | 'minor' | 'both' | None default is 'major'
join_tracks True | False default is False. Will join all tracks showing just the last bottom axis
track_padding track padding in pixel default is 0
start_position start int number for axis tick labels default is 0
padding padding of all the axis with respect to the figure border default is fig_width*.02
figure_bottom_space define the distance of the last bottom axis from the figure bottom in pixel. Default is 0 . Use to correct too long figure width coming from autodetermined fig_width
xmin int minimum value of the X axes, use to plot just a part of the drawing, default is None
xmax int maximum value of the X axes, use to plot just a part of the drawing, default is None
add_track(track)
Accepts any tracks object. the track should already contains its features
append(*args, **kwargs)
Accepts any tracks object. the track should already contains its features
close()
Close to free the panel. Use it before starting a new drawing in the same process. Typical usage scenario is a web server.
extend(tracks)
Accepts a sequence of tracks objects
save(output, html_target='_self', xmin=None, xmax=None, **kwargs)

input parameters are:

Property Description
output a string containing the file path or a file-like handler
format a format must be specified if a file handler is passed supported formats are: emf, eps, pdf, png, ps, raw, rgba, svg, svgz
html_target '_self' | '_blank' | '_parent' | '_top' default is '_self' . The html target value for generated hyperlinks. set to '_blank' to open in a new browser windows
xmin int minimum value of the X axes, use to plot just a part of the drawing, default is None
xmax int maximum value of the X axes, use to plot just a part of the drawing, default is None

Tracks

BaseTrack

class biograpy.tracks.BaseTrack(*args, **kwargs)

Bases: object

The BaseTrack acts as a collector of features objects, and accounts for their ordering and color. The BaseTrack is a functiona baseclass to use in order to generate additional tracks. Track object have to be added to a Panel instance once they are filled with features

track = BaseTrack(name = 'test')

gives a empty track with default values named 'test'

Valid keyword arguments for BaseTrack are:

Key Description
name Define the track name
show_name 'top' | 'bottom' | None , default is 'top' . If a track name is specified set where the name wil be displayed
name_font_size default 'small', accepts font size parameter as in matplotlib
name_font_family default 'serif', accepts font family parameter as in matplotlib
name_font_weight default 'semibold', accepts font weight parameter as in matplotlib
draw_axis a list contanining this possible values: 'right' | 'left' | 'top' | 'bottom' | 'force no axis' . default is ['bottom']. each specified axis position will be drawn. if 'force no axis' is specified no axis will be shown, this is only needed if tracks are requested to be joined.
x_use_sequence if a string iterable is passed it will be used as X tick labels
xticks_major set X major ticks as in matplotlib
xticks_minor set X minor ticks as in matplotlib
xticklabels_major set X major tick labels as in matplotlib
xticklabels_minor set X minor tick labels as in matplotlib
yticks_major set Y major ticks as in matplotlib
yticks_minor set Y minor ticks as in matplotlib
yticklabels_major set Y major tick labels as in matplotlib
yticklabels_minor set Y minor tick labels as in matplotlib
show_xticklabels True | False. default is True
show_yticklabels True | False. default is False
tickfontsize_major default 'x-small', accepts font size parameter as in matplotlib
tickfontsize_minor default 'xx-small', accepts font size parameter as in matplotlib
track_height specify the the axis heigth by pixel number. default is 0 and will be set automatically
max_score default is None, if not specified will be dynamically computed basing on feature scores
min_score default is None, if not specified will be dynamically computed basing on feature scores
norm score normalizing function. default is None and will be created using maximum and minimum feature scores. could be any function taking a int or float value an returning a float between 0. and 1.
cm matplotlib colormap name to use for score-based feature color. default is 'Accent'
draw_cb True | False. default is False. draws a colorbar inside the track to explain score-based feature color
cb_alpha colorbar alpha value, a float between 0. and 1.
cb_label colorbar label, a string
track_lines internal parameter used to defin track heigth in automatic mode. default is 1*number_of feature_lines. if forced can results in wrong feature proportions
sort_by

'score' | 'length' | 'collapse' | None. default is 'collapse'

  • 'collapse' will arrange features in the minimum vertical space possible.
  • 'score' will arrange features basing on score values.
  • 'length' will arrange features basing on feature length.
  • None will arrange features basing in the order they are passed to the track.
sort_order 'top' | 'bottom', default is 'top'. use to reverse order
add_feature(feature)
add features object to track.
append(feature)
add features object to track. same as add_feature()
extend(features)
add a sequence of features to track

PlotTrack

class biograpy.tracks.PlotTrack(*args, **kwargs)

Bases: biograpy.tracks.BaseTrack

The PlotTrack acts as a collector of features objects that encodes for plots. Track object have to be added to a Panel instance once they are filled with features

track = PlotTrack(name = 'test', ymin= 0, ymax = 10)

gives a empty plot track named 'test' with y axis ranging from 0 to 10.

Valid keyword arguments for PlotTrack are:

Key Description
name Define the track name
show_name 'top' | 'bottom' | None , default is 'top' . If a track name is specified set where the name wil be displayed
name_font_size default 'small', accepts font size parameter as in matplotlib
name_font_family default 'serif', accepts font family parameter as in matplotlib
name_font_weight default 'semibold', accepts font weight parameter as in matplotlib
draw_axis a list contanining this possible values: 'right' | 'left' | 'top' | 'bottom' | 'force no axis' . default is ['left', 'bottom']. each specified axis position will be drawn. if 'force no axis' is specified no axis will be shown, this is only needed if tracks are requested to be joined.
ymin default is -1. define minimum Y value to plot.
ymax default is 1. define maximum Y value to plot.
x_use_sequence if a string iterable is passed it will be used as X tick labels
xticks_major set X major ticks as in matplotlib
xticks_minor set X minor ticks as in matplotlib
xticklabels_major set X major tick labels as in matplotlib
xticklabels_minor set X minor tick labels as in matplotlib
yticks_major set Y major ticks as in matplotlib
yticks_minor set Y minor ticks as in matplotlib
yticklabels_major set Y major tick labels as in matplotlib
yticklabels_minor set Y minor tick labels as in matplotlib
show_xticklabels True | False. default is True
show_yticklabels True | False. default is True
tickfontsize_major default 'x-small', accepts font size parameter as in matplotlib
tickfontsize_minor default 'xx-small', accepts font size parameter as in matplotlib
track_height specify the the axis heigth by pixel number. default is 0 and will be set automatically
max_score default is None, if not specified will be dynamically computed basing on feature scores
min_score default is None, if not specified will be dynamically computed basing on feature scores
norm score normalizing function. default is None and will be created using maximum and minimum feature scores. could be any function taking a int or float value and returning a float between 0. and 1.
cm matplotlib colormap name to use for score-based feature color. default is 'Accent'
draw_cb True | False. default is False. draws a colorbar inside the track to explain score-based feature color
cb_alpha colorbar alpha value, a float between 0. and 1.
cb_label colorbar label, a string
track_lines default is 4. increase or decrease to make the track bigger or smaller
add_feature(feature)
add features object to track.
append(feature)
add features object to track. same as add_feature()
extend(features)
add a sequence of features to track

Features

BaseGraphicFeature

class biograpy.features.BaseGraphicFeature(**kwargs)

Bases: object

Base class for all GraphicFeature types and is not functional. This class template misses the draw_feature() method that has to be implemented in the full functional classes. To create a new functional GraphicFeature class this conditions must me met:

  • self.draw_feature() must return one or a list of matplotlib Artists in self.patches
  • self.start must return the lower extent of the feature in the coordinate system
  • self.end must return the higher extent of the feature in the coordinate system
  • self.__init__ method must be expanded accordingly to the new input
  • self.draw_feat_name() method can be overridden, but must set a list of matplotlib Annotate objects in self.feat_name

Valid keyword arguments for BaseGraphicFeature are:

Key Description
name a string text that will be drawn under the feature.
type define the GrafhFeature type, is needed by Panel for feature grouping, default is '' can be 'plot' for plot-like features.
score a float value that can be used to color the feature accordingly using a colormap
height feature y axis extension. default is 1
cm matplotlib colormap to use, custom colormap can be easily created but ar not supported right now. A list of default colormaps can be found at: www.scipy.org
color_by_cm True | False, if True set the color by using the colormap. default is True
cm_value float value between 0. and 1. to use for chosing the color from the colormap. default is None
use_score_for_color True | False. if True use the score value to pick a color from the colormap and will ovverride color_by_cm as True. if scores are not between 0 and 1 they can be normalized by using Normalize and LogNorm from matplotlib.colors.
ec define edgecolor as in matplotlib, overrides settings from color_by_cm and use_score_for_color
fc define facecolor as in matplotlib, overrides settings from color_by_cm and use_score_for_color
lw defines edge line width, as in matplotlib
alpha defines facecolor aplha value as in matplotlib
boxstyle default is 'square, pad=0.', accepts any matplotlib FancyBboxPatch input string. take a look at matplotlib docs.
norm normalization function to be used for in feature colormap based coloring. tipically used in plot like features.default is None could be any function taking a int or float value and returning a float between 0. and 1.
url set url fot the feature to be used in htmlmaps or SVG <a> elements.
html_map_extend included text will be added in html area tab, use to add onmouseover events, etc... must be a valid html attrib.
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis

Simple

class biograpy.features.Simple(start, end, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Handle a feature not derived from a SeqFeature. Just need a start and end position. Minimum definition are start and end positions. Usage eg.

features.Simple(start,end,name='factor 7',**kwargs)

draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

GenericSeqFeature

class biograpy.features.GenericSeqFeature(feature, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Handle a feature derived from a Biopython.SeqFeature.SeqFeature as a simple rectangle.

Requires a SeqFeature object in input, start and end will be automatically detected from seqfeature.

Usage eg.

from Bio.SeqFeature import SeqFeature, FeatureLocation 
feat = SeqFeature (FeatureLocation(10,124))
features.GenericSeqFeature(feat,name='factor 7', score=0.2, **kwargs)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

GeneSeqFeature

class biograpy.features.GeneSeqFeature(feature, exons=[], **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws a Gene Feature as an arrow. Requires a SeqFeature with SeqFeature.type = 'gene' and optionally a list of exons SeqFeatures that can be drawn over the gene patch.

Additional valid attributes:
Key Description
head_length defines matplotlib FancyArrow head_length keyword argument to set up gene arrow head length

Usage eg.

from Bio.SeqFeature import SeqFeature, FeatureLocation 
genefeat = SeqFeature (FeatureLocation(103,1053), type = 'gene', strand=1,)
features.GeneSeqFeature(genefeat,name='factor 7', **kwargs)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

PlotFeature

class biograpy.features.PlotFeature(y, x=[], style='-', **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws a lineplot of continuous values for a feature such as an hydrophobicity plot, or prediction confidency values must be used within a PlotTrack.

Y values are necessary If no X values are provided they will be created starting from position 1 for each Y value provided

Additional valid attributes:
Key Description
y list of Y numerical values
x list of X numerical values
style line plotting style as in matplotlib. default is '-'
label set label to be used in PlotTrack legend. if no label is defined for all the features the legend will not be drawn.

Usage eg.

features.PlotFeature([1.3, 2.4, -1,2],  **kwargs)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

BarPlotFeature

class biograpy.features.BarPlotFeature(y, x=[], style='-', **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws a bar plot values for a feature such as prediction confidence values must be used within a PlotTrak to have axix.

Draws a barplot of continuous values for a feature such as prediction confidency values must be used within a PlotTrack.

Y values are necessary If no X values are provided they will be created starting from position 1 for each Y value provided

color_by_cm = True will color each point based on the y values using the supplied colormap cm.

Additional valid attributes:
Key Description
y list of Y numerical values
x list of X numerical values
style line plotting style as in matplotlib. default is '-'
label set label to be used in PlotTrack legend. if no label is defined for all the features the legend will not be drawn.
width as in matplotlib, default is .8
bottom as in matplotlib, default is 0
align as in matplotlib, default is 'center'
xerr as in matplotlib, default is None
yerr as in matplotlib, default is None
ecolor as in matplotlib, default is 'k'
capsize as in matplotlib, default is 1
ls as in matplotlib, default is 'solid'

Usage eg.

feat = features.PlotFeature([1.3, 2.4, -1,2],  **kwargs)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

TextSequence

class biograpy.features.TextSequence(sequence, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws a biological sequence as text at the given positions

Requires a sequence iterable tipically a string.

Additional valid attributes:
Key Description
start feature start position. default is 0
end feature end position. default is self.start +  len(self.sequence)
set_size as in matplotlib, default is 'xx-small'
set_family as in matplotlib, default is 'monospace'
set_weight as in matplotlib, default is 'normal'
va as in matplotlib, default is 'bottom'
ha as in matplotlib, default is 'left'

Usage eg.

features.TextSequence('ATCATGATACTGNCAT',start = 103, **kwargs)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

SegmentedSeqFeature

class biograpy.features.SegmentedSeqFeature(feature, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws a SeqFeature carrying 'join' subfeatures

requires a SeqFeature object carryng 'joins' in SeqFeature.subfeatures, start and end can be supplied or automatically detected from SeqFeature.

Additional valid attributes:
Key Description
start feature start position. default is the minimum value of all SubFeature.location postions
end feature end position. default is the maximum value of all SubFeature.location postions
type feature type
ec default is set to 'k'

Usage eg.

feat = SegmentedSeqFeature(feature,name='factor 7',s)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

CoupledmRNAandCDS

class biograpy.features.CoupledmRNAandCDS(mRNA, CDS, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws an mRNa at a small alpha value, and the corresponding CDS on top of it at alpha = 1. Requires an mRNA SeqFeature object and a CDS seqfeature object. ‘joins’ will be threated as in SegmentedSeqFeature

Additional valid attributes:
Key Description
mRNA_start mRNA feature start position. default is the minimum value of all SubFeature.location postions
mRNA_end mRNA feature end position. default is the maximum value of all SubFeature.location postions
CDS_start CDS feature start position. default is the minimum value of all SubFeature.location postions
CDS_end CDS feature end position. default is the maximum value of all SubFeature.location postions
type feature type
ec default is set to 'k'

Usage eg.

feat = CoupledmRNAandCDS(mRNA_feature, CDS_feature, name='factor 7',s)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

SinglePositionFeature

class biograpy.features.SinglePositionFeature(feature, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws features localized just to one position

Additional valid attributes:
Key Description
marker marker symbol, accepts all matplotlib marker types default is circle marker 'o'
markersize marker size as in matplotlib. default is 4.

Available matplotlib marker types:

  • '.' point marker
  • ',' pixel marker
  • 'o' circle marker
  • 'v' triangle_down marker
  • '^' triangle_up marker
  • '<' triangle_left marker
  • '>' triangle_right marker
  • '1' tri_down marker
  • '2' tri_up marker
  • '3' tri_left marker
  • '4' tri_right marker
  • 's' square marker
  • 'p' pentagon marker
  • '*' star marker
  • 'h' hexagon1 marker
  • 'H' hexagon2 marker
  • '+' plus marker
  • 'x' x marker
  • 'D' diamond marker
  • 'd' thin_diamond marker
  • '|' vline marker
  • '_' hline marker

Usage eg.

feat = SinglePositionFeature(feature, name='N-glycosilation',s)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

TMFeature

class biograpy.features.TMFeature(**kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws a line plot of proteins contaning transmembrane regions with cytoplasmic/non cytoplasmic sides.

A list of transmembrane SeqFeatures is required. additional cytoplasmic and non cytoplasmic SeqFeatures can be passed. If only transmembrane SeqFeatures are given, the remaining space is filled with an horizontal line.

Additional valid attributes:
Key Description
TM list of SeqFeatures reporting Transmembrane regions. required to draw something.
cyto list of SeqFeatures reporting cytoplasmic regions.
non_cyto list of SeqFeatures reporting non cytoplasmic regions.
type feature type
TM_ec transmembrane region edgecolor, as in matplotlib.
TM_fc transmembrane region facecolor, as in matplotlib.
TM_label text that will appear under the transmembrane regions. default is 'TM'
cyto_color cytoplasmic line color default is self.ec
cyto_linestyle cytoplasmic line style default is solid '-'
cyto_label text that will appear under the cytoplasmic regions. default is 'cyto'
non_cyto_color non cytoplasmic line color default is self.ec
non_cyto_linestyle non cytoplasmic line style default is solid '-'
non_cyto_label text that will appear under the non cytoplasmic regions. default is 'non cyto'
fill_color automatic fill line color default is self.ec
fill_linestyle automatic fill line style default is solid '-'
connection_lw linewidth for cytoplasmic, non cytoplasming and automatic filled lines. default is '2
do_not_fill True | False. if True will not automatically fill the space between transmembrane regions with a line. default is False

Available linestyles for lines:

  • '-' solid line style
  • '--' dashed line style
  • '-.' dash-dot line style
  • ':' dotted line style

Usage eg.

feat = TMFeature(TM_features, cyto_features, non_features, 
                 non_cyto_label= 'extracellular', )
draw_feat_name(**kwargs)
draws the feature name and all the TM, cyto a non cyto labels
draw_feature()

SecStructFeature

class biograpy.features.SecStructFeature(betas=[], alphah=[], coil=[], **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws secondary structures. requires at least a list of SeqFeatures indicating beta strands (betas), alpha helices (alphah), and random coil (coil).

Beta strands are drawn as arrows, alpha helices as rectangles and coils as horizontal lines.

Additional valid attributes:
Key Description
betas_ec beta strands edgecolor, as in matplotlib.
betas_fc beta strands facecolor, as in matplotlib.
alphah_ec alpha helices edgecolor, as in matplotlib.
alphah_fc alpha helices facecolor, as in matplotlib.
coil_color random coil line color default is self.ec
coil_linestyle random coil line style default is solid
lw linewidth for coil lines . default is '0.5'
type feature type. default is ''
filter_struct_length if != 0 smooths secondary structures, by displaying only those longher than the given value. Force coil generation, and ignore supplied coil regions. default is '0'

Available linestyles for random coils:

  • '-' solid line style
  • '--' dashed line style
  • '-.' dash-dot line style
  • ':' dotted line style

Usage eg.

feat = SecStructFeature(betas = betas_features, 
                        alphah = alphah_features)
draw_feat_name(**kwargs)

calling self.draw_feat_name() agailn will overwrite the previous feature name stored in self.feat_name Valid keyword arguments for BaseTrack are:

Key Description
set_size as in matplotlib, default is ‘x-small’
set_family as in matplotlib, default is ‘serif’
set_weight as in matplotlib, default is ‘normal’
va as in matplotlib, default is ‘top’
ha as in matplotlib, default is ‘left’
xoffset to be used to move the text annotation along x axis
draw_feature()

DomainFeature

class biograpy.features.DomainFeature(domains, **kwargs)

Bases: biograpy.features.BaseGraphicFeature

Draws one ore more domains (encoded as seqfeatures) with FancyBboxPatch. Can optionally draw a line representing the complete sequence. Accepts a list of SeqFeature objects.

Additional valid attributes:
Key Description
seq_line sequence line start and end positions tuple. default is (0,0)
name inherited by BaseGraphicFeature, accepts multiple values
boxstyle inherited by BaseGraphicFeature, accepts multiple values
ec inherited by BaseGraphicFeature, accepts multiple values
fc inherited by BaseGraphicFeature, accepts multiple values
alpha inherited by BaseGraphicFeature, accepts multiple values
zorder use zorder to display overlapping domains. default is 2

Available boxstyles:

  • 'larrow'
  • 'rarrow'
  • 'round'
  • 'round4'
  • 'roundtooth'
  • 'sawtooth'
  • 'square'

with examples.

Usage eg.

feat = features.DomainFeature([seqfeature,seqfeature2], 
       name = ['test domain 1', 'test domain 2'], 
       boxstyle = ['sawtooth, tooth_size=1.4',  
                   'rarrow, pad = 0.1'],  
       seq_line = (1, 766),)
draw_feat_name(**kwargs)
draw_feature()

Seqrecord

SeqRecordDrawer

class biograpy.seqrecord.SeqRecordDrawer(seqrecord, draw_type='simple', gene_to_draw=None, feature_class_qualifier='ft_description', feature_name_qualifier='hit_name', **kwargs)

Bases: object

Takes in input a seqrecord and draws all the included features along a reference object

Key Description
draw_type 'simple' | 'gene structure', default is 'simple'. if simple draw is selected all the features will be drawn. if gene structure is selected only features reporting to a given gene in feature.qualifeirs['gene'] will be drawn. Gene can be set using the gene_to_draw function.
gene_to_draw default is None if a string is specified only features carrying that string in the feature.qualifeirs['gene'] qualifier will be drawn. if None, the first feature of type ``‘gene’``is selected as the gene to draw.
feature_class_qualifier assign the qualifier key to use to set a feature_class
feature_name_qualifier assign the qualifier key to use to set a feature_name

all supplied kwargs are passed to the Panel object that is available at self.panel

boxes()
draw_features()
draw_features_ordered_by_gene_struct(gene_code=None)
Draws ‘gene structure’ type. The input SeqRecord should include a gene, mRNAs, CDSs and other allowed features. they will be drawn in a defined order after fusing corresponding mRNA and CDS. if exons are passed in the seqrecord they are mapped to the gene patch then corresponding mRNA and CDS are coupled and drawn then misc_RNA are drawed in the end the other feature present in the seqrecord are drawn. the mRNA and CDS are coupled by using a qualifier['note'] containing 'transcript_id=XXXXXXXXXXXX' this work for ensembl-derived seqrecord, but can be impoved.
imagemap(**kwargs)
save(output, **kwargs)