seismicrna.graph package

Submodules

class seismicrna.graph.aucroll.RollingAUCGraph(*, struct_file: Path | None, struct_sect: str | None, **kwargs)

Bases: StructOneTableGraph, RollingGraph

property data

Data of the graph.

get_traces()

Data traces of the graph.

classmethod graph_kind()

Kind of graph.

property profile_names

Names of the profiles as they appear in the data.

classmethod what()

What is being graphed.

property y_title

Title of the y-axis.

class seismicrna.graph.aucroll.RollingAUCRunner

Bases: RollingRunner, StructOneTableRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.aucroll.RollingAUCWriter(table_file: Path)

Bases: StructOneTableWriter, PosGraphWriter

get_graph(rels_group: str, **kwargs)

Return a graph instance.

class seismicrna.graph.base.GraphBase(*, use_ratio: bool, quantile: float)

Bases: ABC

abstract property codestring

String of the relationship code(s).

abstract property col_index: Index | None

Index of columns of subplots.

property col_titles

Titles of the columns.

property data: DataFrame

Data of the graph.

property data_kind

either “ratio” or “count”.

Type:

Kind of data being used

property details: list[str]

Additional details about the graph.

property figure

Figure object.

get_path(ext: str)

Path to the output file of the graph.

get_path_fields()

Path fields.

classmethod get_path_segs()

Path segments.

abstract get_traces() Iterable[tuple[tuple[int, int], Trace]]

Data traces of the graph.

property graph_filename

Name of the graph’s output file, without its extension.

abstract classmethod graph_kind() str

Kind of graph.

property ncols

Number of columns of subplots.

property nrows

Number of rows of subplots.

abstract property path_subject

Subject of the graph.

property predicate

Predicate of the graph.

abstract property ref: str

Name of the reference sequence from which the data come.

abstract property rel_names

Names of the relationships to graph.

property relationships: str

Relationships being graphed as a slash-separated string.

abstract property row_index: Index | None

Index of rows of subplots.

property row_titles

Titles of the rows.

abstract property sample: str

Name(s) of the sample(s) from which the data come.

abstract property sect: str

Name of the reference section from which the data come.

abstract property seq: DNA

Sequence of the section from which the data come.

property title

Title of the graph.

abstract property title_action_sample: str

Action and sample for the title.

abstract property top: Path

Path of the top-level output directory for all files.

abstract classmethod what() str

What is being graphed.

write(csv: bool, html: bool, svg: bool, pdf: bool, png: bool, force: bool = False)

Write the selected files.

write_csv(force: bool)

Write the graph’s source data to a CSV file.

write_html(force: bool)

Write the graph to an HTML file.

write_pdf(force: bool)

Write the graph to a PDF file.

write_png(force: bool)

Write the graph to a PNG file.

write_svg(force: bool)

Write the graph to an SVG file.

abstract property x_title: str

Title of the x-axis.

abstract property y_title: str

Title of the y-axis.

class seismicrna.graph.base.GraphRunner

Bases: ABC

abstract classmethod get_table_finder() Callable[[tuple[str, ...]], Generator]

Function to find and filter table files.

abstract classmethod get_writer_type() type[GraphWriter]

Type of GraphWriter.

classmethod list_table_files(input_path: tuple[str, ...])

Find, filter, and list all table files from input files.

classmethod params() list[Argument | Option]

Parameters for the command line.

abstract classmethod run(input_path: tuple[str, ...], *, rels: tuple[str, ...], use_ratio: bool, quantile: float, cgroup: str, csv: bool, html: bool, svg: bool, pdf: bool, png: bool, force: bool, max_procs: int, parallel: bool, **kwargs) list[Path]

Run graphing.

classmethod universal_input_params()

Universal parameters controlling the input data.

classmethod universal_output_params()

Universal parameters controlling the output graph.

classmethod var_params() list[Argument | Option]

Parameters that can vary among different classes.

class seismicrna.graph.base.GraphWriter(*table_files: Path)

Bases: ABC

Write the proper graph(s) for the table(s).

abstract classmethod get_table_loader() Callable[[Path], Table]

Function to load table files.

abstract iter_graphs(*args, **kwargs) Generator[GraphBase, None, None]

Yield every graph for the table.

classmethod load_table_file(table_file: Path)

Load one table file.

write(*args, csv: bool, html: bool, svg: bool, pdf: bool, png: bool, force: bool, **kwargs)

Generate and write every graph for the table.

class seismicrna.graph.base.PosGraphRunner

Bases: GraphRunner, ABC

classmethod get_table_finder()

Function to find and filter table files.

