GeneExpressionData#

class alphagenome.data.gene_expression_data.GeneExpressionData(values, track_metadata, gene_metadata, interval)[source]#

Container for storing gene expression data.

Used to store gene-level predictions for denoised single-cell gene expression (SC_GENE_EXPRESSION_DENOISED; one channel per strand, in CPM) and protocol-specific single-cell gene expression (SC_GENE_EXPRESSION, in CPM).

values#

A numpy array of floats representing the gene expression for each track.

track_metadata#

A pandas DataFrame containing metadata for each track.

gene_metadata#

A pandas DataFrame containing metadata for each gene.

interval#

An Interval object representing the genomic region containing the genes.

names#

Array of track names from track_metadata['name'].

strands#

Array of track strands from track_metadata['strand'].

num_tracks#

Total number of tracks along axis 1 of values.

Raises:

ValueError – If the number of tracks in values does not match the number of rows in track_metadata, or if the number of gene in values does not match the number of rows in gene_metadata or if track_metadata contains duplicate names.

Methods

copy()

Returns a deep copy of the GeneExpressionData object.

filter_to_negative_strand()

Filters tracks to the negative DNA strand.

filter_to_nonnegative_strand()

Filters tracks to the non-negative DNA strands (positive and unstranded).

filter_to_nonpositive_strand()

Filters tracks to the non-positive DNA strands (negative and unstranded).

filter_to_observed()

Filters tracks to observed tracks.

filter_to_positive_strand()

Filters tracks to the positive DNA strand.

filter_to_protein_coding()

Filters data to protein coding genes only.

filter_to_stranded()

Filters tracks to stranded tracks (excluding unstranded).

filter_to_unstranded()

Filters tracks to unstranded tracks.

filter_tracks(mask)

Filters tracks by a boolean mask.

get_genes_as_intervals()

Returns the gene intervals as a sequence of Interval objects.

resize(width)

Resizes the interval, removing genes falling outside the new width.

select_tracks_by_index(idx)

Selects tracks by numerical index.

slice_by_interval(interval)

Slices the GeneExpressionData to include only genes within an interval.

to_anndata()

Converts the GeneExpressionData to an AnnData object.

with_metadata_column(name, value)

Returns a new GeneExpressionData with updated track metadata.

with_name_suffix(suffix)

Returns a new GeneExpressionData object with suffixed track names.