"""Sci Adv 2026, doi 10.1126/sciadv.aeb2491 (Sjogren's disease): Table 2 of the paper (derived/Table2_Ro60_reactive_TCRs.csv), 13 salivary gland CD4+ TCRs reactive to Ro60 in a
TCR reporter system. HLA allele and core epitope as printed ("DRA1*01:01 + DRB1*14:06" is printed so, not corrected); the core is a Ro60 residue range, the peptide sequence is not in the table.
Gene names get their TRAV/TRAJ/TRBV/TRBJ prefix (the table prints numbers only). Donor: the part of the TCR name before the dash when it is an LB patient code (LB189, LB219 ...; the paper
names these as patients); "Clone 5B/8E/7E" carry no patient code, donor left empty. The remaining >200 TCRs of the screen are in JGA (controlled access) and are not loaded."""
import pandas as pd
from atlas import SRC


def parse():
    t = pd.read_csv(SRC / "Takeshita2026/derived/Table2_Ro60_reactive_TCRs.csv")
    g = lambda c, p: p + t[c].astype(str)
    return pd.DataFrame({"source": "Takeshita 2026 (Sci Adv)", "study": "doi:10.1126/sciadv.aeb2491", "species": "human", "cd4_evidence": "MHC class II restriction",
                         "restriction": t["HLA allele"].str.replace("\xa0", " "), "TRAV": g("TRAV", "TRAV"), "TRAJ": g("TRAJ", "TRAJ"), "CDR3a": t["TRA junction"],
                         "TRBV": g("TRBV", "TRBV"), "TRBJ": g("TRBJ", "TRBJ"), "CDR3b": t["TRB junction"],
                         "epitope": "Ro60 " + t.Core.str.replace("–", "-") + " (residue range; sequence not in the table)", "antigen": "Ro60 (TROVE2)", "organism": "Homo sapiens (autoantigen)",
                         "context": "Sjogren's disease, salivary gland lesion CD4+ T cell, TCR " + t["TCR name"], "annotation_level": "epitope",
                         "specificity_evidence": "TCR reconstitution, reporter assay", "donor": t["TCR name"].str.extract(r"^(LB\d+)-")[0], "cells": 1})