class seismicrna.graph.base.PosGraphWriter(*table_files: Path)

Bases: GraphWriter, ABC

classmethod get_table_loader()

Function to load table files.

class seismicrna.graph.base.ReadGraphRunner

Bases: GraphRunner, ABC

classmethod get_table_finder()

Function to find and filter table files.

class seismicrna.graph.base.ReadGraphWriter(*table_files: Path)

Bases: GraphWriter, ABC

classmethod get_table_loader()

Function to load table files.

seismicrna.graph.base.cgroup_table(table: Table, cgroup: str)
seismicrna.graph.base.get_action_name(table: Table)
seismicrna.graph.base.make_index(header: Header, order: int | None, clust: int | None)

Make an index for the rows or columns of a graph.

seismicrna.graph.base.make_path_subject(action: str, order: int | None, clust: int | None)
seismicrna.graph.base.make_title_action_sample(action: str, sample: str)
class seismicrna.graph.color.ColorMap(name: str, **kwargs)

Bases: ABC

Color map for a graph.

get(item: Hashable, default: Any | None = None)
class seismicrna.graph.color.ColorMapGraph(*, cmap: str | None = None, **kwargs)

Bases: GraphBase, ABC

Graph with an explicit color map.

property cmap: ColorMap

Color map of the graph.

abstract classmethod get_cmap_type() type[ColorMap]

Type of the color map.

class seismicrna.graph.color.RelColorMap(name: str, v: str, n: str, e: str, m: str, d: str, i: str, s: str, a: str, c: str, g: str, t: str)

Bases: ColorMap

Color map for relationships.

class seismicrna.graph.color.SeqColorMap(name: str, a: str, c: str, g: str, t: str, n: str)

Bases: ColorMap

Color map for bases A, C, G, and T.

seismicrna.graph.color.get_cmap(cmap_class: type[ColorMap], name: str | None = None)

Get a color map of a given class by its name.

seismicrna.graph.color.get_colormaps(cmap_class: type[ColorMap])

Return a dict of all color maps of a given class.

class seismicrna.graph.corroll.RollingCorrelationGraph(*, metric: str, **kwargs)

Bases: TwoTableMergedGraph, RollingGraph

property details

Additional details about the graph.

classmethod graph_kind()

Kind of graph.

property predicate

Predicate of the graph.

classmethod what()

What is being graphed.

property y_title

Title of the y-axis.

class seismicrna.graph.corroll.RollingCorrelationRunner

Bases: RollingRunner, TwoTableRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

classmethod var_params()

Parameters that can vary among different classes.

class seismicrna.graph.corroll.RollingCorrelationWriter(table1_file: Path, table2_file: Path)

Bases: TwoTableWriter, PosGraphWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.delprof.DeltaProfileGraph(*, out_dir: str | Path, table1: Table | PosTable, order1: int | None, clust1: int | None, table2: Table | PosTable, order2: int | None, clust2: int | None, **kwargs)

Bases: TwoTableMergedGraph, ColorMapGraph

classmethod get_cmap_type()

Type of the color map.

classmethod graph_kind()

Kind of graph.

classmethod what()

What is being graphed.

property x_title: str

Title of the x-axis.

property y_title

Title of the y-axis.

class seismicrna.graph.delprof.DeltaProfileRunner

Bases: TwoTableRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.delprof.DeltaProfileWriter(table1_file: Path, table2_file: Path)

Bases: TwoTableWriter, PosGraphWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.giniroll.RollingGiniGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: RollingStatGraph

classmethod graph_kind()

Kind of graph.

classmethod stat_func()

Function to compute a statistic on the data.

classmethod what()

What is being graphed.

property y_title

Title of the y-axis.

class seismicrna.graph.giniroll.RollingGiniRunner

Bases: RollingStatRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.giniroll.RollingGiniWriter(table_file: Path)

Bases: RollingStatWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.hist.HistogramGraph(*, hist_bins: int, hist_margin: float, **kwargs)

Bases: GraphBase, ABC

Generic histogram.

get_bounds(data: DataFrame)

Get the lower and upper bounds of the histogram.

get_edges(data: DataFrame)

Get the edges of the histogram bins.

class seismicrna.graph.hist.HistogramRunner

Bases: GraphRunner, ABC

classmethod var_params()

Parameters that can vary among different classes.

seismicrna.graph.hist.get_edges_index(edges: ndarray, use_ratio: bool)

Generate an index for the edges of histogram bins.

Parameters:
  • edges (numpy.ndarray) – Edges of histogram bins.

  • use_ratio (bool) – Assume the edges represent ratios rather than counts.

