openprotein.umap#

Fit and transform your embeddings using UMAP to help visualize your embeddings.

Endpoints#

class openprotein.umap.UMAPAPI[source]#

UMAP API providing the interface to fit and run UMAP visualizations.

__init__(session)[source]#
Parameters:

session (APISession)

fit_umap(model, feature_type=None, sequences=None, assay=None, n_components=2, reduction=None, **kwargs)[source]#

Fit an UMAP on the sequences with the specified model_id and hyperparameters (n_components).

Parameters:
  • model_id (str) – The ID of the model to fit the UMAP on.

  • sequences (list[bytes]) – The list of sequences to use for the UMAP fitting.

  • n_components (int, optional) – The number of components for the UMAP, by default 2.

  • reduction (str, optional) – The reduction method to apply to the embeddings, by default None.

  • model (EmbeddingModel | SVDModel | str)

  • feature_type (FeatureType | None)

  • assay (AssayDataset | None)

Returns:

The model with the UMAP fit.

Return type:

UMAPModel

get_umap(umap_id)[source]#

Get UMAP job results. Including UMAP dimension and sequence lengths.

Requires a successful UMAP job from fit_umap

Parameters:

umap_id (str) – The ID of the UMAP job.

Returns:

The model with the UMAP fit.

Return type:

UMAPModel

list_umap()[source]#

List UMAP models made by user.

Takes no args.

Returns:

UMAPModels

Return type:

list[UMAPModel]

class openprotein.umap.UMAPModel[source]#

Class providing embedding endpoint for UMAP models. Also allows retrieving embeddings of sequences used to fit the UMAP with get. Implements a Future to allow waiting for a fit job.

job: UMAPFitJob#
__init__(session, job=None, metadata=None)[source]#

Initializes with either job get or umap metadata get.

Parameters:
  • session (APISession)

  • job (UMAPFitJob | None)

  • metadata (UMAPMetadata | None)

property id#
property n_components#
property n_neighbors#
property min_dist#
property sequence_length#
property reduction#
property metadata#
property sequences#
property embeddings#
get_model()[source]#

Fetch embeddings model

Return type:

EmbeddingModel

property model: EmbeddingModel#
delete()[source]#

Delete this UMAP model.

Return type:

bool

get(verbose=False)[source]#

Return the results from this job.

Parameters:

verbose (bool)

get_inputs()[source]#

Get sequences used for umap job.

Returns:

List[bytes]

Return type:

list of sequences

embed(sequences, **kwargs)[source]#

Use this UMAP model to get reduced embeddings from input sequences.

Parameters:

sequences (List[bytes]) – List of protein sequences.

Returns:

Class for further job manipulation.

Return type:

EmbeddingResultFuture