seismicrna.graph package
Submodules
- class seismicrna.graph.abundance.ClusterAbundanceGraph(*, table: Table | PositionTable | AbundanceTable, **kwargs)
Bases:
OneTableGraphAbundance of each cluster.
- property col_tracks
- property data
Data of the graph.
- property details
Additional details about the graph.
- get_traces()
Data traces of the graph.
- classmethod graph_kind()
Kind of graph.
- property path_subject
Subject of the graph.
- property predicate
Predicate of the graph.
- property row_tracks
- 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.abundance.ClusterAbundanceRunner
Bases:
OneTableRunner,AbundanceTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.abundance.ClusterAbundanceWriter(table: Table, **kwargs)
Bases:
OneTableWriter- get_graph(**kwargs)
Return a graph instance.
- iter_graphs(**kwargs)
Yield every graph.
- class seismicrna.graph.aucroll.RollingAUCGraph(*, fold_table_region: bool, struct_file: Path | None, struct_reg: str | None, terminal_pairs: bool, branch: str, **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,PositionTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.aucroll.RollingAUCWriter(table: Table, **kwargs)
Bases:
StructOneTableWriter,TableWriter
- class seismicrna.graph.base.Annotation(row: int, col: int, x: float, y: float, text: str, **kwargs)
Bases:
objectText annotation in a graph.
- class seismicrna.graph.base.BaseGraph
Bases:
ABCBase class for all types of graphs.
- property annotations: list[Annotation]
Text annotations for the figure.
- property data: pd.DataFrame
Data of the graph.
- property figure
Figure object.
- get_path_fields()
Path fields.
- classmethod get_path_segs()
Path segments.
- property graph_filename
Name of the graph’s output file, without its extension.
- property title
Title of the graph.
- class seismicrna.graph.base.BaseRunner
Bases:
ABC- classmethod get_cmd() str
Name of the command that graphs this kind of graph, which is the name of the module that defines the runner, as in every graph module’s own COMMAND.
- abstractmethod classmethod get_input_loader() Callable[[...], Generator]
Function to load input files.
- classmethod get_var_params() list[Argument | Option]
Parameters that can vary among different classes.
- abstractmethod classmethod get_writer_type() type[BaseWriter]
Type of Writer.
- classmethod load_input_files(input_path: Iterable[str | Path], **kwargs)
Find, filter, and load all input files.
- classmethod universal_input_params()
Universal parameters controlling the input data.
- classmethod universal_output_params()
Universal parameters controlling the output graph.
- seismicrna.graph.base.get_action_name(source: MutsDataset | Table)
- seismicrna.graph.base.make_path_subject(action: str, k: int | None, clust: int | None)
Build the path subject string that identifies a graph’s data source.
- Parameters:
- Returns:
A string suitable for use as the subject component of a file path (e.g.
"all","filtered", or"clustered-2-1").- Return type:
- class seismicrna.graph.cgroup.ClusterGroupGraph
-
Graph in which clusters can be placed in subplots.
- property clust_proportions
Mapping from each (k, cluster) to its proportion, or None if cluster proportions are not available for this graph.
- property col_proportions
Cluster proportions for the column tracks.
- property col_titles
Titles of the columns.
- property ncols
Number of columns of subplots.
- property nrows
Number of rows of subplots.
- property row_proportions
Cluster proportions for the row tracks.
- property row_titles
Titles of the rows.
- class seismicrna.graph.cgroup.ClusterGroupRunner
Bases:
BaseRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- seismicrna.graph.cgroup.get_clust_proportions(top, sample, branches, ref, reg)
Load the proportion of each cluster, keyed by (k, cluster), from the cluster abundance table identified by these path fields. Returns None if no such abundance table exists (e.g. the source is not clustered).
- seismicrna.graph.cgroup.get_ks(source: Dataset | Table)
List the numbers of clusters for a source of data.
- seismicrna.graph.cgroup.get_ks_clusts(source: Dataset | Table)
List the clusters for a source of data.
- seismicrna.graph.cgroup.make_tracks(source: Dataset | Table, k: int | None, clust: int | None, *, k_clust_list: list[tuple[int, int]] | None = None)
Make an index for the rows or columns of a graph.
- class seismicrna.graph.color.ColorMapGraph(*, cmap: str | None = None, **kwargs)
-
Graph with an explicit 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, x: str)
Bases:
ColorMapColor map for relationships.
- get_default_color()
Default color.
- class seismicrna.graph.color.SeqColorMap(name: str, a: str, c: str, g: str, t: str, n: str)
Bases:
ColorMapColor map for bases A, C, G, and T.
- get_default_color()
Default color.
- 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:
TwoTableMergedClusterGroupGraph,OneRelGraph,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:
TwoTableRelClusterGroupRunner,RollingRunner,PositionTableRunner- classmethod get_var_params()
Parameters that can vary among different classes.
- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write comparison graphs for each pair.
- Parameters:
input_path (
Iterable[strorPath]) – Paths to input files or directories to search for tables.compself (
bool) – If True, compare each table with itself.comppair (
bool) – If True, compare every pair of different tables with the same reference and region.verify_times (
bool) – Whether to verify file modification times when loading tables.num_cpus (
int) – Number of CPUs for parallel graph writing.**kwargs – Forwarded to each writer’s
writemethod.
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.corroll.RollingCorrelationWriter(table1: Table, table2: Table, **kwargs)
Bases:
TwoTableRelClusterGroupWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.dataset.DatasetGraph(*, dataset: MutsDataset, num_cpus: int, **kwargs)
Bases:
OneRelGraph,OneSourceClusterGroupGraph,ABCGraph based on one Dataset.
- property action
Action that generated the data.
- property branches
Branches of the workflow.
- property clust_proportions
Proportion of each cluster, keyed by (k, cluster), loaded from the cluster abundance table that accompanies this dataset; None if the dataset is not clustered or no abundance table exists.
- property details
Additional details about the graph.
- property path_subject
Subject of the graph.
- property pattern
Relationship pattern for the graph.
- property predicate
Predicate of the graph.
- property ref
Name of the reference sequence from which the data come.
- property reg
Name of the reference region from which the data come.
- property sample
Name(s) of the sample(s) from which the data come.
- property seq
Sequence of the region 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.dataset.DatasetRunner
Bases:
RelRunner,ClusterGroupRunner,ABC- classmethod get_input_loader()
Function to load input files.
- classmethod get_var_params()
Parameters that can vary among different classes.
- abstractmethod classmethod get_writer_type() type[DatasetWriter]
Type of Writer.
- class seismicrna.graph.dataset.DatasetWriter(*, dataset: MutsDataset, **kwargs)
Bases:
BaseWriter,ABC- abstractmethod get_graph(*args, **kwargs) DatasetGraph
Return a graph instance.
- iter_graphs(*, rels: list[str], cgroup: str, **kwargs)
Yield graph instances for every relationship and cluster group.
- Parameters:
rels (
list[str]) – Relationship codes to graph.cgroup (
str) – Cluster-grouping strategy.**kwargs – Additional keyword arguments forwarded to
get_graph.
- Yields:
DatasetGraph– One graph per (cluster group, relationship) combination.
- class seismicrna.graph.delprof.DeltaProfileGraph(*, k1: int | None, clust1: int | None, k2: int | None, clust2: int | None, **kwargs)
Bases:
TwoTableMergedClusterGroupGraph,OneRelGraph,ColorMapGraph- classmethod get_cmap_type()
Type of the color map.
- classmethod graph_kind()
Kind of graph.
- classmethod what()
What is being graphed.
- property y_title
Title of the y-axis.
- class seismicrna.graph.delprof.DeltaProfileRunner
Bases:
TwoTableRelClusterGroupRunner,PositionTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write comparison graphs for each pair.
- Parameters:
input_path (
Iterable[strorPath]) – Paths to input files or directories to search for tables.compself (
bool) – If True, compare each table with itself.comppair (
bool) – If True, compare every pair of different tables with the same reference and region.verify_times (
bool) – Whether to verify file modification times when loading tables.num_cpus (
int) – Number of CPUs for parallel graph writing.**kwargs – Forwarded to each writer’s
writemethod.
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.delprof.DeltaProfileWriter(table1: Table, table2: Table, **kwargs)
Bases:
TwoTableRelClusterGroupWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.giniroll.RollingGiniGraph(*, table: Table | PositionTable | AbundanceTable, **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 Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.giniroll.RollingGiniWriter(table: Table, **kwargs)
Bases:
RollingStatWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.hist.HistogramGraph(*, hist_bins: int, hist_margin: float, **kwargs)
Bases:
OneTableRelClusterGroupGraph,MultiRelsGraph,ColorMapGraph,ABCHistogram of relationship(s) in one table.
- property data
Data of the graph.
- property data_header
Header of the filtered data (not of the entire table).
- get_bounds(data: pd.DataFrame)
Get the lower and upper bounds of the histogram.
- classmethod get_cmap_type()
Type of the color map.
- get_edges(data: pd.DataFrame)
Get the edges of the histogram bins.
- get_traces()
Data traces of the graph.
- property x_title
Title of the x-axis.
- class seismicrna.graph.hist.HistogramRunner
Bases:
OneTableRelClusterGroupRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- class seismicrna.graph.hist.HistogramWriter(table: Table, **kwargs)
Bases:
OneTableRelClusterGroupWriter,ABC- get_graph(rels_group: str, **kwargs)
Instantiate a HistogramGraph for the given relationship group.
- Parameters:
rels_group (
str) – Relationship code string for the graph.**kwargs – Additional keyword arguments forwarded to the graph class.
- Returns:
A new graph instance for the given relationship group.
- Return type:
- abstractmethod classmethod get_graph_type() type[HistogramGraph]
Type of graph.
- seismicrna.graph.hist.get_edges_index(edges: np.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.PositionHistogramGraph(*, hist_bins: int, hist_margin: float, **kwargs)
Bases:
HistogramGraph- classmethod graph_kind()
Kind of graph.
- classmethod what()
What is being graphed.
- property y_title
Title of the y-axis.
- class seismicrna.graph.histpos.PositionHistogramRunner
Bases:
HistogramRunner,PositionTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.histpos.PositionHistogramWriter(table: Table, **kwargs)
Bases:
HistogramWriter,TableWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.histread.ReadHistogramGraph(*, hist_bins: int, hist_margin: float, **kwargs)
Bases:
HistogramGraph- 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:
HistogramRunner,ReadTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.histread.ReadHistogramWriter(table: Table, **kwargs)
Bases:
HistogramWriter,TableWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.mutdist.MutationDistanceGraph(*, mutdist_null: bool, **kwargs)
Bases:
DatasetGraph,ColorMapGraphDistance between the closest two mutations in each read.
- property data
Data of the graph.
- property g_test
G-test statistic and P-value.
- classmethod get_cmap_type()
Type of the color map.
- get_traces()
Data traces of the graph.
- classmethod graph_kind()
Kind of graph.
- property hists
- property loc_clusters
- property max_read_length
- property row_tracks
Track for each row of subplots.
- property table
- property tabulator
- 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.mutdist.MutationDistanceRunner
Bases:
DatasetRunner- classmethod get_var_params()
Parameters that can vary among different classes.
- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all datasets and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.mutdist.MutationDistanceWriter(*, dataset: MutsDataset, **kwargs)
Bases:
DatasetWriter- get_graph(rel, **kwargs)
Return a graph instance.
- class seismicrna.graph.onesource.OneSourceClusterGroupGraph(*, k: int | None, clust: int | None, k_clust_list: list[tuple[int, int]] | None = None, **kwargs)
Bases:
OneSourceGraph,ClusterGroupGraph,ABC- property path_subject
Subject of the graph.
- class seismicrna.graph.onesource.OneSourceGraph
-
Graph of data from one source of data (Dataset or Table).
- property col_tracks
- property title_action_sample
Action and sample for the title.
- class seismicrna.graph.onestruct.StructOneTableGraph(*, fold_table_region: bool, struct_file: Path | None, struct_reg: str | None, terminal_pairs: bool, branch: str, **kwargs)
Bases:
OneTableRelClusterGroupGraph,OneRelGraph,ABCGraph of data from one Table applied to RNA structure(s).
- property branches
Branches of the workflow.
- property details
Additional details about the graph.
- 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 predicate
Predicate of the graph.
- property struct_reg
Name of the region from which the structure comes.
- class seismicrna.graph.onestruct.StructOneTableRunner
Bases:
OneTableRelClusterGroupRunner,ABC- classmethod get_input_loader()
Function to load input files.
- classmethod get_var_params()
Parameters that can vary among different classes.
- class seismicrna.graph.onestruct.StructOneTableWriter(table: Table, **kwargs)
Bases:
OneTableRelClusterGroupWriter,ABC- iter_graphs(*, rels: list[str], cgroup: str, struct_file: Iterable[str | Path] = (), branch: str = '', fold_coords: Iterable[tuple[str, int, int]] = (), fold_primers: Iterable[tuple[str, DNA, DNA]] = (), fold_regions_file: str | None = None, fold_table_region: bool = False, **kwargs)
Yield graphs for every relationship, cluster, and structure.
- Parameters:
rels (
list[str]) – Relationship codes to graph.cgroup (
str) – Cluster-grouping strategy.struct_file (
Iterable[strorPath], optional) – CT files of RNA structures to use directly.branch (
str, optional) – Branch label for the fold step in the output path.fold_coords (
Iterable[tuple[str,int,int]], optional) –(ref, end5, end3)tuples defining structure regions.fold_primers (
Iterable[tuple[str,DNA,DNA]], optional) –(ref, fwd, rev)primer tuples defining structure regions.fold_regions_file (
strorNone, optional) – Path to a file of fold region definitions.fold_table_region (
bool, optional) – Whether to use the table’s region as the fold region.**kwargs – Forwarded to
get_graph.
- Yields:
StructOneTableGraph– One graph per (cluster group, relationship, structure) combination.
- class seismicrna.graph.onetable.OneTableGraph(*, table: Table | PositionTable | AbundanceTable, **kwargs)
Bases:
TableGraph,OneSourceGraph,ABCGraph of data from one Table.
- property action
Action that generated the data.
- property branches
Branches of the workflow.
- property ref
Name of the reference sequence from which the data come.
- property reg
Name of the reference region from which the data come.
- property sample
Name(s) of the sample(s) from which the data come.
- property seq
Sequence of the region from which the data come.
- property top
Path of the top-level output directory for all files.
- class seismicrna.graph.onetable.OneTableRelClusterGroupGraph(*, table: Table | PositionTable | AbundanceTable, **kwargs)
Bases:
OneTableGraph,RelTableGraph,OneSourceClusterGroupGraph,ABC- property clust_proportions
Proportion of each cluster, keyed by (k, cluster), loaded from the cluster abundance table that accompanies this table. Returns None if the table is not clustered or no abundance table exists.
- property row_tracks
Track for each row of subplots.
- class seismicrna.graph.onetable.OneTableRelClusterGroupRunner
Bases:
OneTableRunner,RelTableRunner,ClusterGroupRunner,ABC
- class seismicrna.graph.onetable.OneTableRelClusterGroupWriter(table: Table, **kwargs)
Bases:
OneTableWriter,ABC- iter_graphs(*, rels: list[str], cgroup: str, **kwargs)
Yield graph instances for every relationship and cluster group.
- Parameters:
rels (
list[str]) – Relationship code strings to graph.cgroup (
str) – Cluster-grouping strategy.**kwargs – Additional keyword arguments forwarded to
get_graph.
- Yields:
OneTableRelClusterGroupGraph– One graph per (cluster group, relationship) combination.
- class seismicrna.graph.onetable.OneTableRunner
Bases:
TableRunner,ABC
- class seismicrna.graph.onetable.OneTableWriter(table: Table, **kwargs)
Bases:
TableWriter,ABC- abstractmethod get_graph(*args, **kwargs) OneTableGraph
Return a graph instance.
- property table
The table providing the data for the graph(s).
- class seismicrna.graph.poscorr.PositionCorrelationGraph(*, dataset: MutsDataset, num_cpus: int, **kwargs)
Bases:
PositionPairGraph,ABCPhi correlations between pairs of positions.
- classmethod get_pair_func()
Function to compare each pair of positions.
- classmethod graph_kind()
Kind of graph.
- classmethod what()
What is being graphed.
- class seismicrna.graph.poscorr.PositionCorrelationRunner
Bases:
PositionPairRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all datasets and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.poscorr.PositionCorrelationWriter(*, dataset: MutsDataset, **kwargs)
Bases:
PositionPairWriter- classmethod graph_type()
Type of graph.
- class seismicrna.graph.pospair.PositionPairGraph(*, dataset: MutsDataset, num_cpus: int, **kwargs)
Bases:
DatasetGraph,ABCFunction of pairs of positions.
- property data
Data of the graph.
- abstractmethod classmethod get_pair_func()
Function to compare each pair of positions.
- get_traces()
Data traces of the graph.
- property row_tracks
Track for each row of subplots.
- property x_title
Title of the x-axis.
- property y_title
Title of the y-axis.
- class seismicrna.graph.pospair.PositionPairRunner
Bases:
DatasetRunner,ABC- abstractmethod classmethod get_writer_type() type[PositionPairWriter]
Type of Writer.
- class seismicrna.graph.pospair.PositionPairWriter(*, dataset: MutsDataset, **kwargs)
Bases:
DatasetWriter- get_graph(rel, **kwargs)
Instantiate a PositionPairGraph for the given relationship.
- Parameters:
rel (
str) – One-letter relationship code.**kwargs – Additional keyword arguments forwarded to the graph class.
- Returns:
A new graph instance for the given relationship.
- Return type:
- abstractmethod classmethod graph_type() type[PositionPairGraph]
Type of graph.
- class seismicrna.graph.profile.MultiRelsProfileGraph(*, rels: str, **kwargs)
Bases:
MultiRelsGraph,ProfileGraphStacked 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,ProfileGraphBar 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 | PositionTable | AbundanceTable, **kwargs)
Bases:
OneTableRelClusterGroupGraph,ColorMapGraph,ABCBar graph of a mutational profile for one table.
- property data
Data of the graph.
- property data_header
Header of the filtered 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:
OneTableRelClusterGroupRunner,PositionTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.rel.MultiRelsGraph(*, rels: str, **kwargs)
-
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)
-
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.rel.RelGraph
-
Graph of one or more types of relationships.
- abstract property rel_names
Names of the relationships to graph.
- class seismicrna.graph.rel.RelRunner
Bases:
BaseRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- class seismicrna.graph.roc.ROCGraph(*, fold_table_region: bool, struct_file: Path | None, struct_reg: str | None, terminal_pairs: bool, branch: str, **kwargs)
Bases:
StructOneTableGraphGraph 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,PositionTableRunner- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.roc.ROCWriter(table: Table, **kwargs)
Bases:
StructOneTableWriter,TableWriter
- seismicrna.graph.roc.rename_columns(df: pd.DataFrame)
Rename the levels of the columns.
- class seismicrna.graph.roll.RollingGraph(*, window: int, winmin: int, **kwargs)
Bases:
TableGraph,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:
TableRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- class seismicrna.graph.scatter.ScatterGraph(*, metric: str, **kwargs)
Bases:
TwoTableRelClusterGroupGraph,OneRelGraph,ColorMapGraph- property annotations
Text annotations for the figure.
- 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 xmax
- property y_title
Title of the y-axis.
- property ymax
- class seismicrna.graph.scatter.ScatterRunner
Bases:
TwoTableRelClusterGroupRunner,PositionTableRunner- classmethod get_var_params()
Parameters that can vary among different classes.
- classmethod get_writer_type()
Type of Writer.
- classmethod run(*args, **kwargs)
Load all tables and write comparison graphs for each pair.
- Parameters:
input_path (
Iterable[strorPath]) – Paths to input files or directories to search for tables.compself (
bool) – If True, compare each table with itself.comppair (
bool) – If True, compare every pair of different tables with the same reference and region.verify_times (
bool) – Whether to verify file modification times when loading tables.num_cpus (
int) – Number of CPUs for parallel graph writing.**kwargs – Forwarded to each writer’s
writemethod.
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.scatter.ScatterWriter(table1: Table, table2: Table, **kwargs)
Bases:
TwoTableRelClusterGroupWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.snrroll.RollingSNRGraph(*, table: Table | PositionTable | AbundanceTable, **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 Writer.
- classmethod run(*args, **kwargs)
Load all tables and write graphs for each.
- Parameters:
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.snrroll.RollingSNRWriter(table: Table, **kwargs)
Bases:
RollingStatWriter- classmethod get_graph_type()
Type of graph.
- class seismicrna.graph.statroll.RollingStatGraph(*, table: Table | PositionTable | AbundanceTable, **kwargs)
Bases:
OneTableRelClusterGroupGraph,OneRelGraph,RollingGraph,ABC- property data
Data of the graph.
- get_traces()
Data traces of the graph.
- abstractmethod classmethod stat_func() Callable[[pd.Series], pd.Series]
Function to compute a statistic on the data.
- class seismicrna.graph.statroll.RollingStatRunner
Bases:
OneTableRelClusterGroupRunner,RollingRunner,PositionTableRunner,ABC
- class seismicrna.graph.statroll.RollingStatWriter(table: Table, **kwargs)
Bases:
OneTableRelClusterGroupWriter,TableWriter,ABC- get_graph(rels_group: str, **kwargs)
Instantiate a RollingStatGraph for the given relationship.
- Parameters:
rels_group (
str) – One-letter relationship code.**kwargs – Additional keyword arguments forwarded to the graph class.
- Returns:
A new rolling-statistic graph for the given relationship.
- Return type:
RollingGraph
- abstractmethod classmethod get_graph_type() type[RollingGraph]
Type of graph.
- class seismicrna.graph.table.AbundanceTableRunner
Bases:
TableRunner,ABC- classmethod get_input_loader()
Function to load input files.
- class seismicrna.graph.table.PositionTableRunner
Bases:
RelTableRunner,ABC- classmethod get_input_loader()
Function to load input files.
- class seismicrna.graph.table.ReadTableRunner
Bases:
RelTableRunner,ABC- classmethod get_input_loader()
Function to load input files.
- class seismicrna.graph.table.RelTableGraph(*, graph_quantile: float, **kwargs)
Bases:
TableGraph,RelGraph,ABC- property details
Additional details about the graph.
- property predicate
Predicate of the graph.
- class seismicrna.graph.table.RelTableRunner
Bases:
RelRunner,TableRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- class seismicrna.graph.table.TableGraph(*, use_ratio: bool, **kwargs)
-
Graph based on one or more tables.
- property data_kind
either “ratio” or “count”.
- Type:
Kind of data being used
- class seismicrna.graph.table.TableRunner
Bases:
BaseRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- abstractmethod classmethod get_writer_type() type[TableWriter]
Type of Writer.
- class seismicrna.graph.table.TableWriter(*tables: Table, **kwargs)
Bases:
BaseWriter,ABC- abstractmethod iter_graphs(*args, **kwargs) Generator[TableGraph, None, None]
Yield every graph.
- seismicrna.graph.table.load_abundance_tables(input_paths: Iterable[str | Path], **kwargs)
Load read tables.
- seismicrna.graph.table.load_pos_tables(input_paths: Iterable[str | Path], **kwargs)
Load position tables.
- seismicrna.graph.table.load_read_tables(input_paths: Iterable[str | Path], **kwargs)
Load read tables.
- seismicrna.graph.trace.get_hist_trace(data: pd.Series, rel: str, cmap: ColorMap)
Build a histogram bar trace for one relationship type.
- Parameters:
data (
pd.Series) – Histogram data. If the index is apd.MultiIndexits levels areHIST_LOWER_NAMEandHIST_UPPER_NAME(ratio bins); otherwise it is a plainpd.IndexnamedHIST_COUNT_NAME(count bins).rel (
str) – Name of the relationship (used as the trace name and for color lookup).cmap (
ColorMap) – Color map used to look up the color forrel.
- Returns:
A bar trace representing the histogram for
rel.- Return type:
plotly.graph_objects.Bar
- seismicrna.graph.trace.get_pairwise_position_trace(data: pd.Series, end5: int, end3: int)
Build a pairwise-position heatmap trace.
- Parameters:
- Returns:
A symmetric heatmap trace covering positions
end5toend3.- Return type:
plotly.graph_objects.Heatmap
- seismicrna.graph.trace.get_roc_trace(fpr: pd.Series, tpr: pd.Series, profile: str, struct: str)
Build an ROC curve trace for one profile/structure combination.
- Parameters:
- Returns:
An ROC curve trace with AUC annotated in the trace name.
- Return type:
plotly.graph_objects.Scatter
- seismicrna.graph.trace.get_seq_base_bar_trace(data: pd.Series, cmap: ColorMap, base: str)
Build a bar trace for one DNA base type.
- Parameters:
data (
pd.Series) – Data indexed by a MultiIndex with levels includingBASE_NAMEandPOS_NAME.cmap (
ColorMap) – Color map used to look up the color forbase.base (
str) – Single-character DNA base code (A, C, G, T, or N).
- Returns:
A bar trace for the positions of the given base type.
- Return type:
plotly.graph_objects.Bar
- seismicrna.graph.trace.get_seq_base_scatter_trace(xdata: pd.Series, ydata: pd.Series, cmap: ColorMap, base: str)
Build a scatter trace for one DNA base type.
- Parameters:
xdata (
pd.Series) – x-axis data indexed by a MultiIndex with levels includingBASE_NAMEandPOS_NAME.ydata (
pd.Series) – y-axis data with the same index asxdata.cmap (
ColorMap) – Color map used to look up the color forbase.base (
str) – Single-character DNA base code (A, C, G, T, or N).
- Returns:
A scatter trace for the positions of the given base type.
- Return type:
plotly.graph_objects.Scatter
- seismicrna.graph.trace.get_seq_line_trace(data: pd.Series)
- seismicrna.graph.trace.get_seq_stack_bar_trace(data: pd.Series, rel: str, cmap: ColorMap)
Build a stacked bar trace for one relationship type.
- Parameters:
data (
pd.Series) – Per-position data indexed by a MultiIndex with levels includingBASE_NAMEandPOS_NAME.rel (
str) – Name of the relationship (used as the trace name and for color lookup).cmap (
ColorMap) – Color map used to look up the color forrel.
- Returns:
A bar trace for all positions, colored by relationship type.
- Return type:
plotly.graph_objects.Bar
- seismicrna.graph.trace.iter_line_traces(lines: pd.DataFrame)
- seismicrna.graph.trace.iter_roc_traces(fprs: pd.DataFrame, tprs: pd.DataFrame, profile: str)
Yield one ROC trace per RNA structure.
- Parameters:
fprs (
pd.DataFrame) – DataFrame whose columns correspond to structures and whose values are false positive rates.tprs (
pd.DataFrame) – DataFrame whose columns correspond to structures and whose values are true positive rates; columns must matchfprs.profile (
str) – Name of the mutational profile.
- Yields:
plotly.graph_objects.Scatter– One ROC trace per structure column.
- seismicrna.graph.trace.iter_seq_base_scatter_traces(xdata: pd.Series, ydata: pd.Series, cmap: ColorMap)
Yield one scatter trace per DNA base type.
- Parameters:
xdata (
pd.Series) – x-axis data indexed by a MultiIndex includingBASE_NAMEandPOS_NAME.ydata (
pd.Series) – y-axis data with the same index asxdata.cmap (
ColorMap) – Color map for base coloring.
- Yields:
plotly.graph_objects.Scatter– One trace per base inDNA.alph().
- seismicrna.graph.trace.iter_seq_line_traces(data: pd.Series, *_, **__)
Yield a single line trace for sequence data.
- Parameters:
data (
pd.Series) – Per-position data indexed by a MultiIndex includingPOS_NAME.*_ – Ignored extra arguments (for call-signature compatibility).
**__ – Ignored extra arguments (for call-signature compatibility).
- Yields:
plotly.graph_objects.Scatter– One line trace for the entire series.
- seismicrna.graph.trace.iter_stack_bar_traces(data: pd.DataFrame)
- class seismicrna.graph.twotable.TwoTableGraph(*, out_dir: str | Path, table1: Table | PositionTable, table2: Table | PositionTable, **kwargs)
Bases:
TableGraph,ABCGraph 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 branches
Branches of the workflow.
- property ref
Name of the reference sequence from which the data come.
- property reg
Name of the reference region from which the data come.
- 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 seq
Sequence of the region 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.TwoTableMergedClusterGroupGraph(*, k1: int | None, clust1: int | None, k2: int | None, clust2: int | None, **kwargs)
Bases:
TwoTableRelClusterGroupGraph,ABCGraph 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.TwoTableRelClusterGroupGraph(*, k1: int | None, clust1: int | None, k2: int | None, clust2: int | None, **kwargs)
Bases:
TwoTableGraph,RelTableGraph,ClusterGroupGraph,ABC- property col_proportions
Cluster proportions for the column tracks.
- property col_tracks
Track for each column 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 row_proportions
Cluster proportions for the row tracks.
- property row_tracks
Track for each row of subplots.
- class seismicrna.graph.twotable.TwoTableRelClusterGroupRunner
Bases:
TwoTableRunner,RelTableRunner,ClusterGroupRunner,ABC
- class seismicrna.graph.twotable.TwoTableRelClusterGroupWriter(table1: Table, table2: Table, **kwargs)
Bases:
TwoTableWriter,ABC- iter_graphs(*, rels: list[str], cgroup: str, **kwargs)
Yield graphs for every relationship and cluster-group pair.
- Parameters:
rels (
list[str]) – Relationship codes to graph.cgroup (
str) – Cluster-grouping strategy applied to both tables.**kwargs – Additional keyword arguments forwarded to the graph class.
- Yields:
TwoTableRelClusterGroupGraph– One graph per (cluster group from table1, cluster group from table2, relationship) combination.
- class seismicrna.graph.twotable.TwoTableRunner
Bases:
TableRunner,ABC- classmethod get_var_params()
Parameters that can vary among different classes.
- abstractmethod classmethod get_writer_type() type[TwoTableWriter]
Type of Writer.
- classmethod run(input_path: Iterable[str | Path], *, compself: bool, comppair: bool, verify_times: bool, num_cpus: int, **kwargs)
Load all tables and write comparison graphs for each pair.
- Parameters:
input_path (
Iterable[strorPath]) – Paths to input files or directories to search for tables.compself (
bool) – If True, compare each table with itself.comppair (
bool) – If True, compare every pair of different tables with the same reference and region.verify_times (
bool) – Whether to verify file modification times when loading tables.num_cpus (
int) – Number of CPUs for parallel graph writing.**kwargs – Forwarded to each writer’s
writemethod.
- Returns:
Paths of all written output files.
- Return type:
list[Path]
- class seismicrna.graph.twotable.TwoTableWriter(table1: Table, table2: Table, **kwargs)
Bases:
TableWriter,ABCWrite the proper types of graphs for two given tables.
- abstractmethod classmethod get_graph_type(*args, **kwargs) type[TwoTableGraph]
Type of graph.
- property table1
The first table providing the data for the graph(s).
- property table2
The second table providing the data for the graph(s).