Commit ·
e749b8b
1
Parent(s): e5bf473
Add chain composition columns and function matching scores
Browse filesCo-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- backend/app/protein/api/routes/protein.py +2 -2
- backend/app/protein/tsv_loader.py +39 -2
- backend/scripts/generate_node_lookup.py +3 -3
- frontend/src/api/protein.ts +6 -3
- frontend/src/components/datasets/protein/ChainBasicInfoCards.tsx +5 -0
- frontend/src/components/datasets/protein/DataTable.tsx +214 -203
- frontend/src/components/datasets/protein/FunctionPanel.tsx +16 -3
- frontend/src/types/protein.ts +126 -121
backend/app/protein/api/routes/protein.py
CHANGED
|
@@ -252,8 +252,8 @@ async def get_chain_functions(
|
|
| 252 |
pdb_id: str = Query(..., description="4-character PDB ID"),
|
| 253 |
auth_asym_id: str = Query(..., description="Chain identifier (e.g., 'A')"),
|
| 254 |
):
|
| 255 |
-
"""Return ranked functional annotations
|
| 256 |
-
functions = tsv_loader.
|
| 257 |
if functions is None:
|
| 258 |
raise HTTPException(status_code=404, detail=f"No annotation found for {pdb_id}:{auth_asym_id}")
|
| 259 |
return {"pdb_id": pdb_id.lower(), "chain_id": auth_asym_id.upper(), "functions": functions}
|
|
|
|
| 252 |
pdb_id: str = Query(..., description="4-character PDB ID"),
|
| 253 |
auth_asym_id: str = Query(..., description="Chain identifier (e.g., 'A')"),
|
| 254 |
):
|
| 255 |
+
"""Return ranked functional annotations (with matching scores) for a chain."""
|
| 256 |
+
functions = tsv_loader.get_functions_with_scores(pdb_id, auth_asym_id)
|
| 257 |
if functions is None:
|
| 258 |
raise HTTPException(status_code=404, detail=f"No annotation found for {pdb_id}:{auth_asym_id}")
|
| 259 |
return {"pdb_id": pdb_id.lower(), "chain_id": auth_asym_id.upper(), "functions": functions}
|
backend/app/protein/tsv_loader.py
CHANGED
|
@@ -33,7 +33,7 @@ def _load() -> Dict[Tuple[str, str], _Row]:
|
|
| 33 |
cur.execute(
|
| 34 |
'SELECT pdb_id, auth_asym_id, binding_status, sequence, sequence_length,'
|
| 35 |
' cath_id, cath_superfamily, Rosetta, FoldX, EvoEF2, RW, "RW+", ranked_functions,'
|
| 36 |
-
' state_id, experimental_method, pH, temp_K, chain_composition'
|
| 37 |
' FROM node'
|
| 38 |
)
|
| 39 |
for row in cur:
|
|
@@ -58,6 +58,7 @@ def _load() -> Dict[Tuple[str, str], _Row]:
|
|
| 58 |
"pH": row["pH"] or "",
|
| 59 |
"temp_K": row["temp_K"] or "",
|
| 60 |
"chain_composition": row["chain_composition"] or "",
|
|
|
|
| 61 |
}
|
| 62 |
finally:
|
| 63 |
conn.close()
|
|
@@ -89,7 +90,7 @@ def _lookup_node_row(pdb_id: str, auth_asym_id: str) -> Optional[_Row]:
|
|
| 89 |
row = conn.execute(
|
| 90 |
'SELECT binding_status, sequence, sequence_length, cath_id, cath_superfamily,'
|
| 91 |
' Rosetta, FoldX, EvoEF2, RW, "RW+", ranked_functions,'
|
| 92 |
-
' state_id, experimental_method, pH, temp_K, chain_composition'
|
| 93 |
' FROM node WHERE LOWER(pdb_id) = ? AND UPPER(auth_asym_id) = ? LIMIT 1',
|
| 94 |
(pdb_id.lower(), auth_asym_id.upper()),
|
| 95 |
).fetchone()
|
|
@@ -201,6 +202,42 @@ def get_functions(pdb_id: str, auth_asym_id: str) -> Optional[List[str]]:
|
|
| 201 |
return [f for f in _parse_functions(row["ranked_functions"]) if len(f) > 10]
|
| 202 |
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
def get_state_id(pdb_id: str, auth_asym_id: str) -> Optional[str]:
|
| 205 |
"""Return state_id for a chain, or None if not found."""
|
| 206 |
row = get_node_row(pdb_id, auth_asym_id)
|
|
|
|
| 33 |
cur.execute(
|
| 34 |
'SELECT pdb_id, auth_asym_id, binding_status, sequence, sequence_length,'
|
| 35 |
' cath_id, cath_superfamily, Rosetta, FoldX, EvoEF2, RW, "RW+", ranked_functions,'
|
| 36 |
+
' state_id, experimental_method, pH, temp_K, chain_composition, matching_scores'
|
| 37 |
' FROM node'
|
| 38 |
)
|
| 39 |
for row in cur:
|
|
|
|
| 58 |
"pH": row["pH"] or "",
|
| 59 |
"temp_K": row["temp_K"] or "",
|
| 60 |
"chain_composition": row["chain_composition"] or "",
|
| 61 |
+
"matching_scores": row["matching_scores"] or "",
|
| 62 |
}
|
| 63 |
finally:
|
| 64 |
conn.close()
|
|
|
|
| 90 |
row = conn.execute(
|
| 91 |
'SELECT binding_status, sequence, sequence_length, cath_id, cath_superfamily,'
|
| 92 |
' Rosetta, FoldX, EvoEF2, RW, "RW+", ranked_functions,'
|
| 93 |
+
' state_id, experimental_method, pH, temp_K, chain_composition, matching_scores'
|
| 94 |
' FROM node WHERE LOWER(pdb_id) = ? AND UPPER(auth_asym_id) = ? LIMIT 1',
|
| 95 |
(pdb_id.lower(), auth_asym_id.upper()),
|
| 96 |
).fetchone()
|
|
|
|
| 202 |
return [f for f in _parse_functions(row["ranked_functions"]) if len(f) > 10]
|
| 203 |
|
| 204 |
|
| 205 |
+
def _parse_raw_list(raw: str) -> List[Any]:
|
| 206 |
+
"""Parse a stored list literal, preserving element positions (no filtering)."""
|
| 207 |
+
raw = str(raw).strip()
|
| 208 |
+
if not raw:
|
| 209 |
+
return []
|
| 210 |
+
try:
|
| 211 |
+
parsed = ast.literal_eval(raw)
|
| 212 |
+
if isinstance(parsed, list):
|
| 213 |
+
return parsed
|
| 214 |
+
except (ValueError, SyntaxError):
|
| 215 |
+
pass
|
| 216 |
+
return raw.split(";")
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
def get_functions_with_scores(pdb_id: str, auth_asym_id: str) -> Optional[List[Dict[str, Any]]]:
|
| 220 |
+
"""Return ranked functions paired with their matching scores (index-aligned)."""
|
| 221 |
+
row = get_node_row(pdb_id, auth_asym_id)
|
| 222 |
+
if row is None:
|
| 223 |
+
return None
|
| 224 |
+
funcs = _parse_raw_list(row.get("ranked_functions", ""))
|
| 225 |
+
scores = _parse_raw_list(row.get("matching_scores", ""))
|
| 226 |
+
result: List[Dict[str, Any]] = []
|
| 227 |
+
for i, f in enumerate(funcs):
|
| 228 |
+
name = str(f).strip()
|
| 229 |
+
if len(name) <= 10:
|
| 230 |
+
continue
|
| 231 |
+
score: Optional[float] = None
|
| 232 |
+
if i < len(scores):
|
| 233 |
+
try:
|
| 234 |
+
score = float(scores[i])
|
| 235 |
+
except (TypeError, ValueError):
|
| 236 |
+
score = None
|
| 237 |
+
result.append({"function": name, "matching_score": score})
|
| 238 |
+
return result
|
| 239 |
+
|
| 240 |
+
|
| 241 |
def get_state_id(pdb_id: str, auth_asym_id: str) -> Optional[str]:
|
| 242 |
"""Return state_id for a chain, or None if not found."""
|
| 243 |
row = get_node_row(pdb_id, auth_asym_id)
|
backend/scripts/generate_node_lookup.py
CHANGED
|
@@ -11,7 +11,7 @@ NODE_COLUMNS = (
|
|
| 11 |
"pdb_id", "auth_asym_id", "binding_status", "sequence", "sequence_length",
|
| 12 |
"cath_id", "cath_superfamily", "Rosetta", "FoldX", "EvoEF2", "RW", "RW+",
|
| 13 |
"ranked_functions", "state_id", "experimental_method", "pH", "temp_K",
|
| 14 |
-
"chain_composition",
|
| 15 |
)
|
| 16 |
|
| 17 |
|
|
@@ -32,7 +32,7 @@ def main() -> None:
|
|
| 32 |
'CREATE TABLE node (pdb_id, auth_asym_id, binding_status, sequence BLOB,'
|
| 33 |
' sequence_length, cath_id, cath_superfamily, Rosetta, FoldX, EvoEF2,'
|
| 34 |
' RW, "RW+", ranked_functions BLOB, state_id, experimental_method, pH, temp_K,'
|
| 35 |
-
' chain_composition)'
|
| 36 |
)
|
| 37 |
source = sqlite3.connect(f"file:{args.source.resolve()}?mode=ro", uri=True)
|
| 38 |
try:
|
|
@@ -42,7 +42,7 @@ def main() -> None:
|
|
| 42 |
batch = []
|
| 43 |
for row in rows:
|
| 44 |
row = list(row)
|
| 45 |
-
for index in (3, 12):
|
| 46 |
row[index] = zlib.compress((row[index] or "").encode("utf-8"), 1)
|
| 47 |
batch.append(row)
|
| 48 |
if len(batch) == 1000:
|
|
|
|
| 11 |
"pdb_id", "auth_asym_id", "binding_status", "sequence", "sequence_length",
|
| 12 |
"cath_id", "cath_superfamily", "Rosetta", "FoldX", "EvoEF2", "RW", "RW+",
|
| 13 |
"ranked_functions", "state_id", "experimental_method", "pH", "temp_K",
|
| 14 |
+
"chain_composition", "matching_scores",
|
| 15 |
)
|
| 16 |
|
| 17 |
|
|
|
|
| 32 |
'CREATE TABLE node (pdb_id, auth_asym_id, binding_status, sequence BLOB,'
|
| 33 |
' sequence_length, cath_id, cath_superfamily, Rosetta, FoldX, EvoEF2,'
|
| 34 |
' RW, "RW+", ranked_functions BLOB, state_id, experimental_method, pH, temp_K,'
|
| 35 |
+
' chain_composition, matching_scores BLOB)'
|
| 36 |
)
|
| 37 |
source = sqlite3.connect(f"file:{args.source.resolve()}?mode=ro", uri=True)
|
| 38 |
try:
|
|
|
|
| 42 |
batch = []
|
| 43 |
for row in rows:
|
| 44 |
row = list(row)
|
| 45 |
+
for index in (3, 12, 18): # sequence, ranked_functions, matching_scores
|
| 46 |
row[index] = zlib.compress((row[index] or "").encode("utf-8"), 1)
|
| 47 |
batch.append(row)
|
| 48 |
if len(batch) == 1000:
|
frontend/src/api/protein.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Connects to FastAPI backend (default: http://localhost:8000)
|
| 4 |
*/
|
| 5 |
import axios from 'axios';
|
| 6 |
-
import type { FilterParams, FilterOptions, DataResponse, SummaryStats, ChainMetadata } from '../types/protein';
|
| 7 |
|
| 8 |
// API base URL - uses Vite proxy in development
|
| 9 |
const API_BASE_URL = import.meta.env.VITE_PROTEIN_API_BASE || '/api';
|
|
@@ -110,8 +110,11 @@ export const proteinApi = {
|
|
| 110 |
/**
|
| 111 |
* Get ranked functional annotations for a chain from local TSV
|
| 112 |
*/
|
| 113 |
-
async getChainFunctions(
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
| 115 |
params: { pdb_id, auth_asym_id },
|
| 116 |
});
|
| 117 |
return response.data.functions;
|
|
|
|
| 3 |
* Connects to FastAPI backend (default: http://localhost:8000)
|
| 4 |
*/
|
| 5 |
import axios from 'axios';
|
| 6 |
+
import type { FilterParams, FilterOptions, DataResponse, SummaryStats, ChainMetadata, RankedFunction } from '../types/protein';
|
| 7 |
|
| 8 |
// API base URL - uses Vite proxy in development
|
| 9 |
const API_BASE_URL = import.meta.env.VITE_PROTEIN_API_BASE || '/api';
|
|
|
|
| 110 |
/**
|
| 111 |
* Get ranked functional annotations for a chain from local TSV
|
| 112 |
*/
|
| 113 |
+
async getChainFunctions(
|
| 114 |
+
pdb_id: string,
|
| 115 |
+
auth_asym_id: string,
|
| 116 |
+
): Promise<RankedFunction[]> {
|
| 117 |
+
const response = await api.get<{ functions: RankedFunction[] }>('/protein/chain/functions', {
|
| 118 |
params: { pdb_id, auth_asym_id },
|
| 119 |
});
|
| 120 |
return response.data.functions;
|
frontend/src/components/datasets/protein/ChainBasicInfoCards.tsx
CHANGED
|
@@ -107,6 +107,11 @@ const ChainBasicInfoCards: React.FC<ChainBasicInfoCardsProps> = ({ metadata, isL
|
|
| 107 |
<div className="text-sm font-semibold text-slate-900 capitalize">{metadata?.binding_status || '—'}</div>
|
| 108 |
</div>
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
<div className="break-inside-avoid mb-3" style={{ breakInside: 'avoid' }}>
|
| 111 |
<div className="text-xs font-medium text-slate-500 uppercase tracking-wider mb-1">CATH ID</div>
|
| 112 |
<div className="text-sm font-semibold text-slate-900 font-mono">{metadata?.cath_id || 'uncategorized'}</div>
|
|
|
|
| 107 |
<div className="text-sm font-semibold text-slate-900 capitalize">{metadata?.binding_status || '—'}</div>
|
| 108 |
</div>
|
| 109 |
|
| 110 |
+
<div className="break-inside-avoid mb-3" style={{ breakInside: 'avoid' }}>
|
| 111 |
+
<div className="text-xs font-medium text-slate-500 uppercase tracking-wider mb-1">Chain Composition</div>
|
| 112 |
+
<div className="text-sm font-semibold text-slate-900 capitalize">{metadata?.chain_composition || '—'}</div>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
<div className="break-inside-avoid mb-3" style={{ breakInside: 'avoid' }}>
|
| 116 |
<div className="text-xs font-medium text-slate-500 uppercase tracking-wider mb-1">CATH ID</div>
|
| 117 |
<div className="text-sm font-semibold text-slate-900 font-mono">{metadata?.cath_id || 'uncategorized'}</div>
|
frontend/src/components/datasets/protein/DataTable.tsx
CHANGED
|
@@ -1,203 +1,214 @@
|
|
| 1 |
-
import React, { useState } from 'react';
|
| 2 |
-
import type { DataRecord } from '../../../types/protein';
|
| 3 |
-
import { formatTemperature, formatPH } from '../../../utils/format';
|
| 4 |
-
import './DataTable.css';
|
| 5 |
-
|
| 6 |
-
interface DataTableProps {
|
| 7 |
-
data: DataRecord[];
|
| 8 |
-
loading: boolean;
|
| 9 |
-
total: number;
|
| 10 |
-
filtered: number;
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
type SortField = keyof DataRecord;
|
| 14 |
-
type SortDirection = 'asc' | 'desc';
|
| 15 |
-
|
| 16 |
-
export const DataTable: React.FC<DataTableProps> = ({ data, loading, total, filtered }) => {
|
| 17 |
-
const [sortField, setSortField] = useState<SortField>('rmsd');
|
| 18 |
-
const [sortDirection, setSortDirection] = useState<SortDirection>('asc');
|
| 19 |
-
const [currentPage, setCurrentPage] = useState(1);
|
| 20 |
-
const itemsPerPage = 50;
|
| 21 |
-
|
| 22 |
-
if (loading) {
|
| 23 |
-
return <div className="table-loading">Loading data...</div>;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
if (data.length === 0) {
|
| 27 |
-
return <div className="table-empty">No data to display. Adjust filters to see results.</div>;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
// Sorting
|
| 31 |
-
const sortedData = [...data].sort((a, b) => {
|
| 32 |
-
const aValue = a[sortField];
|
| 33 |
-
const bValue = b[sortField];
|
| 34 |
-
|
| 35 |
-
if (typeof aValue === 'number' && typeof bValue === 'number') {
|
| 36 |
-
return sortDirection === 'asc' ? aValue - bValue : bValue - aValue;
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
if (typeof aValue === 'string' && typeof bValue === 'string') {
|
| 40 |
-
return sortDirection === 'asc'
|
| 41 |
-
? aValue.localeCompare(bValue)
|
| 42 |
-
: bValue.localeCompare(aValue);
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
return 0;
|
| 46 |
-
});
|
| 47 |
-
|
| 48 |
-
// Pagination
|
| 49 |
-
const totalPages = Math.ceil(sortedData.length / itemsPerPage);
|
| 50 |
-
const startIndex = (currentPage - 1) * itemsPerPage;
|
| 51 |
-
const endIndex = startIndex + itemsPerPage;
|
| 52 |
-
const paginatedData = sortedData.slice(startIndex, endIndex);
|
| 53 |
-
|
| 54 |
-
const handleSort = (field: SortField) => {
|
| 55 |
-
if (sortField === field) {
|
| 56 |
-
setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc');
|
| 57 |
-
} else {
|
| 58 |
-
setSortField(field);
|
| 59 |
-
setSortDirection('asc');
|
| 60 |
-
}
|
| 61 |
-
setCurrentPage(1);
|
| 62 |
-
};
|
| 63 |
-
|
| 64 |
-
const getSortIcon = (field: SortField) => {
|
| 65 |
-
if (sortField !== field) return '↕';
|
| 66 |
-
return sortDirection === 'asc' ? '↑' : '↓';
|
| 67 |
-
};
|
| 68 |
-
|
| 69 |
-
return (
|
| 70 |
-
<div className="data-table-container">
|
| 71 |
-
<div className="table-header">
|
| 72 |
-
<h3 className="text-xl font-semibold text-slate-900">Alternative observations</h3>
|
| 73 |
-
<div className="table-stats">
|
| 74 |
-
<span>Showing {paginatedData.length} of {filtered.toLocaleString()} filtered</span>
|
| 75 |
-
<span className="separator">|</span>
|
| 76 |
-
<span>Total: {total.toLocaleString()}</span>
|
| 77 |
-
</div>
|
| 78 |
-
</div>
|
| 79 |
-
|
| 80 |
-
<div className="table-wrapper">
|
| 81 |
-
<table className="data-table">
|
| 82 |
-
<thead>
|
| 83 |
-
<tr>
|
| 84 |
-
<th onClick={() => handleSort('pdb_id_b')}>
|
| 85 |
-
PDB ID {getSortIcon('pdb_id_b')}
|
| 86 |
-
</th>
|
| 87 |
-
<th onClick={() => handleSort('auth_asym_id_b')}>
|
| 88 |
-
Chain ID {getSortIcon('auth_asym_id_b')}
|
| 89 |
-
</th>
|
| 90 |
-
<th onClick={() => handleSort('tm_score')}>
|
| 91 |
-
TM-score {getSortIcon('tm_score')}
|
| 92 |
-
</th>
|
| 93 |
-
<th onClick={() => handleSort('rmsd')}>
|
| 94 |
-
RMSD (Å) {getSortIcon('rmsd')}
|
| 95 |
-
</th>
|
| 96 |
-
<th>
|
| 97 |
-
Experimental Method
|
| 98 |
-
</th>
|
| 99 |
-
<th>
|
| 100 |
-
Temp (K)
|
| 101 |
-
</th>
|
| 102 |
-
<th>
|
| 103 |
-
pH
|
| 104 |
-
</th>
|
| 105 |
-
<th onClick={() => handleSort('binding_status')}>
|
| 106 |
-
Binding status {getSortIcon('binding_status')}
|
| 107 |
-
</th>
|
| 108 |
-
<th onClick={() => handleSort('
|
| 109 |
-
|
| 110 |
-
</th>
|
| 111 |
-
<th onClick={() => handleSort('
|
| 112 |
-
Δ
|
| 113 |
-
</th>
|
| 114 |
-
<th onClick={() => handleSort('
|
| 115 |
-
Δ
|
| 116 |
-
</th>
|
| 117 |
-
<th onClick={() => handleSort('
|
| 118 |
-
Δ
|
| 119 |
-
</th>
|
| 120 |
-
<th onClick={() => handleSort('
|
| 121 |
-
ΔRW
|
| 122 |
-
</th>
|
| 123 |
-
<th onClick={() => handleSort('
|
| 124 |
-
|
| 125 |
-
</th>
|
| 126 |
-
<th onClick={() => handleSort('
|
| 127 |
-
State
|
| 128 |
-
</th>
|
| 129 |
-
<th onClick={() => handleSort('
|
| 130 |
-
State
|
| 131 |
-
</th>
|
| 132 |
-
<th onClick={() => handleSort('
|
| 133 |
-
|
| 134 |
-
</th>
|
| 135 |
-
<th onClick={() => handleSort('
|
| 136 |
-
Observation
|
| 137 |
-
</th>
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
<td>
|
| 147 |
-
<span className="
|
| 148 |
-
</td>
|
| 149 |
-
<td
|
| 150 |
-
|
| 151 |
-
<td
|
| 152 |
-
|
| 153 |
-
</td>
|
| 154 |
-
<td className="
|
| 155 |
-
{
|
| 156 |
-
</td>
|
| 157 |
-
<td className="numeric">
|
| 158 |
-
{
|
| 159 |
-
</td>
|
| 160 |
-
<td className="
|
| 161 |
-
{record.
|
| 162 |
-
</td>
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
</
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import type { DataRecord } from '../../../types/protein';
|
| 3 |
+
import { formatTemperature, formatPH } from '../../../utils/format';
|
| 4 |
+
import './DataTable.css';
|
| 5 |
+
|
| 6 |
+
interface DataTableProps {
|
| 7 |
+
data: DataRecord[];
|
| 8 |
+
loading: boolean;
|
| 9 |
+
total: number;
|
| 10 |
+
filtered: number;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
type SortField = keyof DataRecord;
|
| 14 |
+
type SortDirection = 'asc' | 'desc';
|
| 15 |
+
|
| 16 |
+
export const DataTable: React.FC<DataTableProps> = ({ data, loading, total, filtered }) => {
|
| 17 |
+
const [sortField, setSortField] = useState<SortField>('rmsd');
|
| 18 |
+
const [sortDirection, setSortDirection] = useState<SortDirection>('asc');
|
| 19 |
+
const [currentPage, setCurrentPage] = useState(1);
|
| 20 |
+
const itemsPerPage = 50;
|
| 21 |
+
|
| 22 |
+
if (loading) {
|
| 23 |
+
return <div className="table-loading">Loading data...</div>;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if (data.length === 0) {
|
| 27 |
+
return <div className="table-empty">No data to display. Adjust filters to see results.</div>;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// Sorting
|
| 31 |
+
const sortedData = [...data].sort((a, b) => {
|
| 32 |
+
const aValue = a[sortField];
|
| 33 |
+
const bValue = b[sortField];
|
| 34 |
+
|
| 35 |
+
if (typeof aValue === 'number' && typeof bValue === 'number') {
|
| 36 |
+
return sortDirection === 'asc' ? aValue - bValue : bValue - aValue;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if (typeof aValue === 'string' && typeof bValue === 'string') {
|
| 40 |
+
return sortDirection === 'asc'
|
| 41 |
+
? aValue.localeCompare(bValue)
|
| 42 |
+
: bValue.localeCompare(aValue);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return 0;
|
| 46 |
+
});
|
| 47 |
+
|
| 48 |
+
// Pagination
|
| 49 |
+
const totalPages = Math.ceil(sortedData.length / itemsPerPage);
|
| 50 |
+
const startIndex = (currentPage - 1) * itemsPerPage;
|
| 51 |
+
const endIndex = startIndex + itemsPerPage;
|
| 52 |
+
const paginatedData = sortedData.slice(startIndex, endIndex);
|
| 53 |
+
|
| 54 |
+
const handleSort = (field: SortField) => {
|
| 55 |
+
if (sortField === field) {
|
| 56 |
+
setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc');
|
| 57 |
+
} else {
|
| 58 |
+
setSortField(field);
|
| 59 |
+
setSortDirection('asc');
|
| 60 |
+
}
|
| 61 |
+
setCurrentPage(1);
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
const getSortIcon = (field: SortField) => {
|
| 65 |
+
if (sortField !== field) return '↕';
|
| 66 |
+
return sortDirection === 'asc' ? '↑' : '↓';
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
return (
|
| 70 |
+
<div className="data-table-container">
|
| 71 |
+
<div className="table-header">
|
| 72 |
+
<h3 className="text-xl font-semibold text-slate-900">Alternative observations</h3>
|
| 73 |
+
<div className="table-stats">
|
| 74 |
+
<span>Showing {paginatedData.length} of {filtered.toLocaleString()} filtered</span>
|
| 75 |
+
<span className="separator">|</span>
|
| 76 |
+
<span>Total: {total.toLocaleString()}</span>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
<div className="table-wrapper">
|
| 81 |
+
<table className="data-table">
|
| 82 |
+
<thead>
|
| 83 |
+
<tr>
|
| 84 |
+
<th onClick={() => handleSort('pdb_id_b')}>
|
| 85 |
+
PDB ID {getSortIcon('pdb_id_b')}
|
| 86 |
+
</th>
|
| 87 |
+
<th onClick={() => handleSort('auth_asym_id_b')}>
|
| 88 |
+
Chain ID {getSortIcon('auth_asym_id_b')}
|
| 89 |
+
</th>
|
| 90 |
+
<th onClick={() => handleSort('tm_score')}>
|
| 91 |
+
TM-score {getSortIcon('tm_score')}
|
| 92 |
+
</th>
|
| 93 |
+
<th onClick={() => handleSort('rmsd')}>
|
| 94 |
+
RMSD (Å) {getSortIcon('rmsd')}
|
| 95 |
+
</th>
|
| 96 |
+
<th>
|
| 97 |
+
Experimental Method
|
| 98 |
+
</th>
|
| 99 |
+
<th>
|
| 100 |
+
Temp (K)
|
| 101 |
+
</th>
|
| 102 |
+
<th>
|
| 103 |
+
pH
|
| 104 |
+
</th>
|
| 105 |
+
<th onClick={() => handleSort('binding_status')}>
|
| 106 |
+
Binding status {getSortIcon('binding_status')}
|
| 107 |
+
</th>
|
| 108 |
+
<th onClick={() => handleSort('chain_composition')}>
|
| 109 |
+
Chain composition {getSortIcon('chain_composition')}
|
| 110 |
+
</th>
|
| 111 |
+
<th onClick={() => handleSort('delta_rosetta')}>
|
| 112 |
+
ΔRosetta {getSortIcon('delta_rosetta')}
|
| 113 |
+
</th>
|
| 114 |
+
<th onClick={() => handleSort('delta_foldx')}>
|
| 115 |
+
ΔFoldX {getSortIcon('delta_foldx')}
|
| 116 |
+
</th>
|
| 117 |
+
<th onClick={() => handleSort('delta_evoef2')}>
|
| 118 |
+
ΔEvoEF2 {getSortIcon('delta_evoef2')}
|
| 119 |
+
</th>
|
| 120 |
+
<th onClick={() => handleSort('delta_rw')}>
|
| 121 |
+
ΔRW {getSortIcon('delta_rw')}
|
| 122 |
+
</th>
|
| 123 |
+
<th onClick={() => handleSort('delta_rw_plus')}>
|
| 124 |
+
ΔRW+ {getSortIcon('delta_rw_plus')}
|
| 125 |
+
</th>
|
| 126 |
+
<th onClick={() => handleSort('state_id_b')}>
|
| 127 |
+
State ID {getSortIcon('state_id_b')}
|
| 128 |
+
</th>
|
| 129 |
+
<th onClick={() => handleSort('state_fidelity')}>
|
| 130 |
+
State fidelity {getSortIcon('state_fidelity')}
|
| 131 |
+
</th>
|
| 132 |
+
<th onClick={() => handleSort('avg_sim')}>
|
| 133 |
+
State avg. similarity {getSortIcon('avg_sim')}
|
| 134 |
+
</th>
|
| 135 |
+
<th onClick={() => handleSort('observation_fidelity')}>
|
| 136 |
+
Observation fidelity {getSortIcon('observation_fidelity')}
|
| 137 |
+
</th>
|
| 138 |
+
<th onClick={() => handleSort('structure_sim')}>
|
| 139 |
+
Observation similarity {getSortIcon('structure_sim')}
|
| 140 |
+
</th>
|
| 141 |
+
</tr>
|
| 142 |
+
</thead>
|
| 143 |
+
<tbody>
|
| 144 |
+
{paginatedData.map((record, index) => (
|
| 145 |
+
<tr key={`${record.pdb_id_a}-${record.auth_asym_id_a}-${record.pdb_id_b}-${record.auth_asym_id_b}-${index}`}>
|
| 146 |
+
<td>
|
| 147 |
+
<span className="chain-id">{record.pdb_id_b.toUpperCase()}</span>
|
| 148 |
+
</td>
|
| 149 |
+
<td>
|
| 150 |
+
<span className="asym-id">{record.auth_asym_id_b}</span>
|
| 151 |
+
</td>
|
| 152 |
+
<td className="numeric">{record.tm_score.toFixed(3)}</td>
|
| 153 |
+
<td className="numeric">{record.rmsd.toFixed(2)}</td>
|
| 154 |
+
<td className="experimental-method">
|
| 155 |
+
{record.exptl_method || <span className="placeholder">—</span>}
|
| 156 |
+
</td>
|
| 157 |
+
<td className="numeric">
|
| 158 |
+
{formatTemperature(record.temp)}
|
| 159 |
+
</td>
|
| 160 |
+
<td className="numeric">
|
| 161 |
+
{formatPH(record.pH)}
|
| 162 |
+
</td>
|
| 163 |
+
<td className="capitalize">
|
| 164 |
+
{record.binding_status || <span className="placeholder">—</span>}
|
| 165 |
+
</td>
|
| 166 |
+
<td className="capitalize">
|
| 167 |
+
{record.chain_composition || <span className="placeholder">—</span>}
|
| 168 |
+
</td>
|
| 169 |
+
{(['delta_rosetta', 'delta_foldx', 'delta_evoef2', 'delta_rw', 'delta_rw_plus'] as const).map(field => {
|
| 170 |
+
const val = record[field];
|
| 171 |
+
return (
|
| 172 |
+
<td key={field} className={`numeric delta-cell${val == null ? '' : val > 0 ? ' delta-pos' : val < 0 ? ' delta-neg' : ''}`}>
|
| 173 |
+
{val == null ? <span className="placeholder">—</span> : `${val > 0 ? '+' : ''}${val.toFixed(2)}`}
|
| 174 |
+
</td>
|
| 175 |
+
);
|
| 176 |
+
})}
|
| 177 |
+
<td className="font-mono">{record.state_id_b ?? <span className="placeholder">—</span>}</td>
|
| 178 |
+
<td>{record.state_fidelity ?? <span className="placeholder">—</span>}</td>
|
| 179 |
+
<td className="numeric">
|
| 180 |
+
{(() => {
|
| 181 |
+
const n = record.avg_sim != null && record.avg_sim !== '' ? Number(record.avg_sim) : NaN;
|
| 182 |
+
return Number.isFinite(n) ? n.toFixed(3) : (record.avg_sim || <span className="placeholder">—</span>);
|
| 183 |
+
})()}
|
| 184 |
+
</td>
|
| 185 |
+
<td>{record.observation_fidelity ?? <span className="placeholder">—</span>}</td>
|
| 186 |
+
<td className="numeric">{record.structure_sim != null ? record.structure_sim.toFixed(3) : <span className="placeholder">—</span>}</td>
|
| 187 |
+
</tr>
|
| 188 |
+
))}
|
| 189 |
+
</tbody>
|
| 190 |
+
</table>
|
| 191 |
+
</div>
|
| 192 |
+
|
| 193 |
+
{totalPages > 1 && (
|
| 194 |
+
<div className="pagination">
|
| 195 |
+
<button
|
| 196 |
+
onClick={() => setCurrentPage(Math.max(1, currentPage - 1))}
|
| 197 |
+
disabled={currentPage === 1}
|
| 198 |
+
>
|
| 199 |
+
Previous
|
| 200 |
+
</button>
|
| 201 |
+
<span className="page-info">
|
| 202 |
+
Page {currentPage} of {totalPages}
|
| 203 |
+
</span>
|
| 204 |
+
<button
|
| 205 |
+
onClick={() => setCurrentPage(Math.min(totalPages, currentPage + 1))}
|
| 206 |
+
disabled={currentPage === totalPages}
|
| 207 |
+
>
|
| 208 |
+
Next
|
| 209 |
+
</button>
|
| 210 |
+
</div>
|
| 211 |
+
)}
|
| 212 |
+
</div>
|
| 213 |
+
);
|
| 214 |
+
};
|
frontend/src/components/datasets/protein/FunctionPanel.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import React, { useEffect, useState } from 'react';
|
| 2 |
import { proteinApi } from '../../../api/protein';
|
|
|
|
| 3 |
|
| 4 |
interface FunctionPanelProps {
|
| 5 |
pdbId: string;
|
|
@@ -7,7 +8,7 @@ interface FunctionPanelProps {
|
|
| 7 |
}
|
| 8 |
|
| 9 |
const FunctionPanel: React.FC<FunctionPanelProps> = ({ pdbId, chainId }) => {
|
| 10 |
-
const [functions, setFunctions] = useState<
|
| 11 |
const [loading, setLoading] = useState(true);
|
| 12 |
const [notFound, setNotFound] = useState(false);
|
| 13 |
|
|
@@ -37,6 +38,15 @@ const FunctionPanel: React.FC<FunctionPanelProps> = ({ pdbId, chainId }) => {
|
|
| 37 |
)}
|
| 38 |
</div>
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
{/* Scrollable body */}
|
| 41 |
<div className="px-6 py-4" style={{ overflowY: 'auto', overflowX: 'hidden', maxHeight: '14rem' }}>
|
| 42 |
{loading && (
|
|
@@ -50,11 +60,14 @@ const FunctionPanel: React.FC<FunctionPanelProps> = ({ pdbId, chainId }) => {
|
|
| 50 |
{!loading && functions && functions.length > 0 && (
|
| 51 |
<ol className="space-y-3">
|
| 52 |
{functions.map((fn, idx) => (
|
| 53 |
-
<li key={idx} className="flex gap-3 text-sm text-slate-700" style={{ minWidth: 0 }}>
|
| 54 |
<span className="shrink-0 mt-0.5 w-5 h-5 rounded-full bg-slate-100 text-slate-500 text-[10px] font-semibold flex items-center justify-center">
|
| 55 |
{idx + 1}
|
| 56 |
</span>
|
| 57 |
-
<span style={{ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{fn}</span>
|
|
|
|
|
|
|
|
|
|
| 58 |
</li>
|
| 59 |
))}
|
| 60 |
</ol>
|
|
|
|
| 1 |
import React, { useEffect, useState } from 'react';
|
| 2 |
import { proteinApi } from '../../../api/protein';
|
| 3 |
+
import type { RankedFunction } from '../../../types/protein';
|
| 4 |
|
| 5 |
interface FunctionPanelProps {
|
| 6 |
pdbId: string;
|
|
|
|
| 8 |
}
|
| 9 |
|
| 10 |
const FunctionPanel: React.FC<FunctionPanelProps> = ({ pdbId, chainId }) => {
|
| 11 |
+
const [functions, setFunctions] = useState<RankedFunction[] | null>(null);
|
| 12 |
const [loading, setLoading] = useState(true);
|
| 13 |
const [notFound, setNotFound] = useState(false);
|
| 14 |
|
|
|
|
| 38 |
)}
|
| 39 |
</div>
|
| 40 |
|
| 41 |
+
{/* Column header */}
|
| 42 |
+
{!loading && functions && functions.length > 0 && (
|
| 43 |
+
<div className="flex items-center gap-3 px-6 pt-3 text-[11px] font-semibold uppercase tracking-wider text-slate-400">
|
| 44 |
+
<span className="shrink-0 w-5" />
|
| 45 |
+
<span style={{ flex: 1, minWidth: 0 }}>Function</span>
|
| 46 |
+
<span className="shrink-0 w-20 text-right">Matching score</span>
|
| 47 |
+
</div>
|
| 48 |
+
)}
|
| 49 |
+
|
| 50 |
{/* Scrollable body */}
|
| 51 |
<div className="px-6 py-4" style={{ overflowY: 'auto', overflowX: 'hidden', maxHeight: '14rem' }}>
|
| 52 |
{loading && (
|
|
|
|
| 60 |
{!loading && functions && functions.length > 0 && (
|
| 61 |
<ol className="space-y-3">
|
| 62 |
{functions.map((fn, idx) => (
|
| 63 |
+
<li key={idx} className="flex items-start gap-3 text-sm text-slate-700" style={{ minWidth: 0 }}>
|
| 64 |
<span className="shrink-0 mt-0.5 w-5 h-5 rounded-full bg-slate-100 text-slate-500 text-[10px] font-semibold flex items-center justify-center">
|
| 65 |
{idx + 1}
|
| 66 |
</span>
|
| 67 |
+
<span style={{ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }} title={fn.function}>{fn.function}</span>
|
| 68 |
+
<span className="shrink-0 w-20 text-right font-mono text-slate-500">
|
| 69 |
+
{fn.matching_score != null ? fn.matching_score.toFixed(3) : '—'}
|
| 70 |
+
</span>
|
| 71 |
</li>
|
| 72 |
))}
|
| 73 |
</ol>
|
frontend/src/types/protein.ts
CHANGED
|
@@ -1,121 +1,126 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* Type definitions for Multi-state Protein Database API models
|
| 3 |
-
*/
|
| 4 |
-
|
| 5 |
-
export interface FilterParams {
|
| 6 |
-
pdb_id?: string;
|
| 7 |
-
auth_asym_id?: string;
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
export interface FilterOptions {
|
| 11 |
-
chain_ids: string[];
|
| 12 |
-
total_records: number;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
export interface CrystalGrow {
|
| 16 |
-
pH?: number | string | null;
|
| 17 |
-
pH_structured?: number | string | null;
|
| 18 |
-
pH_from_details?: number | string | null;
|
| 19 |
-
temp?: number | string | null;
|
| 20 |
-
pdbx_details?: string | null;
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
export interface EntryInfo {
|
| 24 |
-
rcsb_id?: string | null;
|
| 25 |
-
title?: string | null;
|
| 26 |
-
initial_release_date?: string | null;
|
| 27 |
-
exptl_method?: string | null;
|
| 28 |
-
resolution_combined?: number | number[] | null;
|
| 29 |
-
crystal_grow?: CrystalGrow | null;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
export interface PolymerEntity {
|
| 33 |
-
rcsb_id?: string | null;
|
| 34 |
-
entity_id?: string | null;
|
| 35 |
-
sequence_length?: number | null;
|
| 36 |
-
seq_can?: string | null;
|
| 37 |
-
reference_sequences?: Array<{
|
| 38 |
-
database_name?: string | null;
|
| 39 |
-
database_accession?: string | null;
|
| 40 |
-
}> | null;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
export interface PolymerEntityInstance {
|
| 44 |
-
rcsb_id?: string | null;
|
| 45 |
-
asym_id?: string | null;
|
| 46 |
-
auth_asym_id?: string | null;
|
| 47 |
-
binding_affinity?: any;
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
export interface NonpolymerEntity {
|
| 51 |
-
rcsb_id?: string | null;
|
| 52 |
-
name?: string | null;
|
| 53 |
-
formula_weight?: number | null;
|
| 54 |
-
smiles?: string | null;
|
| 55 |
-
inchi?: string | null;
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
export interface ChainMetadata {
|
| 59 |
-
pdb_id: string;
|
| 60 |
-
chain_id: string;
|
| 61 |
-
entry?: EntryInfo | null;
|
| 62 |
-
polymer_entity?: PolymerEntity | null;
|
| 63 |
-
polymer_entity_instance?: PolymerEntityInstance | null;
|
| 64 |
-
nonpolymer_entities?: NonpolymerEntity[] | null;
|
| 65 |
-
binding_status?: string | null;
|
| 66 |
-
chain_composition?: string | null;
|
| 67 |
-
cath_id?: string | null;
|
| 68 |
-
cath_superfamily?: string | null;
|
| 69 |
-
state_id?: string | null;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
export interface DataRecord {
|
| 73 |
-
pdb_id_a: string;
|
| 74 |
-
auth_asym_id_a: string;
|
| 75 |
-
pdb_id_b: string;
|
| 76 |
-
auth_asym_id_b: string;
|
| 77 |
-
tm_score: number;
|
| 78 |
-
rmsd: number;
|
| 79 |
-
sequence_identity: number;
|
| 80 |
-
length_a: number;
|
| 81 |
-
length_b: number;
|
| 82 |
-
aligned_length: number;
|
| 83 |
-
status: string;
|
| 84 |
-
cluster_id?: string;
|
| 85 |
-
// Enriched metadata fields (nullable from RCSB API)
|
| 86 |
-
exptl_method?: string | null;
|
| 87 |
-
temp?: number | string | null;
|
| 88 |
-
pH?: number | string | null;
|
| 89 |
-
// Matched-chain (B) node annotations
|
| 90 |
-
binding_status?: string | null;
|
| 91 |
-
chain_composition?: string | null;
|
| 92 |
-
// Energy score deltas (searched chain - matched chain)
|
| 93 |
-
delta_rosetta?: number | null;
|
| 94 |
-
delta_foldx?: number | null;
|
| 95 |
-
delta_evoef2?: number | null;
|
| 96 |
-
delta_rw?: number | null;
|
| 97 |
-
delta_rw_plus?: number | null;
|
| 98 |
-
structure_sim?: number | null;
|
| 99 |
-
// Alternative state similarity fields from edge table
|
| 100 |
-
state_id_b?: string | null;
|
| 101 |
-
state_fidelity?: string | null;
|
| 102 |
-
avg_sim?: string | null;
|
| 103 |
-
observation_fidelity?: string | null;
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
export interface
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Type definitions for Multi-state Protein Database API models
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
export interface FilterParams {
|
| 6 |
+
pdb_id?: string;
|
| 7 |
+
auth_asym_id?: string;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
export interface FilterOptions {
|
| 11 |
+
chain_ids: string[];
|
| 12 |
+
total_records: number;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export interface CrystalGrow {
|
| 16 |
+
pH?: number | string | null;
|
| 17 |
+
pH_structured?: number | string | null;
|
| 18 |
+
pH_from_details?: number | string | null;
|
| 19 |
+
temp?: number | string | null;
|
| 20 |
+
pdbx_details?: string | null;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
export interface EntryInfo {
|
| 24 |
+
rcsb_id?: string | null;
|
| 25 |
+
title?: string | null;
|
| 26 |
+
initial_release_date?: string | null;
|
| 27 |
+
exptl_method?: string | null;
|
| 28 |
+
resolution_combined?: number | number[] | null;
|
| 29 |
+
crystal_grow?: CrystalGrow | null;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
export interface PolymerEntity {
|
| 33 |
+
rcsb_id?: string | null;
|
| 34 |
+
entity_id?: string | null;
|
| 35 |
+
sequence_length?: number | null;
|
| 36 |
+
seq_can?: string | null;
|
| 37 |
+
reference_sequences?: Array<{
|
| 38 |
+
database_name?: string | null;
|
| 39 |
+
database_accession?: string | null;
|
| 40 |
+
}> | null;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
export interface PolymerEntityInstance {
|
| 44 |
+
rcsb_id?: string | null;
|
| 45 |
+
asym_id?: string | null;
|
| 46 |
+
auth_asym_id?: string | null;
|
| 47 |
+
binding_affinity?: any;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
export interface NonpolymerEntity {
|
| 51 |
+
rcsb_id?: string | null;
|
| 52 |
+
name?: string | null;
|
| 53 |
+
formula_weight?: number | null;
|
| 54 |
+
smiles?: string | null;
|
| 55 |
+
inchi?: string | null;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
export interface ChainMetadata {
|
| 59 |
+
pdb_id: string;
|
| 60 |
+
chain_id: string;
|
| 61 |
+
entry?: EntryInfo | null;
|
| 62 |
+
polymer_entity?: PolymerEntity | null;
|
| 63 |
+
polymer_entity_instance?: PolymerEntityInstance | null;
|
| 64 |
+
nonpolymer_entities?: NonpolymerEntity[] | null;
|
| 65 |
+
binding_status?: string | null;
|
| 66 |
+
chain_composition?: string | null;
|
| 67 |
+
cath_id?: string | null;
|
| 68 |
+
cath_superfamily?: string | null;
|
| 69 |
+
state_id?: string | null;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
export interface DataRecord {
|
| 73 |
+
pdb_id_a: string;
|
| 74 |
+
auth_asym_id_a: string;
|
| 75 |
+
pdb_id_b: string;
|
| 76 |
+
auth_asym_id_b: string;
|
| 77 |
+
tm_score: number;
|
| 78 |
+
rmsd: number;
|
| 79 |
+
sequence_identity: number;
|
| 80 |
+
length_a: number;
|
| 81 |
+
length_b: number;
|
| 82 |
+
aligned_length: number;
|
| 83 |
+
status: string;
|
| 84 |
+
cluster_id?: string;
|
| 85 |
+
// Enriched metadata fields (nullable from RCSB API)
|
| 86 |
+
exptl_method?: string | null;
|
| 87 |
+
temp?: number | string | null;
|
| 88 |
+
pH?: number | string | null;
|
| 89 |
+
// Matched-chain (B) node annotations
|
| 90 |
+
binding_status?: string | null;
|
| 91 |
+
chain_composition?: string | null;
|
| 92 |
+
// Energy score deltas (searched chain - matched chain)
|
| 93 |
+
delta_rosetta?: number | null;
|
| 94 |
+
delta_foldx?: number | null;
|
| 95 |
+
delta_evoef2?: number | null;
|
| 96 |
+
delta_rw?: number | null;
|
| 97 |
+
delta_rw_plus?: number | null;
|
| 98 |
+
structure_sim?: number | null;
|
| 99 |
+
// Alternative state similarity fields from edge table
|
| 100 |
+
state_id_b?: string | null;
|
| 101 |
+
state_fidelity?: string | null;
|
| 102 |
+
avg_sim?: string | null;
|
| 103 |
+
observation_fidelity?: string | null;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
export interface RankedFunction {
|
| 107 |
+
function: string;
|
| 108 |
+
matching_score: number | null;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
export interface DataResponse {
|
| 112 |
+
data: DataRecord[];
|
| 113 |
+
total: number;
|
| 114 |
+
filtered: number;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
export interface SummaryStats {
|
| 118 |
+
total_records: number;
|
| 119 |
+
unique_chains: number;
|
| 120 |
+
avg_rmsd: number;
|
| 121 |
+
avg_tm_score: number;
|
| 122 |
+
avg_sequence_length: number;
|
| 123 |
+
rmsd_distribution: Record<string, number>;
|
| 124 |
+
tm_score_distribution: Record<string, number>;
|
| 125 |
+
length_distribution: Record<string, number>;
|
| 126 |
+
}
|