Annotation API¶
Module for annotating clonotypes with public TCR databases.
annotate ¶
TCR annotation using public databases for TCRsift.
Matches TCRs against VDJdb, IEDB, and CEDAR to identify known specificities.
VIRAL_SPECIES_PATTERNS
module-attribute
¶
VIRAL_SPECIES_PATTERNS = ['cmv', 'cytomegalovirus', 'ebv', 'epstein-barr', 'hiv', 'human immunodeficiency', 'flu', 'influenza', 'sars', 'coronavirus', 'herpes', 'hsv', 'hpv', 'papilloma', 'hepatitis', 'hbv', 'hcv', 'dengue', 'zika', 'yellow fever']
load_vdjdb ¶
Load VDJdb database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to VDJdb directory or file |
required |
verbose
|
bool
|
Print progress information |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
VDJdb entries with standardized columns |
Source code in tcrsift/annotate.py
load_iedb ¶
Load IEDB TCR database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to IEDB file |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
IEDB entries with standardized columns |
Source code in tcrsift/annotate.py
load_cedar ¶
Load CEDAR TCR database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to CEDAR file |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
CEDAR entries with standardized columns |
Source code in tcrsift/annotate.py
load_databases ¶
load_databases(vdjdb_path: str | Path | None = None, iedb_path: str | Path | None = None, cedar_path: str | Path | None = None) -> pd.DataFrame
Load and combine multiple TCR databases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vdjdb_path
|
str or Path
|
Path to VDJdb |
None
|
iedb_path
|
str or Path
|
Path to IEDB |
None
|
cedar_path
|
str or Path
|
Path to CEDAR |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Combined database with standardized columns |
Source code in tcrsift/annotate.py
match_clonotypes ¶
match_clonotypes(clonotypes: DataFrame, database: DataFrame, match_by: str = 'CDR3ab', verbose: bool = True, show_progress: bool = True) -> pd.DataFrame
Match clonotypes against public database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clonotypes
|
DataFrame
|
Clonotype DataFrame |
required |
database
|
DataFrame
|
Combined database from load_databases |
required |
match_by
|
str
|
Matching strategy: "CDR3ab" (both chains) or "CDR3b_only" (beta only) |
'CDR3ab'
|
verbose
|
bool
|
Print progress information |
True
|
show_progress
|
bool
|
Show progress bar |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Clonotypes with match annotations added |
Source code in tcrsift/annotate.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
annotate_clonotypes ¶
annotate_clonotypes(clonotypes: DataFrame, vdjdb_path: str | Path | None = None, iedb_path: str | Path | None = None, cedar_path: str | Path | None = None, match_by: str = 'CDR3ab', exclude_viral: bool = False, flag_only: bool = False) -> pd.DataFrame
Main annotation function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clonotypes
|
DataFrame
|
Clonotype DataFrame |
required |
vdjdb_path
|
str or Path
|
Paths to databases |
None
|
iedb_path
|
str or Path
|
Paths to databases |
None
|
cedar_path
|
str or Path
|
Paths to databases |
None
|
match_by
|
str
|
Matching strategy |
'CDR3ab'
|
exclude_viral
|
bool
|
Remove clones matching viral epitopes |
False
|
flag_only
|
bool
|
Just flag viral, don't remove |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Annotated clonotypes |
Source code in tcrsift/annotate.py
get_annotation_summary ¶
Get summary of annotation results.
Returns:
| Type | Description |
|---|---|
dict
|
Summary statistics |