Caravagene Reference manual

graph LR; param1(category) --> Part param2(label) --> Part param3(name) --> Construct param4(note) --> Construct param5(name) --> ConstructList param6(note) --> ConstructList Part --> Construct Part --> Construct Part --> Construct Construct --> ConstructList Construct --> ConstructList Construct --> ConstructList style param1 fill:none,stroke:none; style param2 fill:none,stroke:none; style param3 fill:none,stroke:none; style param4 fill:none,stroke:none; style param5 fill:none,stroke:none; style param6 fill:none,stroke:none;
class caravagene.Part(category, label='', sublabel='', subscript='', reversed=False, bg_color='none')[source]

Represent a genetic part.

Parameters
category

Either ‘promoter’, ‘CDS’… Defines the symbol displayed for this part.

label

String that will be displayed on top of the part.

sublabel

Note that will be written in grey below the label.

subscript

Note that will be written below the part.

reversed

True/False. Whether the part is in direct or indirect sense.

bg_color

String representing any html color, which will be used as background to highlight this part.

static from_dict(part_dict)[source]

Create a part from a dictionary.

This is intended for Schema imports from JSON in web applications. This dictionary should have the same parameters as the __init__ function (other parameters will be ignored).

property style

Define the CSS style from the part’s parameters.

class caravagene.Construct(parts, name='', note='')[source]

Represent a genetic construct with several parts.

Parameters
parts

A list of Parts, in the order in which they appear in the construct. Alternatively, a pandas dataframe can be provided, with columns ‘label’, ‘category’, ‘sublabel’, ‘subscript’, ‘style’. The last column, ‘style’ can be for instance “bg:green bold”.

name

Name of the construct. Will be displayed on top of the construct’s plot.

note

Some text that will be displayed between the construct’s name and plot.

static from_dict(cst_dict)[source]

Create a construct from a dictionary.

This is intended for Schema imports from JSON in web applications. This dictionary should have the same parameters as the __init__ function (other parameters will be ignored).

class caravagene.ConstructList(constructs, title='auto', note='', size=13, font='Helvetica', orientation='portrait', width=600, page_size='A4', use_google_fonts=False)[source]

Represent a genetic construct will several parts.

Parameters
constructs

A list of Constructss, in the order in which they appear in the plot. Alternatively, a path to an excel spreadsheet can be provided (see docs for explanations on the spreadsheet format).

title

Title for this list of constructs. Will be displayed on top of the plots.

note

Some text that will be displayed between the title and the plots.

size

Size of the font for labels, which also scales the size of sublabel, subscript, and the symbol itself.

orientation

‘portrait’ or ‘landscape’. Orientation of the page when exporting to PDF.

page_size

Page format when exporting to PDF.

width

Page width when exporting to an image.

font

Name of the font to use for all texts.

use_google_fonts

Whether the font should be obtained from Google Fonts (will only work with an Internet access).

static from_dict(csts_dict)[source]

Create a constructs list from a dictionary.

This is intended for Schema imports from JSON in web applications. This dictionary should have the same parameters as the __init__ function (other parameters will be ignored).

to_html(outfile=None)[source]

Return a HTML page ready for browser rendering of the plots.

to_image(outfile=None, extension=None)[source]

Return an image with all the construct plots.

If outfile is not provided, the function returns raw binary PDF data as a string. In that case the extension (‘png’, ‘jpeg’) must be provided.

to_pdf(outfile=None)[source]

Return a PDF with all the construct plots.

If outfile is not provided, the function returns raw binary PDF data as a string.