seismicrna.draw package

Submodules

class seismicrna.draw.draw.ColorBlock(color_type: str, color_value: str, color_to: str = None, color_filter: str = None, location: tuple[int] = None)

Bases: object

to_dict()
class seismicrna.draw.draw.JinjaData(path_: Path, seq: str, value: str, name: str, color_dict: dict, details_value: int, color_blocks: list[ColorBlock], draw_svg: bool, draw_png: bool)

Bases: object

to_dict()
class seismicrna.draw.draw.RNArtistRun(report_file: Path, tmp_dir: Path, struct_num: Iterable[int], color: bool, verify_times: bool, draw_svg: bool, draw_png: bool, update: bool, num_cpus: int)

Bases: object

property best_struct
property color_dict
property edited_numbers
get_ct_file(top: Path)

Get the path to the connectivity table (CT) file.

Parameters:

top (pathlib.Path) – Top-level directory.

Returns:

Path of the file.

Return type:

pathlib.Path

get_db_file(top: Path)

Get the path to the dot-bracket (DB) file.

Parameters:

top (pathlib.Path) – Top-level directory.

Returns:

Path of the file.

Return type:

pathlib.Path

get_png_file(top: Path, struct: int)

Get the path to the PNG file.

Parameters:

top (pathlib.Path) – Top-level directory.

Returns:

Path of the file.

Return type:

pathlib.Path

get_script_file(top: Path, struct: int)

Get the path to the RNArtist script (.kts) file.

Parameters:

top (pathlib.Path) – Top-level directory.

Returns:

Path of the file.

Return type:

pathlib.Path

get_svg_file(top: Path, struct: int)

Get the path to the SVG file.

Parameters:

top (pathlib.Path) – Top-level directory.

Returns:

Path of the file.

Return type:

pathlib.Path

get_varna_color_file(top: Path)

Get the path to the VARNA color file.

Parameters:

top (pathlib.Path) – Top-level directory.

Returns:

Path of the file.

Return type:

pathlib.Path

process_struct(struct_name: str, struct: str, svg_path: Path, png_path: Path, script_file: Path, keep_tmp: bool, force: bool)

Render a single RNA structure using RNArtistCore.

Parameters:
  • struct_name (str) – Name string for this structure (used in the Jinja template and as the RNArtist structure identifier).

  • struct (str) – Dictionary with keys "seq" and "value" describing the structure.

  • svg_path (Path) – Destination path for the rendered SVG file.

  • png_path (Path) – Destination path for the rendered PNG file.

  • script_file (Path) – Path at which to write the temporary KTS script.

  • keep_tmp (bool) – Whether to retain the KTS script after rendering.

  • force (bool) – Whether to overwrite existing output files.

Returns:

Paths of the output files that were written.

Return type:

list[Path]

run(keep_tmp: bool, force: bool)

Draw all requested structures for this RNA.

Parameters:
  • keep_tmp (bool) – Whether to retain temporary KTS script files.

  • force (bool) – Whether to overwrite existing output files.

Returns:

Paths of the output files that were written.

Return type:

list[Path]

property table
property table_class
property table_classes
property table_file
property table_loader
seismicrna.draw.draw.build_jinja_data(struct: str, color_dict: dict, name: str, out_dir: Path, draw_svg: bool, draw_png: bool, highlight_pos: Iterable[int] = None)

Build a JinjaData object for rendering an RNArtist script.

Parameters:
  • struct (str) – Dictionary with keys "seq" (sequence) and "value" (dot-bracket string) describing the RNA structure.

  • color_dict (dict) – Mapping of 1-based position to reactivity value for coloring.

  • name (str) – Name of the structure, used as the RNArtist structure name.

  • out_dir (Path) – Output directory for the rendered image files.

  • draw_svg (bool) – Whether to render an SVG image.

  • draw_png (bool) – Whether to render a PNG image.

  • highlight_pos (Iterable[int], optional) – Positions to highlight in green (e.g. edited positions).

Returns:

Data object suitable for rendering with the RNArtist Jinja template.

Return type:

JinjaData

seismicrna.draw.draw.draw(report_path: Path, *, struct_num: Iterable[int], color: bool, draw_svg: bool, draw_png: bool, update: bool, tmp_dir: Path, keep_tmp: bool, verify_times: bool, num_cpus: int, force: bool = False)

Draw RNA structure(s) from a FoldReport.

seismicrna.draw.draw.parse_color_file(file_path)
seismicrna.draw.main.run(input_path: Iterable[str | Path] = Sentinel.UNSET, *, struct_num: Iterable[int] = (), color: bool = True, draw_svg: bool = True, draw_png: bool = False, update_rnartistcore: bool = False, force: bool = False, num_cpus: int = 4, verify_times: bool = True, keep_tmp: bool = False, tmp_pfx='./tmp') list[Path]

Draw RNA structures with reactivities using RNArtistCore.

Parameters:
  • struct_num (Iterable) – Draw the specified structure (zero-indexed) or -1 for all structures. By default, draw the structure with the best AUROC. [keyword-only, default: ()]

  • color (bool) – Color bases by their reactivity [keyword-only, default: True]

  • draw_svg (bool) – Output each drawing in a Scalable Vector Graphics file [keyword-only, default: True]

  • draw_png (bool) – Output each drawing in a Portable Network Graphics file [keyword-only, default: False]

  • update_rnartistcore (bool) – Check for and install updates to RNArtistCore. [keyword-only, default: False]

  • force (bool) – Force all tasks to run, overwriting any existing output files [keyword-only, default: False]

  • num_cpus (int) – Use up to this many CPUs simultaneously [keyword-only, default: 4]

  • verify_times (bool) – Verify that report files from later steps have later timestamps [keyword-only, default: True]

  • keep_tmp (bool) – Keep temporary files after finishing [keyword-only, default: False]

  • tmp_pfx – Write all temporary files to a directory with this prefix [keyword-only, default: ‘./tmp’]