Returns:

Index for the edges.

Return type:

pandas.Index | pandas.MultiIndex

class seismicrna.graph.histpos.PosHistogramGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: RelHistogramGraph

classmethod graph_kind()

Kind of graph.

classmethod what()

What is being graphed.

property y_title

Title of the y-axis.

class seismicrna.graph.histpos.PosHistogramRunner

Bases: RelHistogramRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.histpos.PosHistogramWriter(table_file: Path)

Bases: RelHistogramWriter, PosGraphWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.histread.ReadHistogramGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: RelHistogramGraph

classmethod graph_kind()

Kind of graph.

classmethod what()

What is being graphed.

property y_title

Title of the y-axis.

class seismicrna.graph.histread.ReadHistogramRunner

Bases: RelHistogramRunner, ReadGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.histread.ReadHistogramWriter(table_file: Path)

Bases: RelHistogramWriter, ReadGraphWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.histrel.RelHistogramGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: OneTableGraph, HistogramGraph, MultiRelsGraph, ColorMapGraph, ABC

Histogram of relationship(s) in one table.

property data

Data of the graph.

property data_header

Header of the selected data (not of the entire table).

classmethod get_cmap_type()

Type of the color map.

get_traces()

Data traces of the graph.

property x_title

Title of the x-axis.

class seismicrna.graph.histrel.RelHistogramRunner

Bases: OneTableRunner, HistogramRunner, ABC

class seismicrna.graph.histrel.RelHistogramWriter(table_file: Path)

Bases: OneTableWriter, ABC

get_graph(rels_group: str, **kwargs)

Return a graph instance.

abstract classmethod get_graph_type() type[RelHistogramGraph]

Type of graph.

class seismicrna.graph.onestruct.StructOneTableGraph(*, struct_file: Path | None, struct_sect: str | None, **kwargs)

Bases: OneTableGraph, OneRelGraph, ABC

Graph of data from one Table applied to RNA structure(s).

get_path_fields()

Path fields.

iter_profiles()

Yield each RNAProfile from the table.

iter_states()

Yield each RNAState.

property path_subject

Subject of the graph.

property struct_sect

Name of the section from which the structure comes.

class seismicrna.graph.onestruct.StructOneTableRunner

Bases: OneTableRunner, ABC

classmethod get_table_finder()

Function to find and filter table files.

classmethod var_params()

Parameters that can vary among different classes.

class seismicrna.graph.onestruct.StructOneTableWriter(table_file: Path)

Bases: OneTableWriter, ABC

iter_graphs(rels: tuple[str, ...], cgroup: str, struct_file: tuple[str, ...] = (), fold_coords: tuple[tuple[str, int, int], ...] = (), fold_primers: tuple[tuple[str, DNA, DNA], ...] = (), fold_sections_file: str | None = None, fold_full: bool = True, **kwargs)

Yield every graph for the table.

class seismicrna.graph.onetable.OneTableGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: GraphBase, ABC

Graph of data from one Table.

property action

Action that generated the data.

property col_index

Index of columns of subplots.

property path_subject

Subject of the graph.

property ref

Name of the reference sequence from which the data come.

property row_index

Index of rows of subplots.

property sample

Name(s) of the sample(s) from which the data come.

property sect

Name of the reference section from which the data come.

property seq

Sequence of the section from which the data come.

property title_action_sample

Action and sample for the title.

property top

Path of the top-level output directory for all files.

class seismicrna.graph.onetable.OneTableRunner

Bases: GraphRunner, ABC

classmethod run(input_path: tuple[str, ...], *, max_procs: int, parallel: bool, **kwargs)

Run graphing.

class seismicrna.graph.onetable.OneTableWriter(table_file: Path)

Bases: GraphWriter, ABC

abstract get_graph(*args, **kwargs) OneTableGraph

Return a graph instance.

iter_graphs(rels: tuple[str, ...], cgroup: str, **kwargs)

Yield every graph for the table.

property table

The table providing the data for the graph(s).

class seismicrna.graph.profile.MultiRelsProfileGraph(*, rels: str, **kwargs)

Bases: MultiRelsGraph, ProfileGraph

Stacked bar graph with multiple relationships per position.

classmethod get_cmap_type()

Type of the color map.

get_traces()

Data traces of the graph.

classmethod what()

What is being graphed.

class seismicrna.graph.profile.OneRelProfileGraph(*, rel: str, **kwargs)

Bases: OneRelGraph, ProfileGraph

Bar graph with one relationship per position.

classmethod get_cmap_type()

Type of the color map.

get_traces()

Data traces of the graph.

