Views
No views yet
| Repo | Tracks | Embed dim | Objective | Used in |
|---|---|---|---|---|
antichronology/orthrus-4-track | 4 | 512 | contrastive | Nature Methods publication |
antichronology/orthrus-6-track | 6 | 512 | contrastive | Nature Methods publication |
antichronology/orthrus-small-6-track | 6 | 256 | contrastive | Nature Methods publication |
antichronology/orthrus-mlm-6-track | 6 | 512 | contrastive + MLM | Nature Methods publication |
quietflamingo/orthrus-base-4-track | 4 | 256 | contrastive | Pre-publication |
quietflamingo/orthrus-large-4-track | 4 | 512 | contrastive | Pre-publication |
quietflamingo/orthrus-large-6-track | 6 | 512 | contrastive | Pre-publication |
| Method | Output shape | Notes |
|---|---|---|
representation(x, lengths, channel_last=True) | (B, D) | Mean-pooled, padding-aware |
representation_unpooled(x, channel_last=True) | (B, L, D) | Per-position hidden states |
predict_tokens(x, lengths, channel_last=True) | (B, L, 4) | MLM logits over [A, C, G, T]. Available on MLM-pretrained repos (*-mlm-*); raises NotImplementedError on contrastive-only checkpoints. |
seq_to_oh(seq) | (L, 4) | One-hot helper, ordering [A, C, G, T] (U is treated as T) |
1# Conda env with Python 3.10
2mamba create -n orthrus python=3.10
3mamba activate orthrus
4
5# PyTorch + transformers + huggingface_hub
6pip install 'torch>=2.2' 'transformers<4.46' 'huggingface_hub>=0.24' safetensors
7
8# Mamba kernels (require CUDA; pin versions for the published checkpoints)
9pip install causal-conv1d==1.2.0.post2 --no-build-isolation --no-cache-dir
10pip install mamba-ssm==1.2.0.post1 --no-build-isolation --no-cache-dir
11
12# GenomeKit, only if you want to build 6-track inputs from real transcripts
13mamba install "genomekit>=6.0.0"
14wget -O starter_build.sh https://raw.githubusercontent.com/deepgenomics/GenomeKit/main/starter/build.sh
15chmod +x starter_build.sh
16./starter_build.sh1import torch
2from transformers import AutoModel
3
4device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5
6model = AutoModel.from_pretrained(
7 "antichronology/orthrus-4-track",
8 trust_remote_code=True,
9).to(device).eval()1sequence = (
2 "TCATCTGGATTATACATATTTCGCAATGAAAGAGAGGAAGAAAAGGAAGCAGCAAAATATGTGGAGGCCCA"
3 "ACAAAAGAGACTAGAAGCCTTATTCACTAAAATTCAGGAGGAATTTGAAGAACATGAAGTTACTTCCTCC"
4)
5oh = model.seq_to_oh(sequence).unsqueeze(0).to(device) # (1, L, 4)
6lengths = torch.tensor([oh.shape[1]], device=device)
7
8with torch.no_grad():
9 emb = model.representation(oh, lengths, channel_last=True)
10# emb.shape == (1, D)1import numpy as np
2import torch
3from genome_kit import Genome
4
5genome = Genome("gencode.v44") # or whatever annotation you built
6
7def find_transcript_by_gene_name(genome, gene_name):
8 return [t for t in genome.transcripts if t.gene.name == gene_name]
9
10def get_transcript_seq(transcript, genome):
11 return "".join(genome.dna(exon) for exon in transcript.exons)
12
13def build_cds_track(transcript):
14 """1 at every 3rd base of the CDS, 0 in UTRs."""
15 exons = transcript.exons
16 L = sum(len(e) for e in exons)
17 cds = transcript.cdss
18 if not cds:
19 return np.zeros(L, dtype=np.float32)
20
21 strand = transcript.strand
22 if strand == "+":
23 sorted_cds = sorted(cds, key=lambda c: c.start)
24 sorted_exons = sorted(exons, key=lambda e: e.start)
25 first_cds = sorted_cds[0]
26 else:
27 sorted_cds = sorted(cds, key=lambda c: c.end, reverse=True)
28 sorted_exons = sorted(exons, key=lambda e: e.end, reverse=True)
29 first_cds = sorted_cds[0]
30
31 cds_len = sum(len(c) for c in sorted_cds)
32
33 five_utr = 0
34 for ex in sorted_exons:
35 if strand == "+":
36 if ex.end <= first_cds.start:
37 five_utr += len(ex)
38 elif ex.overlaps(first_cds):
39 five_utr += max(0, first_cds.start - ex.start)
40 break
41 else:
42 break
43 else:
44 if ex.start >= first_cds.end:
45 five_utr += len(ex)
46 elif ex.overlaps(first_cds):
47 five_utr += max(0, ex.end - first_cds.end)
48 break
49 else:
50 break
51
52 three_utr = max(0, L - (five_utr + cds_len))
53 body = np.zeros(cds_len, dtype=np.float32)
54 body[0::3] = 1.0
55 return np.concatenate([
56 np.zeros(five_utr, dtype=np.float32),
57 body,
58 np.zeros(three_utr, dtype=np.float32),
59 ])
60
61def build_splice_track(transcript):
62 """1 at the last base of each exon, 0 elsewhere."""
63 exons = transcript.exons
64 L = sum(len(e) for e in exons)
65 track = np.zeros(L, dtype=np.float32)
66 cumulative = 0
67 for ex in exons:
68 cumulative += len(ex)
69 track[cumulative - 1] = 1.0
70 return track
71
72t = find_transcript_by_gene_name(genome, "BCL2L1")[0]
73sequence = get_transcript_seq(t, genome)
74cds = build_cds_track(t)
75splice = build_splice_track(t)
76
77oh = model.seq_to_oh(sequence).numpy() # (L, 4)
78x = np.hstack([oh, cds[:, None], splice[:, None]]) # (L, 6)
79x = torch.tensor(x, device=device).unsqueeze(0)
80lengths = torch.tensor([x.shape[1]], device=device)
81
82with torch.no_grad():
83 emb = model.representation(x, lengths, channel_last=True)
84# emb.shape == (1, D)np.hstack them with seq_to_oh output.1with torch.no_grad():
2 hidden = model.representation_unpooled(x, channel_last=True)
3# hidden.shape == (1, L, D)
4# Useful for: local scoring at a specific transcript position, attention
5# probing, downstream sequence-tagging tasks.*-mlm-* checkpoints. Calling predict_tokens on a contrastive Orthrus model raises NotImplementedError with a pointer to the MLM repo.predict_tokens:1import torch.nn.functional as F
2
3# Start from a 4-track or 6-track input `x` built above, shape (1, L, C).
4pos = 123 # 0-based transcript-coordinate position
5x_masked = x.clone()
6x_masked[0, pos, :4] = 0.0 # zero nucleotide channels only; keep CDS/splice intact
7
8with torch.no_grad():
9 logits = model.predict_tokens(x_masked, lengths, channel_last=True) # (1, L, 4)
10 log_probs = F.log_softmax(logits[0, pos, :], dim=-1)
11# log_probs[i] = log P(nucleotide i | masked context), i in [A, C, G, T]
12
13# Variant-effect score for a SNV REF->ALT at this position:
14REF, ALT = 0, 2 # e.g. A -> G
15llr = (log_probs[ALT] - log_probs[REF]).item()1@article{fradkinShi2026,
2 title = {Orthrus: toward evolutionary and functional RNA foundation models},
3 ISSN = {1548-7105},
4 url = {http://dx.doi.org/10.1038/s41592-026-03064-3},
5 DOI = {10.1038/s41592-026-03064-3},
6 journal = {Nature Methods},
7 publisher = {Springer Science and Business Media LLC},
8 author = {Fradkin, Philip and Shi, Ruian "Ian" and Dalal, Taykhoom and Isaev, Keren and Frey, Brendan J. and Lee, Leo J. and Morris, Quaid and Wang, Bo},
9 year = {2026},
10 month = Apr
11}