CommonBlocks¶
- class geneblocks.CommonBlocks(common_blocks, records)[source]¶
Class to represent a set of common blocks from different sequences.
Create with
CommonBlocks.from_sequences
:>>> common_blocks = CommonBlocks.from_sequences({'s1': 'ATGC...'})
- Parameters:
common_blocks – A dictionary of the sequences to compare, of the form {sequence_name: ATGC_sequence_string} or a list of records, all with different IDs.
records – A dictionary of the Biopython records of the sequences {record_id: record}.
- common_blocks_to_csv(target_file=None)[source]¶
Write the common blocks into a CSV file.
If a target CSV file is provided the result is written to that file. Otherwise the result is returned as a string.
The columns of the CSV file are “block”, “size”, “locations”, and sequence.
- compute_unique_blocks()[source]¶
Return a dictionary listing unique blocks by sequence.
The unique blocks are the blocks between the selected common blocks.
The result is of the form {seq: [(start, end), (start2, end2), …]}
- plot_common_blocks(colors='auto', axes=None, figure_width=10, ax_height=2)[source]¶
Plot the common blocks found on vertically stacked axes.
The axes on which the plots are drawn are returned at the end.
- Parameters:
colors – Either a list of colors to use for blocks or “auto” for the default.
axes – A list of matplotlib axes on which to plot, or None for new axes.
figure_width – Width of the final figure in inches.
ax_eight – Height of each plot.