Sample#

Constructor#

class itpseq.Sample(replicates=None, *, labels=None, reference=None, dataset=None, keys=('sample',), name=None, **kwargs)[source]

Represents a sample in a dataset, its replicates, reference, and associated metadata.

The Sample class is used to encapsulate information and behavior related to samples in a dataset. It manages details like labels, references, replicates, and metadata, and provides methods for analyzing replicates, performing differential enrichment analysis, and creating visualizations.

Examples

Get a Sample from a DataSet
>>> sample = dataset['sample_name']
Compute the differential expression for positions E-P-A.
>>> sample.DE('E:A')
Attributes:
name_ref
name_vs_ref

Methods

DE([pos, join, quiet, filter_size, multi, ...])

Computes the differential expression between the sample and its reference.

all_logos([logo_kwargs])

Creates a logo for all positions for each replicate in the sample.

copy([name, reference])

Creates a copy of the sample.

get_counts([pos])

Counts the number of reads for each motif or combination of amino-acid/position for each replicate in the sample.

get_counts_ratio([pos, factor, exclude_empty])

Outputs the result of get_counts for the sample and its reference and add extra columns: the normalized averages and the sample/reference ratio.

get_counts_ratio_pos([pos])

Computes a DataFrame with the enrichment ratios for each ribosome position.

hmap([r, c, pos, col, transform, cmap, ...])

Generates a heatmap of enrichment for combinations of 2 positions.

hmap_grid([pos, col, transform, cmap, vmax, ...])

Creates a grid of heatmaps for all combinations of ribosome positions passed in pos.

hmap_pos([pos, cmap, vmax, center, ax])

Generates a heatmap of enrichment ratios for amino acid positions across ribosome sites.

infos([html])

Returns a table with information on the NGS reads per replicate.

itoeprint([plot, norm, norm_range, ...])

Plots a virtual inverse-toeprint gel.

itp_len_plot([ax, min_codon, max_codon, ...])

Generates a line plot of inverse-toeprint (ITP) counts per length.

logo([pos, logo_kwargs, ax])

Creates a logo for the selected positions.

rename(name[, rename_replicates])

Changes the name of the sample.

volcano([pos, query, motif, ax, x, y, ...])

Draws a volcano plot from the Differential Expression data.

load_replicates

Methods#

Sample.rename(name[, rename_replicates])

Changes the name of the sample.

Sample.copy([name, reference])

Creates a copy of the sample.

Sample.infos([html])

Returns a table with information on the NGS reads per replicate.

Sample.get_counts([pos])

Counts the number of reads for each motif or combination of amino-acid/position for each replicate in the sample.

Sample.get_counts_ratio([pos, factor, ...])

Outputs the result of get_counts for the sample and its reference and add extra columns: the normalized averages and the sample/reference ratio.

Sample.get_counts_ratio_pos([pos])

Computes a DataFrame with the enrichment ratios for each ribosome position.

Sample.DE([pos, join, quiet, filter_size, ...])

Computes the differential expression between the sample and its reference.

Sample.hmap([r, c, pos, col, transform, ...])

Generates a heatmap of enrichment for combinations of 2 positions.

Sample.hmap_grid([pos, col, transform, ...])

Creates a grid of heatmaps for all combinations of ribosome positions passed in pos.

Sample.volcano([pos, query, motif, ax, x, ...])

Draws a volcano plot from the Differential Expression data.

Sample.logo([pos, logo_kwargs, ax])

Creates a logo for the selected positions.

Sample.all_logos([logo_kwargs])

Creates a logo for all positions for each replicate in the sample.

Sample.itp_len_plot([ax, min_codon, ...])

Generates a line plot of inverse-toeprint (ITP) counts per length.

Sample.itoeprint([plot, norm, norm_range, ...])

Plots a virtual inverse-toeprint gel.