torchcell.models.fungal_up_down_transformer.FungalUpDownTransformer

class FungalUpDownTransformer(model_name: str = '', target_layer: int | tuple[int, ...] = (8,))[source]

Bases: NucleotideModel

Embed DNA sequences upstream and downstream of the CDS via SpeciesLM.

The FungalUpDownTransformer embeds DNA sequences upstream the CDS and downstream the CDS. It was trained on 1003 bp upstream sequences (including the start codon) and 300 bp downstream sequences (including the stop codon). It handles both upstream and downstream sequences. valid models include ["downstream_species_lm", "upstream_species_lm"]. The original paper discusses two other models (["downstream_agnostic_lm", "upstream_agnostic_lm"]), but they are not supported here.

VALID_MODEL_NAMES

Valid names for the model

Type:

List[str]

load_model(model_name: str = '') → None[source]

Load the model and tokenizer used for embedding sequences.

property max_sequence_size: int

Return the maximum permissible sequence size for the loaded model.

Returns:

The maximum permissible sequence size.

Return type:

int

embed(sequences: list[str], mean_embedding: bool = True, proxy_species: str = 'candida_glabrata') → Tensor[source]

Embed the provided sequences using the loaded transformer model.