modules
Top-level package for procaliper.
Protein
¶
Source code in procaliper/_protein.py
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 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 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
|
fetch_pdb(save_path=None, url=None)
¶
Fetches the PDB file for the protein (from the AlphaFold database by default).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
save_path |
str | None
|
The path to save the PDB file to.
If |
None
|
url |
str | None
|
The URL to fetch the PDB file from.
Defaults to |
None
|
Raises:
Type | Description |
---|---|
Exception
|
If the response status code is not 200, meaning we could not fetch the PDB from the database. |
Source code in procaliper/_protein.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 |
|
from_uniprot_id(uniprot_id, fields=None, from_db='UniProtKB_AC-ID', to_db='UniProtKB-Swiss-Prot')
classmethod
¶
Create a new Protein object from a Uniprot ID (fetches with Uniprot API)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uniprot_id |
str
|
The Uniprot ID of the protein. |
required |
fields |
list[str] | None
|
The fields to retrieve from
Uniprot. If |
None
|
from_db |
str
|
The database to retrieve the ID from. Defaults to "UniProtKB_AC-ID". |
'UniProtKB_AC-ID'
|
to_db |
str
|
The database to map to. Defaults to "UniProtKB-Swiss-Prot". |
'UniProtKB-Swiss-Prot'
|
Raises:
Type | Description |
---|---|
ValueError
|
If we cannot retrieve the Uniprot ID. |
Returns:
Name | Type | Description |
---|---|---|
Protein |
Protein
|
A processed and standardized protein object. |
Source code in procaliper/_protein.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
from_uniprot_row(row)
classmethod
¶
Create a new Protein object from a row from a Uniprot table
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
dict[str, Any]
|
Contains the data from the Uniprot table. Must have "Sequence" or "sequence" as a key. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If "Sequence" or "sequence" is not found in the row. |
Returns:
Name | Type | Description |
---|---|---|
Protein |
Protein
|
A processed and standardized protein object. |
Source code in procaliper/_protein.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
get_biopandas_pdb_dataframe()
¶
Get the PDB dataframe for the protein.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Name | Type | Description |
---|---|---|
PandasPdb |
PandasPdb
|
A biopandas dataframe that contains the PDB file information. |
Source code in procaliper/_protein.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
get_biopython_residues()
¶
Get the biopython residues for the protein.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
list[Residue]
|
list[Residue]: A list of biopython residues for the protein. |
Source code in procaliper/_protein.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
get_biopython_structure()
¶
Get the biopython structure for the protein.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
ValueError
|
If the PDB file cannot be parsed. |
Returns:
Name | Type | Description |
---|---|---|
Structure |
Structure
|
A biopython Structure object for the protein. |
Source code in procaliper/_protein.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
get_charge(method='gasteiger')
¶
Fetches precomputed charge data for the protein, or computes it.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
The method used for the charge calculation. Examples include 'qtpie', 'eem', 'gasteiger'. Defaults to 'gasteiger'. For a full list reference https://open-babel.readthedocs.io/en/latest/Charges/charges.html |
'gasteiger'
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
ChargeData
|
structure.charge.ChargeData: A :class: |
Source code in procaliper/_protein.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
|
get_confidence()
¶
Fetches precomputed confidence data from pdb file.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: A list of confidence values for each residue. |
Source code in procaliper/_protein.py
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 |
|
get_cysteine_data()
¶
Fetches precomputed size data for the protein, or computes it.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
CysteineData
|
structure.size.CysteineData: A :class: |
Source code in procaliper/_protein.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
get_sasa()
¶
Fetches precomputed SASA data for the protein, or computes it.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
SASAData
|
structure.sasa.SASAData: A :class: |
Source code in procaliper/_protein.py
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 |
|
get_titration()
¶
Runs the default titration calculation for the protein.
Equivalent to running self.get_titration_from_propka
.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
TitrationData
|
structure.titration.TitrationData: A
:class: |
Source code in procaliper/_protein.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
|
get_titration_from_pkai()
¶
Fetches precomputed titration data for the protein, or computes it.
Uses :func:protein_structure.titration.calculate_titration_pkai
if
self.titration_data
is not already stored. Requires pkai to be
installed. Note that this method is a deep-learning model, not a
physics-based calculation.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
structure.titration.TitrationData: A
Type | Description |
---|---|
TitrationData
|
the titration values for residues. |
Source code in procaliper/_protein.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
|
get_titration_from_propka()
¶
Fetches precomputed titration data for the protein, or computes it.
Uses :func:protein_structure.titration.calculate_titration_propka
if
self.titration_data
is not already stored.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
TitrationData
|
structure.titration.TitrationData: A
:class: |
Source code in procaliper/_protein.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
|
get_titration_from_pypka()
¶
Fetches precomputed titration data for the protein, or computes it.
Uses :func:protein_structure.titration.calculate_titration_pypka
if
self.titration_data
is not already stored. Requires pypka to be
installed, which has dependencies that are not FOSS. Please be sure to
verify that you are legally allowed to use pypka.
Must run self.fetch_pdb
first or specify an abosulute path to the PDB
file in self.pdb_location_absolute
.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Returns:
Type | Description |
---|---|
TitrationData
|
structure.titration.TitrationData: A
:class: |
Source code in procaliper/_protein.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
|
list_from_uniprot_ids(uniprot_ids, fields=None, from_db='UniProtKB_AC-ID', to_db='UniProtKB-Swiss-Prot')
classmethod
¶
Create a list of Protein objects from a list of Uniprot IDs (fetches with Uniprot API)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uniprot_ids |
list[str]
|
The Uniprot IDs of the proteins. |
required |
fields |
list[str] | None
|
The fields to retrieve from
Uniprot. If |
None
|
from_db |
str
|
The database to retrieve the IDs from. Defaults to "UniProtKB_AC-ID". |
'UniProtKB_AC-ID'
|
to_db |
str
|
The database to map to. Defaults to "UniProtKB-Swiss-Prot". |
'UniProtKB-Swiss-Prot'
|
Raises:
Type | Description |
---|---|
ValueError
|
If we cannot retrieve the Uniprot IDs. |
Returns:
Type | Description |
---|---|
list[Protein]
|
list[Protein]: A list of processed and standardized protein objects. |
Source code in procaliper/_protein.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
register_local_pdb(path_to_pdb_file=None)
¶
Sets pdb file for protein object using local pdb file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_to_pdb_file |
str | None
|
Path to local PDB file.
Defaults to |
None
|
Source code in procaliper/_protein.py
610 611 612 613 614 615 616 617 618 619 620 |
|
unravel_sites(selected_aas=None, selected_keys=None)
¶
Split the protein into individual sites, recording values for each.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
selected_aas |
None | set[AminoAcidLetter]
|
A set of amino acids letters to include in the output.
If |
None
|
selected_keys |
None | set[str]
|
A set of keys belonging to this |
None
|
Returns:
Type | Description |
---|---|
dict[str, list[Any]]
|
dict[str, list[Any]]: A dictionary mapping keys to lists of values. Each list is a parallel array of the same length as the protein sequence (after filtering out non-selected amino acids). |
Source code in procaliper/_protein.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
|
network
¶
contact_network(protein, max_dist_angstroms=10.0)
¶
Constructs a contact network from a protein.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein |
Protein
|
Protein object. |
required |
max_dist_angstroms |
float
|
Maximum distance between residues to be considered a contact. Defaults to 10.0. |
10.0
|
Returns:
Type | Description |
---|---|
Graph
|
nx.Graph: Contact network. |
Source code in procaliper/network.py
11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
distance_network(protein, max_dist_angstroms=20)
¶
Constructs a distance network from a protein.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein |
Protein
|
Protein object. |
required |
max_dist_angstroms |
float
|
Maximum distance between residues. Values greater than this will be set to np.inf. Defaults to 20. |
20
|
Returns:
Type | Description |
---|---|
Graph
|
nx.Graph: Distance network. |
Source code in procaliper/network.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
euclidean_backbone(g)
¶
Returns the Euclidean backbone of a distance network.
The Euclidean backbone of a weighted graph g is the smallest subgraph of g that contains all shortest paths where a path length is determined by the square root of the sum of the squared edge weights.
This is useful for sparsifying a distance network without disconnecting it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
g |
Graph
|
Distance network. Edges must have an attribute "d2" representing the
squared edge weight. This is computed by |
required |
Returns:
Type | Description |
---|---|
Graph
|
nx.Graph: Euclidean backbone. |
Source code in procaliper/network.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
regulatory_distance_network(protein)
¶
Constructs a regulatory region distance network from a protein.
Distances are computed between PTM sites, annotated regions, binding sites, and active sites.
Node labels will be 1-indexed and inclusive (e.g., "K5..C7"
refers to residues 5, 6, and 7).
The letter in front of the index refers to the first and last amino acid in the region.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein |
Protein
|
Protein object. |
required |
Returns:
Type | Description |
---|---|
Graph
|
nx.Graph: Distance network. |
Source code in procaliper/network.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
protein_structure
¶
calculate_charge(pdb_filename, method='gasteiger')
¶
Computes the charge of residue sites in a PDB file.
By default, the method used is 'gasteiger', but this is configurable in
hyperparameters.py
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. shortname (str): The shortname of the protein (typically will be UniProt ID). |
required |
method |
str
|
The method used for the charge calculation. Examples include 'qtpie', 'eem', 'gasteiger'. Defaults to 'gasteiger'. For a full list reference https://open-babel.readthedocs.io/en/latest/Charges/charges.html |
'gasteiger'
|
Raises:
Type | Description |
---|---|
ValueError
|
If the charge method is not found. |
Returns:
Name | Type | Description |
---|---|---|
ChargeData |
ChargeData
|
A data class for holding charge data from computed from a PDB file. |
Source code in procaliper/protein_structure/charge.py
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 91 |
|
calculate_cysteine_data(pdb_filename)
¶
Calculates spatial data for a protein from a PDB file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Name | Type | Description |
---|---|---|
CysteineData |
CysteineData
|
A data class for holding size data from computed from a PDB file. |
Source code in procaliper/protein_structure/cysteine_data.py
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 91 92 93 94 95 96 97 98 99 100 101 |
|
calculate_sasa(pdb_filename)
¶
Compute the SASA values for all CYS sites in a PDB file.
Uses the ShrakeRupley algorithm implemented in Bio.PDB.SASA.ShrakeRupley
with a probe radius of 1.40 and 100 points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Name | Type | Description |
---|---|---|
SASAData |
SASAData
|
A data class for holding SASA data from computed from a PDB file. |
Source code in procaliper/protein_structure/sasa.py
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 |
|
residue_pLDDT(pdb_filename)
¶
Extracts the pLDDT confidence for each residue in a PDB file.
We assume that the pLDDT confidences are in the B-factor entries of the PDB file. If this information is provided at the atom-level, the maximimum value across the residue is used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: The pLDDT confidence for each residue in the PDB file. |
Source code in procaliper/protein_structure/confidence.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
charge
¶
ChargeData
¶
Bases: TypedDict
A data class for holding charge data from computed from a PDB file.
Array index corresponds to residue number in the PDB. Note that Python
arrays are 0-indexed and PDB files are 1-indexed, so Python index 0
corresponds to residue 1. This assumes a complete PDB. Otherwise,
an object of the procaliper.Protein
class that constructs this will
store a variable called structure_index
that maps these indices to the
sequence position.
Attributes:
Name | Type | Description |
---|---|---|
charges |
list[list[float]]
|
The charge value for atoms in the residue, ordered from C-terminus to N-terminus according to standard pdb order. For example, in CYS, the last atom is always the SG sulfur. |
method |
list[str]
|
The method used for the charge calculation. |
residue_number |
list[int]
|
The residue number for the site. |
residue_name |
list[str]
|
The residue name (three-letter amino acid abbreviation) for the sites. |
Source code in procaliper/protein_structure/charge.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
calculate_charge(pdb_filename, method='gasteiger')
¶
Computes the charge of residue sites in a PDB file.
By default, the method used is 'gasteiger', but this is configurable in
hyperparameters.py
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. shortname (str): The shortname of the protein (typically will be UniProt ID). |
required |
method |
str
|
The method used for the charge calculation. Examples include 'qtpie', 'eem', 'gasteiger'. Defaults to 'gasteiger'. For a full list reference https://open-babel.readthedocs.io/en/latest/Charges/charges.html |
'gasteiger'
|
Raises:
Type | Description |
---|---|
ValueError
|
If the charge method is not found. |
Returns:
Name | Type | Description |
---|---|---|
ChargeData |
ChargeData
|
A data class for holding charge data from computed from a PDB file. |
Source code in procaliper/protein_structure/charge.py
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 91 |
|
confidence
¶
residue_pLDDT(pdb_filename)
¶
Extracts the pLDDT confidence for each residue in a PDB file.
We assume that the pLDDT confidences are in the B-factor entries of the PDB file. If this information is provided at the atom-level, the maximimum value across the residue is used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: The pLDDT confidence for each residue in the PDB file. |
Source code in procaliper/protein_structure/confidence.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
cysteine_data
¶
CysteineData
¶
Bases: TypedDict
Data class for holding size data from computed from a PDB file.
Non-CYS sites are assigned None
values.
Array index corresponds to residue number in the PDB. Note that Python
arrays are 0-indexed and PDB files are 1-indexed, so Python index 0
corresponds to residue 1. This assumes a complete PDB. Otherwise,
an object of the procaliper.Protein
class that constructs this will
store a variable called structure_index
that maps these indices to the
sequence position.
Attributes:
Name | Type | Description |
---|---|---|
cys_ratio |
list[float | None]
|
The ratio of CYS sites to total sites. |
min_dist_to_closest_sulfur |
list[float | None]
|
The minimum distance to the closest sulfur for each CYS site. |
sulfur_closeness_rating_scaled |
list[float | None]
|
The sulfur closeness rating scaled for the CYS sites. |
Source code in procaliper/protein_structure/cysteine_data.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
calculate_cysteine_data(pdb_filename)
¶
Calculates spatial data for a protein from a PDB file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Name | Type | Description |
---|---|---|
CysteineData |
CysteineData
|
A data class for holding size data from computed from a PDB file. |
Source code in procaliper/protein_structure/cysteine_data.py
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 91 92 93 94 95 96 97 98 99 100 101 |
|
distance
¶
contact_map(structure, max_dist_angsrtom=10)
¶
A contact map for a protein structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structure |
Structure
|
protein structure. |
required |
max_dist_angsrtom |
float
|
Largest distance to consider a contact, in Angstroms. Defaults to 10. |
10
|
Returns:
Type | Description |
---|---|
NDArray[int8]
|
npt.NDArray[np.float64]: contact map with shape nxn where n is the number of residues in the structure. |
Source code in procaliper/protein_structure/distance.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
distance_matrix(structure, thresh=np.inf)
¶
Compute a distance matrix for a protein structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structure |
Structure
|
protein structure. |
required |
thresh |
float
|
threshold for distance. Defaults to np.inf. Distances greater than this will be set to np.inf. |
inf
|
Returns:
Type | Description |
---|---|
NDArray[float64]
|
npt.NDArray[np.float64]: distance matrix with shape nxn where n is the number of residues in the structure. |
Source code in procaliper/protein_structure/distance.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
proximity_matrix(structure, thresh=0)
¶
Compute a proximity matrix for a protein structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structure |
Structure
|
protein structure. |
required |
thresh |
float
|
threshold for proximity. Defaults to 0. Proximity less than this will be set to 0. |
0
|
Returns:
Type | Description |
---|---|
NDArray[float64]
|
npt.NDArray[np.float64]: proximity matrix with shape nxn where n is the number of residues in the structure. |
Source code in procaliper/protein_structure/distance.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
region_distance(region_1, region_2)
¶
Compute the distance between two regions of a protein, in Angstroms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region_1 |
Iterable[Residue]
|
first region. |
required |
region_2 |
Iterable[Residue]
|
second region. |
required |
Returns:
Type | Description |
---|---|
floating[Any]
|
np.floating[Any]: minimum distance between the two regions. |
Source code in procaliper/protein_structure/distance.py
16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
region_distance_matrix(regions)
¶
Compute a distance matrix between regions of a protein.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
regions |
Sequence[Iterable[Residue]]
|
sequence of regions; each region is an iterable of residues. |
required |
Returns:
Type | Description |
---|---|
NDArray[float64]
|
npt.NDArray[np.float64]: distance matrix with shape nxn where n is the number of regions. |
Source code in procaliper/protein_structure/distance.py
31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
region_proximity_matrix(regions)
¶
Compute a proxmity matrix between regions of a protein.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
regions |
Sequence[Iterable[Residue]]
|
sequence of regions; each region is an iterable of residues. |
required |
Returns:
Type | Description |
---|---|
NDArray[float64]
|
npt.NDArray[np.float64]: proxmity matrix with shape nxn where n is the number of regions. |
Source code in procaliper/protein_structure/distance.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
residue_distance(r1, r2)
¶
Compute the distance between two residues, in Angstroms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r1 |
Residue
|
first residue. |
required |
r2 |
Residue
|
second residue. |
required |
Returns:
Type | Description |
---|---|
floating[Any]
|
np.floating[Any]: distance between the two residues. |
Source code in procaliper/protein_structure/distance.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
sasa
¶
SASAData
¶
Bases: TypedDict
Data class for holding SASA data from computed from a PDB file.
Array index corresponds to residue number in the PDB. Note that Python
arrays are 0-indexed and PDB files are 1-indexed, so Python index 0
corresponds to residue 1. This assumes a complete PDB. Otherwise,
an object of the procaliper.Protein
class that constructs this will
store a variable called structure_index
that maps these indices to the
sequence position.
Attributes:
Name | Type | Description |
---|---|---|
all_sasa_value |
list[float]
|
The overall SASA value for each site (computed as sum of atom SASA values). |
atom_sasa_values |
list[list[float]]
|
The SASA value for the each atom in each sites. Atoms are ordered from C-terminus to N-terminus according to standard pdb order. For example, in CYS, the last atom is always the SG sulfur. |
Source code in procaliper/protein_structure/sasa.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
calculate_sasa(pdb_filename)
¶
Compute the SASA values for all CYS sites in a PDB file.
Uses the ShrakeRupley algorithm implemented in Bio.PDB.SASA.ShrakeRupley
with a probe radius of 1.40 and 100 points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Name | Type | Description |
---|---|---|
SASAData |
SASAData
|
A data class for holding SASA data from computed from a PDB file. |
Source code in procaliper/protein_structure/sasa.py
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 |
|
titration
¶
TitrationData
¶
Bases: TypedDict
Data class for titration data.
Array index corresponds to residue number in the PDB. Note that Python
arrays are 0-indexed and PDB files are 1-indexed, so Python index 0
corresponds to residue 1. This assumes a complete PDB. Otherwise,
an object of the procaliper.Protein
class that constructs this will
store a variable called structure_index
that maps these indices to the
sequence position.
Attributes:
Name | Type | Description |
---|---|---|
pKa |
list[float | None]
|
The pKa values for the titration data.
Non-titratable sites are assigned |
(list[tuple[str, |
float]]
|
The expected protonation states for the
titration data. The first element of the tuple is the state of the
site and the second element is the average protonation of the site.
Non-titratable sites are assigned |
Source code in procaliper/protein_structure/titration.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
calculate_titration_propka(pdb_filename)
¶
Uses propka to calculate titration data for the protein.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdb_filename |
str
|
The path to the PDB file. |
required |
Returns:
Name | Type | Description |
---|---|---|
TitrationData |
TitrationData
|
The titration data for the protein. |
Source code in procaliper/protein_structure/titration.py
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 91 |
|
site_metadata
¶
CustomSiteData
¶
Class for storing custom site-level data.
Source code in procaliper/site_metadata/custom_site_data.py
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 91 92 93 94 |
|
add_residue_numbers(residue_number)
¶
Specify the number of residues in the CustomSiteData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
residue_number |
list[int] | int
|
If an integer, the number of residues. If a list of integers, the list of residue numbers. |
required |
Source code in procaliper/site_metadata/custom_site_data.py
55 56 57 58 59 60 61 62 63 64 65 |
|
add_site_data(key, row, overwrite=False)
¶
Add a site-level feature to the CustomSiteData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The name of the feature to add. |
required |
row |
list[Any]
|
The values for the feature. |
required |
overwrite |
bool
|
Whether to overwrite an existing feature. Defaults to False. |
False
|
Raises:
Type | Description |
---|---|
KeyError
|
If overwrite is False and the feature already exists. |
ValueError
|
If the number of values in the feature does not match the number of residues. |
Source code in procaliper/site_metadata/custom_site_data.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
from_dict(data, residue_index_feature_name='residue_number')
classmethod
¶
Create a CustomSiteData object from a dictionary of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict[str, list[Any]]
|
Data dictionary indexed by feature name. Each value must be a list of the same length as the residue number feature. Must include a residue number key. |
required |
residue_index_feature_name |
str
|
The name of the feature that contains the residue number. Defaults to "residue_number". |
'residue_number'
|
Raises:
Type | Description |
---|---|
ValueError
|
If the residue number feature is not in the data. |
Returns:
Name | Type | Description |
---|---|---|
CustomSiteData |
CustomSiteData
|
A CustomSiteData object. that contains the data. |
Source code in procaliper/site_metadata/custom_site_data.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
table()
¶
Return a dictionary of the data in the CustomSiteData object.
Returns:
Type | Description |
---|---|
dict[str, list[Any]]
|
dict[str, list[Any]]: A dictionary of the data in the CustomSiteData object. |
Source code in procaliper/site_metadata/custom_site_data.py
46 47 48 49 50 51 52 53 |
|
SiteAnnotations
¶
Class for parsing and storing UniProt site annotations.
An example of a UniProt site annotation:
DISULFID 28..87; /evidence="ECO:0000255|PROSITE-ProRule:PRU00114"; DISULFID 105; /note="Interchain (with heavy chain)"
Attributes:
Name | Type | Description |
---|---|---|
residue_letter |
list[str]
|
A list of amino acid letters. |
residue_number |
list[int]
|
A list of residue numbers. |
binding |
list[bool]
|
A list of booleans indicating whether a residue is a binding site. |
active |
list[bool]
|
A list of booleans indicating whether a residue is an active site. |
ptm |
list[bool]
|
A list of booleans indicating whether a residue is reported to be post-translationally modified. |
dna_binding |
list[bool]
|
A list of booleans indicating whether a residue is a DNA binding site. |
disulfide_bond |
list[bool]
|
A list of booleans indicating whether a residue is a disulfide bond. |
helix |
list[bool]
|
A list of booleans indicating whether a residue is in a helix. |
turn |
list[bool]
|
A list of booleans indicating whether a residue is in a turn. |
beta_strand |
list[bool]
|
A list of booleans indicating whether a residue is in a beta strand. |
binding_data |
list[dict[str, str]]
|
A list of dictionaries containing binding site metadata. |
active_data |
list[dict[str, str]]
|
A list of dictionaries containing active site metadata. |
ptm_data |
list[dict[str, str]]
|
A list of dictionaries containing post-translationally modified site metadata. |
regions |
dict[str, list[int]]
|
A dictionary mapping region names to lists of (zero-indexed) residue numbers. |
region_data |
dict[str, str]
|
A dictionary mapping region names to annotation data. |
domains |
dict[str, list[int]]
|
A dictionary mapping domain names to lists of (zero-indexed) residue numbers. |
domain_data |
dict[str, str]
|
A dictionary mapping domain names to annotation data. |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 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 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 |
|
__init__(sequence)
¶
Instantiates a SiteAnnotations object from a string of amino acid letters.
It is recommended to call SiteAnnotations.extract_annotation
after instantiating.
Before that, the SiteAnnotations
object contains only default values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
A string of amino acid letters. See
|
required |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
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 91 92 |
|
extract_annotation(description_type, description, extract_metadata=None)
¶
Extracts the site annotations from the description.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description_type |
str
|
The type of site annotation to extract. Must be
one of the keys in |
required |
description |
str
|
The UniProt site description string. |
required |
extract_metadata |
bool | None
|
Whether to extract metadata.
By default, this is inferred from the |
None
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
From |
ValueError
|
From |
AssertionError
|
If a |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 |
|
table()
¶
Return a dictionary of the data in the SiteAnnotations object.
Returns:
Type | Description |
---|---|
dict[str, list[Any]]
|
dict[str, list[Any]]: Each key is a site annotation feature name. Each value is a list of the values for that feature. |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
custom_site_data
¶
CustomSiteData
¶
Class for storing custom site-level data.
Source code in procaliper/site_metadata/custom_site_data.py
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 91 92 93 94 |
|
add_residue_numbers(residue_number)
¶
Specify the number of residues in the CustomSiteData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
residue_number |
list[int] | int
|
If an integer, the number of residues. If a list of integers, the list of residue numbers. |
required |
Source code in procaliper/site_metadata/custom_site_data.py
55 56 57 58 59 60 61 62 63 64 65 |
|
add_site_data(key, row, overwrite=False)
¶
Add a site-level feature to the CustomSiteData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The name of the feature to add. |
required |
row |
list[Any]
|
The values for the feature. |
required |
overwrite |
bool
|
Whether to overwrite an existing feature. Defaults to False. |
False
|
Raises:
Type | Description |
---|---|
KeyError
|
If overwrite is False and the feature already exists. |
ValueError
|
If the number of values in the feature does not match the number of residues. |
Source code in procaliper/site_metadata/custom_site_data.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
from_dict(data, residue_index_feature_name='residue_number')
classmethod
¶
Create a CustomSiteData object from a dictionary of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict[str, list[Any]]
|
Data dictionary indexed by feature name. Each value must be a list of the same length as the residue number feature. Must include a residue number key. |
required |
residue_index_feature_name |
str
|
The name of the feature that contains the residue number. Defaults to "residue_number". |
'residue_number'
|
Raises:
Type | Description |
---|---|
ValueError
|
If the residue number feature is not in the data. |
Returns:
Name | Type | Description |
---|---|---|
CustomSiteData |
CustomSiteData
|
A CustomSiteData object. that contains the data. |
Source code in procaliper/site_metadata/custom_site_data.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
table()
¶
Return a dictionary of the data in the CustomSiteData object.
Returns:
Type | Description |
---|---|
dict[str, list[Any]]
|
dict[str, list[Any]]: A dictionary of the data in the CustomSiteData object. |
Source code in procaliper/site_metadata/custom_site_data.py
46 47 48 49 50 51 52 53 |
|
uniprot_site_parsing
¶
SiteAnnotations
¶
Class for parsing and storing UniProt site annotations.
An example of a UniProt site annotation:
DISULFID 28..87; /evidence="ECO:0000255|PROSITE-ProRule:PRU00114"; DISULFID 105; /note="Interchain (with heavy chain)"
Attributes:
Name | Type | Description |
---|---|---|
residue_letter |
list[str]
|
A list of amino acid letters. |
residue_number |
list[int]
|
A list of residue numbers. |
binding |
list[bool]
|
A list of booleans indicating whether a residue is a binding site. |
active |
list[bool]
|
A list of booleans indicating whether a residue is an active site. |
ptm |
list[bool]
|
A list of booleans indicating whether a residue is reported to be post-translationally modified. |
dna_binding |
list[bool]
|
A list of booleans indicating whether a residue is a DNA binding site. |
disulfide_bond |
list[bool]
|
A list of booleans indicating whether a residue is a disulfide bond. |
helix |
list[bool]
|
A list of booleans indicating whether a residue is in a helix. |
turn |
list[bool]
|
A list of booleans indicating whether a residue is in a turn. |
beta_strand |
list[bool]
|
A list of booleans indicating whether a residue is in a beta strand. |
binding_data |
list[dict[str, str]]
|
A list of dictionaries containing binding site metadata. |
active_data |
list[dict[str, str]]
|
A list of dictionaries containing active site metadata. |
ptm_data |
list[dict[str, str]]
|
A list of dictionaries containing post-translationally modified site metadata. |
regions |
dict[str, list[int]]
|
A dictionary mapping region names to lists of (zero-indexed) residue numbers. |
region_data |
dict[str, str]
|
A dictionary mapping region names to annotation data. |
domains |
dict[str, list[int]]
|
A dictionary mapping domain names to lists of (zero-indexed) residue numbers. |
domain_data |
dict[str, str]
|
A dictionary mapping domain names to annotation data. |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 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 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 |
|
__init__(sequence)
¶
Instantiates a SiteAnnotations object from a string of amino acid letters.
It is recommended to call SiteAnnotations.extract_annotation
after instantiating.
Before that, the SiteAnnotations
object contains only default values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
A string of amino acid letters. See
|
required |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
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 91 92 |
|
extract_annotation(description_type, description, extract_metadata=None)
¶
Extracts the site annotations from the description.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description_type |
str
|
The type of site annotation to extract. Must be
one of the keys in |
required |
description |
str
|
The UniProt site description string. |
required |
extract_metadata |
bool | None
|
Whether to extract metadata.
By default, this is inferred from the |
None
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
From |
ValueError
|
From |
AssertionError
|
If a |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 |
|
table()
¶
Return a dictionary of the data in the SiteAnnotations object.
Returns:
Type | Description |
---|---|
dict[str, list[Any]]
|
dict[str, list[Any]]: Each key is a site annotation feature name. Each value is a list of the values for that feature. |
Source code in procaliper/site_metadata/uniprot_site_parsing.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
view
¶
ngl_scheme(data, float_to_hex=None, two_sided=False)
¶
Converts a list of values to an nglview color scheme.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
list[float]
|
The list of values to convert. |
required |
float_to_hex |
Callable[[float], str] | None
|
Function that
converts a float to a hex color in the form |
None
|
two_sided |
bool
|
Whether to use a two-sided color scheme. If
|
False
|
Returns:
Type | Description |
---|---|
list[tuple[str, str]]
|
list[tuple[str, str]]: A list of color and residue number tuples that are compatible with nglview. |
Source code in procaliper/view/nglview_utils.py
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 |
|
protein_to_nglview(protein)
¶
Generates an nglview widget from a protein that has an associated PDB file.
Must run protein.fetch_pdb
first or specify an abosulute path to the PDB
in protein.pdb_location_absolute
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein |
Protein
|
The protein object to visualize. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the PDB location is not set. |
Returns:
Type | Description |
---|---|
NGLWidget
|
nglview.NGLWidget: an nglview widget |
Source code in procaliper/view/nglview_utils.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
nglview_utils
¶
ngl_scheme(data, float_to_hex=None, two_sided=False)
¶
Converts a list of values to an nglview color scheme.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
list[float]
|
The list of values to convert. |
required |
float_to_hex |
Callable[[float], str] | None
|
Function that
converts a float to a hex color in the form |
None
|
two_sided |
bool
|
Whether to use a two-sided color scheme. If
|
False
|
Returns:
Type | Description |
---|---|
list[tuple[str, str]]
|
list[tuple[str, str]]: A list of color and residue number tuples that are compatible with nglview. |
Source code in procaliper/view/nglview_utils.py
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 |
|
protein_to_nglview(protein)
¶
Generates an nglview widget from a protein that has an associated PDB file.
Must run protein.fetch_pdb
first or specify an abosulute path to the PDB
in protein.pdb_location_absolute
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein |
Protein
|
The protein object to visualize. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the PDB location is not set. |
Returns:
Type | Description |
---|---|
NGLWidget
|
nglview.NGLWidget: an nglview widget |
Source code in procaliper/view/nglview_utils.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|