classmethod what()

What is being graphed.

class seismicrna.graph.profile.ProfileGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: OneTableGraph, ColorMapGraph, ABC

Bar graph of a mutational profile for one table.

property data

Data of the graph.

property data_header

Header of the selected data (not of the entire table).

classmethod graph_kind()

Kind of graph.

property x_title

Title of the x-axis.

property y_title

Title of the y-axis.

class seismicrna.graph.profile.ProfileRunner

Bases: OneTableRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.profile.ProfileWriter(table_file: Path)

Bases: OneTableWriter, PosGraphWriter

get_graph(rels_group: str, **kwargs)

Return a graph instance.

class seismicrna.graph.rel.MultiRelsGraph(*, rels: str, **kwargs)

Bases: GraphBase, ABC

Graph of one or more relationships.

property codestring

String of the relationship code(s).

property rel_names

Names of the relationships to graph.

class seismicrna.graph.rel.OneRelGraph(*, rel: str, **kwargs)

Bases: GraphBase, ABC

Graph of exactly one type of relationship.

property codestring

String of the relationship code(s).

property rel_name

Name of the relationship to graph.

property rel_names

Names of the relationships to graph.

class seismicrna.graph.roc.ROCGraph(*, struct_file: Path | None, struct_sect: str | None, **kwargs)

Bases: StructOneTableGraph

Graph of a receiver operating characteristic (ROC) curve.

property data

Data of the graph.

property fpr

False positive rate (FPR) of each RNA state.

get_traces()

Data traces of the graph.

classmethod graph_kind()

Kind of graph.

property profile_names

Names of the profiles as they appear in the data.

property tpr

True positive rate (TPR) of each RNA state.

classmethod what()

What is being graphed.

property x_title

Title of the x-axis.

property y_title

Title of the y-axis.

class seismicrna.graph.roc.ROCRunner

Bases: StructOneTableRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.roc.ROCWriter(table_file: Path)

Bases: StructOneTableWriter, PosGraphWriter

get_graph(rels_group: str, **kwargs)

Return a graph instance.

seismicrna.graph.roc.rename_columns(df: DataFrame)

Rename the levels of the columns.

class seismicrna.graph.roll.RollingGraph(*, window: int, winmin: int, **kwargs)

Bases: GraphBase, ABC

property details

Additional details about the graph.

property predicate

Predicate of the graph.

property x_title

Title of the x-axis.

class seismicrna.graph.roll.RollingRunner

Bases: GraphRunner, ABC

classmethod var_params()

Parameters that can vary among different classes.

class seismicrna.graph.scatter.ScatterPlotGraph(*, out_dir: str | Path, table1: Table | PosTable, order1: int | None, clust1: int | None, table2: Table | PosTable, order2: int | None, clust2: int | None, **kwargs)

Bases: TwoTableGraph, ColorMapGraph

property data

Data of the graph.

classmethod get_cmap_type()

Type of the color map.

get_traces()

Data traces of the graph.

classmethod graph_kind()

Kind of graph.

classmethod what()

What is being graphed.

property x_title

Title of the x-axis.

property y_title

Title of the y-axis.

class seismicrna.graph.scatter.ScatterPlotRunner

Bases: TwoTableRunner, PosGraphRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.scatter.ScatterPlotWriter(table1_file: Path, table2_file: Path)

Bases: TwoTableWriter, PosGraphWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.snrroll.RollingSNRGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: RollingStatGraph

classmethod graph_kind()

Kind of graph.

classmethod stat_func()

Function to compute a statistic on the data.

classmethod what()

What is being graphed.

property y_title

Title of the y-axis.

class seismicrna.graph.snrroll.RollingSNRRunner

Bases: RollingStatRunner

classmethod get_writer_type()

Type of GraphWriter.

class seismicrna.graph.snrroll.RollingSNRWriter(table_file: Path)

Bases: RollingStatWriter

classmethod get_graph_type()

Type of graph.

class seismicrna.graph.statroll.RollingStatGraph(*, table: Table | PosTable, order: int | None, clust: int | None, **kwargs)

Bases: OneTableGraph, OneRelGraph, RollingGraph, ABC

property data

Data of the graph.

get_traces()

Data traces of the graph.

abstract classmethod stat_func() Callable[[Series], Series]

Function to compute a statistic on the data.

class seismicrna.graph.statroll.RollingStatRunner

Bases: RollingRunner, OneTableRunner, PosGraphRunner, ABC

class seismicrna.graph.statroll.RollingStatWriter(table_file: Path)

Bases: OneTableWriter, PosGraphWriter, ABC

