File size: 3,698 Bytes
fd820af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Display metadata for the Bioactivity Screening tab: source-database links and
// the canonical activity-class vocabulary (for the filter + proper labels).

export interface DbInfo {
  label: string
  url: string
}

// Source databases (peptide bioactivity/cytotoxicity). Keyed by the lowercase slug
// the screener emits; labels use each DB's own capitalisation, urls point at the DB home.
export const SOURCE_DBS: Record<string, DbInfo> = {
  ahtpdb: { label: 'AHTPDB', url: 'https://webs.iiitd.edu.in/raghava/ahtpdb/' },
  apd3: { label: 'APD3', url: 'https://aps.unmc.edu/' },
  biopep_uwm_typed: { label: 'BIOPEP-UWM', url: 'https://biochemia.uwm.edu.pl/biopep-uwm/' },
  biopepdb: { label: 'BioPepDB', url: 'https://bis.zju.edu.cn/biopepdbr/' },
  dbaasp: { label: 'DBAASP', url: 'https://dbaasp.org/' },
  dbamp: { label: 'dbAMP', url: 'https://awi.cuhk.edu.cn/dbAMP/' },
  dfbp: { label: 'DFBP', url: 'http://www.cqudfbp.net/' },
  dramp: { label: 'DRAMP', url: 'https://dramp.cpu-bioinfor.org/' },
  fermfoodb: { label: 'FermFooDb', url: 'https://webs.iiitd.edu.in/raghava/fermfoodb/' },
  plantpepdb: { label: 'PlantPepDB', url: 'http://14.139.61.8/PlantPepDB/' },
  toxinpred2: { label: 'ToxinPred', url: 'https://webs.iiitd.edu.in/raghava/toxinpred2/' },
  iedb: { label: 'IEDB', url: 'https://www.iedb.org/' },
}

// Allergen-protein sources (protein tab). The screener emits combos like "AllergenOnline | WHO/IUIS".
export const ALLERGEN_SOURCES: Record<string, DbInfo> = {
  allergenonline: { label: 'AllergenOnline', url: 'http://www.allergenonline.org/' },
  'who/iuis': { label: 'WHO/IUIS', url: 'http://www.allergen.org/' },
}

export function sourceDb(slug: string): DbInfo {
  return SOURCE_DBS[slug.trim().toLowerCase()] ?? { label: slug.trim(), url: '' }
}

// Split a screener 'sources' string ("a;b;c") into DbInfo, in a stable order.
export function parseSources(sources: string): DbInfo[] {
  return sources
    .split(';')
    .map((s) => s.trim())
    .filter(Boolean)
    .map(sourceDb)
}

export function parseAllergenSources(source: string): DbInfo[] {
  return source
    .split('|')
    .map((s) => s.trim())
    .filter(Boolean)
    .map((s) => ALLERGEN_SOURCES[s.toLowerCase()] ?? { label: s, url: '' })
}

// Canonical activity classes (the 10 present in the master list), for the filter and
// for proper-cased chip labels. `axis` groups them in the filter UI.
export type Axis = 'bioactive' | 'cytotoxic' | 'allergen'
export interface ActivityClass {
  id: string
  label: string
  axis: Axis
}

export const ACTIVITY_CLASSES: ActivityClass[] = [
  { id: 'ace_inhibitory', label: 'ACE-inhibitory', axis: 'bioactive' },
  { id: 'antihypertensive', label: 'Antihypertensive', axis: 'bioactive' },
  { id: 'antioxidant', label: 'Antioxidant', axis: 'bioactive' },
  { id: 'antimicrobial', label: 'Antimicrobial', axis: 'bioactive' },
  { id: 'dpp_iv_inhibitory', label: 'DPP-IV-inhibitory', axis: 'bioactive' },
  { id: 'immunomodulatory', label: 'Immunomodulatory', axis: 'bioactive' },
  { id: 'opioid', label: 'Opioid', axis: 'bioactive' },
  { id: 'other', label: 'Other bioactive', axis: 'bioactive' },
  { id: 'cytotoxic', label: 'Cytotoxic', axis: 'cytotoxic' },
  { id: 'ige_epitope', label: 'IgE epitope (exact)', axis: 'allergen' },
]

const CLASS_LABEL: Record<string, string> = Object.fromEntries(
  ACTIVITY_CLASSES.map((c) => [c.id, c.label]),
)

export function classLabel(id: string): string {
  return CLASS_LABEL[id] ?? id.replace(/_/g, ' ')
}

export const AXIS_LABEL: Record<Axis, string> = {
  bioactive: 'Bioactivity',
  cytotoxic: 'Cytotoxicity',
  allergen: 'Allergen',
}

export const ALL_CLASS_IDS = ACTIVITY_CLASSES.map((c) => c.id)