Constraints reports

class dnachisel.reports.constraints_reports.GraphicTranslator(features_filters=(), features_properties=None)[source]

A Biopython record translator for DNA Features Viewer.

This translator produces label-free plots.

static compute_feature_box_linewidth(f)[source]

Compute a box_linewidth for this feature.

compute_feature_color(f)[source]

Compute a color for this feature.

If the feature has a color qualifier it will be used. Otherwise, the classe’s default_feature_color is used.

To change the behaviour, create a subclass of BiopythonTranslator and overwrite this method.

static compute_feature_fontdict(f)[source]

Compute a font dict for this feature.

compute_feature_label(f)[source]

Compute the label of the feature.

dnachisel.reports.constraints_reports.breaches_records_to_pdf(breaches_records, pdf_path=None, figure_width=10, logger='bar')[source]

Plots figures of the breaches annotated in the records into a PDF file.

Parameters
breaches_records

A least of records annotated with breaches, as returned by the

pdf_path

Either the path to a PDF, or a file handle (open in wb mode) or None for this method to return binary PDF data.

logger

Either “bar” for a progress bar, None for no logging, or any Proglog logger. The bar name is “sequence”.

dnachisel.reports.constraints_reports.constraints_breaches_dataframe(constraints, sequences, display_constraints_locations=False)[source]

Return a dataframe summarizing constraints breaches in the sequences.

Output dataframe schema (cst = constraint):

/

Cst1

Cst2

Seq1

10-50(+)

100-200(+), 300-350(+)

seq2

Seq3

2-10(+)

Seq4

500-1000(-)

Parameters
constraints

A list of DNA Chisel Specifications.

sequences

Either a list [(“name”, “sequence”)…] or a dict {“name”: “sequence”} or a list of biopython records whole id is the sequence name.

Examples

>>> import dnachisel as dc
>>> from dnachisel.utils import constraints_breaches_dataframe
>>> sequences = [
>>>     ("SEQ 1", "ATTGTGCATGTGACAC"),
>>>     ("SEQ 2", "ACATGTGTTGTGACAC"),
>>>     ("SEQ 3", "TTGTGCACACATGTGA"),
>>> ]
>>> constraints = [
>>>     dc.AvoidPattern('ATTG'),
>>>     dc.EnforceGCContent(0.4, 0.6),
>>>     dc.UniquifyAllKmers(5)
>>> ]
>>> dataframe = constraints_breaches_dataframe(constraints, sequences)
>>> dataframe.to_excel('summary_spreadsheet.xlsx')
dnachisel.reports.constraints_reports.records_from_breaches_dataframe(dataframe, sequences)[source]

Generate records with annotations indicating constraints breaches.

Parameters
dataframe

A breaches dataframe returned by constraints_breaches_dataframe

sequences

Either a list [(“name”, “sequence”)…] or a dict {“name”: “sequence”} or a list of biopython records whole id is the sequence name.