get_graph(rels_group: str, **kwargs)

Return a graph instance.

abstract classmethod get_graph_type() type[RollingGraph]

Type of graph.

seismicrna.graph.trace.get_hist_trace(data: Series, rel: str, cmap: ColorMap)
seismicrna.graph.trace.get_line_trace(gini: Series, cluster: str)
seismicrna.graph.trace.get_roc_trace(fpr: Series, tpr: Series, profile: str, struct: str)
seismicrna.graph.trace.get_rolling_auc_trace(auc: Series, profile: str, struct: str)
seismicrna.graph.trace.get_seq_base_bar_trace(data: Series, cmap: ColorMap, base: str)
seismicrna.graph.trace.get_seq_base_scatter_trace(xdata: Series, ydata: Series, cmap: ColorMap, base: str)
seismicrna.graph.trace.get_seq_line_trace(data: Series)
seismicrna.graph.trace.get_seq_stack_bar_trace(data: Series, rel: str, cmap: ColorMap)
seismicrna.graph.trace.iter_hist_traces(data: DataFrame, cmap: ColorMap)
seismicrna.graph.trace.iter_line_traces(lines: DataFrame)
seismicrna.graph.trace.iter_roc_traces(fprs: DataFrame, tprs: DataFrame, profile: str)
seismicrna.graph.trace.iter_rolling_auc_traces(aucs: DataFrame, profile: str)
seismicrna.graph.trace.iter_seq_base_bar_traces(data: Series, cmap: ColorMap)
seismicrna.graph.trace.iter_seq_base_scatter_traces(xdata: Series, ydata: Series, cmap: ColorMap)
seismicrna.graph.trace.iter_seq_line_traces(data: Series, *_, **__)
seismicrna.graph.trace.iter_seqbar_stack_traces(data: DataFrame, cmap: ColorMap)
class seismicrna.graph.twotable.TwoTableGraph(*, out_dir: str | Path, table1: Table | PosTable, order1: int | None, clust1: int | None, table2: Table | PosTable, order2: int | None, clust2: int | None, **kwargs)

Bases: OneRelGraph, ABC

Graph of two Tables.

property action1

Action that generated dataset 1.

property action2

Action that generated dataset 2.

property action_sample1

Action and sample of dataset 1.

property action_sample2

Action and sample of dataset 2.

property col_index

Index of columns of subplots.

property data1

Data from table 1.

property data2

Data from table 2.

property path_subject

Subject of the graph.

property path_subject1

Name of subject 1.

property path_subject2

Name of subject 2.

property ref

Name of the reference sequence from which the data come.

property row_index

Index of rows of subplots.

property sample

Name(s) of the sample(s) from which the data come.

property sample1

Name of sample 1.

property sample2

Name of sample 2.

property sect

Name of the reference section from which the data come.

property seq

Sequence of the section from which the data come.

property title_action_sample

Action and sample for the title.

property top

Path of the top-level output directory for all files.

class seismicrna.graph.twotable.TwoTableMergedGraph(*, out_dir: str | Path, table1: Table | PosTable, order1: int | None, clust1: int | None, table2: Table | PosTable, order2: int | None, clust2: int | None, **kwargs)

Bases: TwoTableGraph, ABC

Graph of a pair of datasets over the same sequence in which the data series are merged in some fashion into another series, and the original data are not graphed directly.

property data

Data of the graph.

get_traces()

Data traces of the graph.

class seismicrna.graph.twotable.TwoTableRunner

Bases: GraphRunner, ABC

abstract classmethod get_writer_type() type[TwoTableWriter]

Type of GraphWriter.

classmethod run(input_path: tuple[str, ...], *, compself: bool, comppair: bool, max_procs: int, parallel: bool, **kwargs)

Run graphing.

classmethod var_params()

Parameters that can vary among different classes.

class seismicrna.graph.twotable.TwoTableWriter(table1_file: Path, table2_file: Path)

Bases: GraphWriter, ABC

Write the proper types of graphs for two given tables.

abstract classmethod get_graph_type(*args, **kwargs) type[TwoTableGraph]

Type of graph.

iter_graphs(rels: tuple[str, ...], cgroup: str, **kwargs)

Yield every graph for the table.

property table1

The first table providing the data for the graph(s).

property table2

The second table providing the data for the graph(s).

seismicrna.graph.twotable.iter_pos_table_pairs(table_files: Iterable[Path])

Yield every pair of files of positional tables whose reference and section match.

seismicrna.graph.twotable.iter_read_table_pairs(table_files: Iterable[Path])

Yield every pair of files of per-read tables whose reference and section match.