torchcell.datasets.CalmDataset

class CalmDataset(root: str, genome: SCerevisiaeGenome, model_name: str | None = 'calm', transform: Callable[[...], Any] | None = None, pre_transform: Callable[[...], Any] | None = None, batch_size: int = 100)[source]

Bases: BaseEmbeddingDataset

Embedding dataset that runs the CaLM model over gene CDS sequences.

CaLM tokenizes its input into codons, so each gene embeds its spliced CDS (the orf_coding FASTA record), truncated to the first 3,072 nt (1,024 codons, in frame from the start codon) when longer. dna_windows stores exactly the string embedded.

initialize_model() → CaLM[source]

Return a new CaLM model instance.

static parse_genome(genome: SCerevisiaeGenome | None) → ParsedGenome | None[source]

Extract the gene set from a genome into a ParsedGenome (or None).

property partial_path: str

Path of the in-progress chunk file, beside (never at) the final store.

process() → None[source]

Embed each gene’s CDS with CaLM and save the processed data list.

Chunks are written to partial_path; a chunk file left by an interrupted build is removed with a warning, since the build restarts at the first gene.