ARC
lahuta.core.arc ¶
Classes to model and manage the atomic-level structure of a biological system. The atomic-level structure includes atoms, residues, and chains in the system, and their inter-relationships.
This module provides the following classes:
-
Atoms
: This class models and manages the properties of atoms in the system. It provides functionalities to retrieve information about individual atoms, as well as to iterate over and access data of multiple atoms. -
Residues
: This class models and manages the properties of residues in the system. Similar to the Atoms class, it provides functionalities to retrieve information about individual residues, as well as to iterate over and access data of multiple residues. -
Chains
: This class models and manages the properties of chains in the system. Again, similar to the Atoms and Residues classes, it provides functionalities to retrieve information about individual chains, as well as to iterate over and access data of multiple chains. -
ARC
: This class integrates the Atoms, Residues, and Chains (ARC) module, by creating and storing instances of Atoms, Residues, and Chains classes. Depending on the type of the input object (either GemmiLoader or TopologyLoader), it uses the appropriate method from Atoms, Residues, and Chains classes to initialize them. It provides methods to retrieve atom, residue, and chain information individually or together, as well as methods to iterate over and access this data. -
Atom
: This class models and manages the properties of an atom in the system. It is created with keyword arguments, which allows it to dynamically store any attributes passed. The attributes include, but are not limited to, atom name, ID, element, type, residue name, residue ID, chain label, and chain ID.
Example
>>> from arc import ARC, GemmiLoader
>>> loader = GemmiLoader("path_to_structure")
>>> arc = ARC(loader, loader.atom_site_data)
>>> atom_0 = arc.get_atom(0)
>>> print(atom_0)
Atom(name=..., id=..., element=..., type=..., resname=..., resid=..., chain_label=..., chain_id=...)
Atoms ¶
Models and manages the properties and coordinates of atoms in a system.
The Atoms class is part of the Atoms, Residues, Chains (ARC) module. It leverages structured numpy arrays to effectively handle, store and manipulate atomic information for speed optimization. The class stores atom-specific data like atom name, id, element type, and type, using the efficient and fast structured arrays provided by numpy.
The class provides two class methods for initialization: from_gemmi
and from_mda
.
These methods enable the creation of Atoms instances from Gemmi blocks or
an MDAnalysis AtomGroup, respectively.
The class also includes various properties to retrieve atomic attributes like names, types, ids, elements, and coordinates, and provides methods to iterate over and access the atomic data.
Attributes:
Name | Type | Description |
---|---|---|
data |
NDArray[Any]
|
A numpy structured array storing atomic properties. |
coords |
NDArray[float32]
|
A numpy array storing the coordinates of atoms. |
Examples:
>>> from arc import Atoms
>>> atoms_from_gemmi = Atoms.from_gemmi(gemmi_block)
>>> print(atoms_from_gemmi.names)
['C', 'O', 'N', ...]
>>> atoms_from_mda = Atoms.from_mda(uv)
>>> print(atoms_from_mda.ids)
[1, 2, 3, ...]
Source code in lahuta/core/arc.py
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 |
|
from_gemmi
classmethod
¶
from_gemmi(gemmi_block)
Create an Atoms instance from a Gemmi block.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gemmi_block |
dict[str, Any]
|
A Gemmi block. |
required |
Returns:
Name | Type | Description |
---|---|---|
Atoms |
Atoms
|
An Atoms instance. |
Source code in lahuta/core/arc.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
from_mda
classmethod
¶
from_mda(uv)
Create an Atoms instance from an MDAnalysis Universe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uv |
UniverseType
|
An MDAnalysis Universe. |
required |
Returns:
Name | Type | Description |
---|---|---|
Atoms |
Atoms
|
An Atoms instance. |
Source code in lahuta/core/arc.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
Residues ¶
The Residues class models and manages the properties of residues in a system.
The Residues class is part of the Atoms, Residues, Chains (ARC) module. It utilizes structured numpy arrays for effective handling, storage, and manipulation of residue-related data. This class specifically stores data related to residue names and residue IDs.
Initialization of the Residues instances can be accomplished via two class methods:
from_gemmi
and from_mda
. These methods enable the creation of Residues instances
from Gemmi blocks or an MDAnalysis Universe respectively.
The class includes properties to retrieve residue attributes like residue names and residue IDs, and provides methods to iterate over and access the residue data.
Attributes:
Name | Type | Description |
---|---|---|
_data |
NDArray[Any]
|
A numpy structured array storing residue properties. |
Examples:
>>> from arc import Residues
>>> residues_from_gemmi = Residues.from_gemmi(gemmi_block)
>>> print(residues_from_gemmi.resnames)
['ALA', 'GLY', 'VAL', ...]
>>> residues_from_mda = Residues.from_mda(uv)
>>> print(residues_from_mda.resids)
[1, 2, 3, ...]
Source code in lahuta/core/arc.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 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 |
|
from_gemmi
classmethod
¶
from_gemmi(gemmi_block)
Create a Residues instance from a Gemmi block.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gemmi_block |
dict[str, Any]
|
A Gemmi block. |
required |
Returns:
Name | Type | Description |
---|---|---|
Residues |
Residues
|
A Residues instance. |
Source code in lahuta/core/arc.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
from_mda
classmethod
¶
from_mda(mda_universe)
Create a Residues instance from an MDAnalysis Universe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mda_universe |
UniverseType
|
An MDAnalysis Universe. |
required |
Returns:
Name | Type | Description |
---|---|---|
Residues |
Residues
|
A Residues instance. |
Source code in lahuta/core/arc.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
Chains ¶
The Chains class models and manages the properties of chains in a system.
The Chains class is part of the Atoms, Residues, Chains (ARC) module. It utilizes structured numpy arrays for effective handling, storage, and manipulation of chain-related data. This class specifically stores data related to chain labels, chain auth, and chain IDs.
Initialization of the Chains instances can be accomplished via two class methods:
from_gemmi
and from_mda
. These methods enable the creation of Chains instances from
Gemmi blocks or an MDAnalysis Universe respectively.
The class includes properties to retrieve chain attributes like labels, auths, and IDs, and provides methods to iterate over and access the chain data.
Attributes:
Name | Type | Description |
---|---|---|
_data |
NDArray[Any]
|
A numpy structured array storing chain properties. |
mapping |
dict[str, int]
|
Mapping from chain auth to chain IDs. |
Examples:
>>> from arc import Chains
>>> chains_from_gemmi = Chains.from_gemmi(gemmi_block)
>>> print(chains_from_gemmi.labels)
['A', 'B', 'C', ...]
>>> chains_from_mda = Chains.from_mda(uv)
>>> print(chains_from_mda.auths)
['A', 'B', 'C', ...]
Source code in lahuta/core/arc.py
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 |
|
from_gemmi
classmethod
¶
from_gemmi(gemmi_block)
Create a Chains instance from a Gemmi block.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gemmi_block |
dict[str, Any]
|
A Gemmi block. |
required |
Returns:
Name | Type | Description |
---|---|---|
Chains |
Chains
|
A Chains instance. |
Source code in lahuta/core/arc.py
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 |
|
from_mda
classmethod
¶
from_mda(mda_universe)
Create a Chains instance from an MDAnalysis Universe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mda_universe |
UniverseType
|
An MDAnalysis Universe. |
required |
Returns:
Name | Type | Description |
---|---|---|
Chains |
Chains
|
A Chains instance. |
Source code in lahuta/core/arc.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
ARC ¶
The ARC class models and manages the properties of a biological system consisting of atoms, residues, and chains.
The ARC class integrates the Atoms, Residues, and Chains (ARC) module, by creating and storing instances of Atoms, Residues, and Chains classes. Depending on the type of the input object (either GemmiLoader or TopologyLoader), it uses the appropriate method from Atoms, Residues, and Chains classes to initialize them.
It provides methods to retrieve atom, residue, and chain information individually or together, as well as methods to iterate over and access this data.
Attributes:
Name | Type | Description |
---|---|---|
_atoms |
Atoms
|
An instance of the Atoms class. |
_residues |
Residues
|
An instance of the Residues class. |
_chains |
Chains
|
An instance of the Chains class. |
Examples:
>>> from arc import ARC, GemmiLoader
>>> loader = GemmiLoader("path_to_structure")
>>> arc = ARC(loader, loader.site_data)
>>> atom_0 = arc.get_atom(0)
>>> print(atom_0)
Atom(name=..., id=..., element=..., type=..., resname=..., resid=..., chain_label=..., chain_id=...)
>>> print(arc.atoms)
Atoms(name=..., id=..., element=..., type=...)
>>> print(arc.residues)
Residues(resname=..., resid=...)
Source code in lahuta/core/arc.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 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 |
|
get_atom ¶
get_atom(index)
Get an atom at a given index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the atom. |
required |
Returns:
Name | Type | Description |
---|---|---|
Atom |
Atom
|
An Atom instance. |
Source code in lahuta/core/arc.py
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 |
|
Atom
dataclass
¶
The Atom class models and manages the properties of an atom in a system.
The Atom class stores information related to a single atom in a system. It's created using keyword arguments, which allows it to dynamically store any attributes passed. The attributes include, but are not limited to, atom name, ID, element, type, residue name, residue ID, chain label, and chain ID.
The Atom class includes methods for representing and printing atom information. Note that all attributes are optional and can be passed as keyword arguments.
Examples:
>>> from arc import Atom
>>> atom = Atom(name='CA', id=1, element='C', type='C.3', resname='ALA', resid=1, chain_label='A', chain_id=1)
>>> print(atom)
Atom(name=CA, id=1, element=C, type=C.3, resname=ALA, resid=1, chain_label=A, chain_id=1)
Source code in lahuta/core/arc.py
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 |
|