Classes
socialgene.base.socialgene
SocialGene
Bases: Molbio
, CompareProtein
, SequenceParser
, Neo4jQuery
, HmmerParser
Main class for building, sotring, working with protein and genomic info
Source code in socialgene/base/socialgene.py
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 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
|
__add__(sg_object)
The function merges proteins and assemblies from two objects and appends protein comparison data to a list or dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sg_object
|
The |
required |
represents another instance of the class that you want to add to the current instance.
Source code in socialgene/base/socialgene.py
534 535 536 537 538 539 540 541 542 543 544 545 |
|
annotate(use_neo4j_precalc=False, neo4j_chunk_size=1000, **kwargs)
The annotate
function is a convenience function that retrieves HMMER annotation for all
proteins in a Socialgene object, either from a Neo4j database or by using HMMER directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_neo4j_precalc
|
bool
|
A boolean flag indicating whether to use precalculated domain |
False
|
information from Neo4j for annotation. If set to True, the domains info will be retrieved from
Neo4j, and proteins not found in Neo4j will be analyzed with HMMER. If set to False, all
proteins will be analyzed with HMMER. Defaults to False
neo4j_chunk_size (int): The neo4j_chunk_size
parameter determines the number of proteins
that will be sent to Neo4j at a time for annotation. Defaults to 1000
Source code in socialgene/base/socialgene.py
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 |
|
annotate_proteins_with_hmmscan(protein_id_list, hmm_filepath, cpus=None, **kwargs)
Run hmmscan on Protein objects
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein_id_list
|
list
|
list of protein hash ids to run hmmscan on |
required |
hmm_filepath
|
str
|
path to file of HMMs |
required |
cpus
|
int
|
number of parallel processes to spawn |
None
|
Source code in socialgene/base/socialgene.py
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 |
|
annotate_proteins_with_neo4j(protein_uids=None, chunk_size=1000, annotate_all=False, progress=False)
The function annotate_proteins_with_neo4j
takes a list of protein hash IDs, queries a database
for matching proteins, and retrieves their HMM annotations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
protein_uids
|
List[str]
|
A list of protein hash IDs. These are unique identifiers for proteins in the database that you want to annotate. |
None
|
chunk_size
|
int
|
The |
1000
|
annotate_all
|
bool
|
The |
False
|
progress
|
bool
|
The |
False
|
Source code in socialgene/base/socialgene.py
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 |
|
drop_all_non_protein_features(**kwargs)
Drop features from all assembly/loci that aren't proteins/pseudo-proteins
Returns:
Name | Type | Description |
---|---|---|
list |
list of features that were removed (if return_removed=True) |
Source code in socialgene/base/socialgene.py
582 583 584 585 586 587 588 589 590 |
|
eat_pickle(inpath)
staticmethod
The eat_pickle
function reads a saved SocialGene pickle file from the given path and returns a SocialGene object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inpath
|
The |
required |
want to load the pickled object.
Returns:
Type | Description |
---|---|
SocialGene object |
Source code in socialgene/base/socialgene.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
|
export_all_domains_as_tsv(outpath, **kwargs)
The function exports all domains as a TSV file, sorted by protein ID and mean envelope position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outpath
|
The |
required |
Values) data will be written. It specifies the location and name of the file.
Source code in socialgene/base/socialgene.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
ferment_pickle(outpath)
The function ferment_pickle
saves a SocialGene object to a Python pickle file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outpath
|
The |
required |
Source code in socialgene/base/socialgene.py
387 388 389 390 391 392 393 394 395 |
|
fill_given_locus_range(locus_uid, start, end)
Given a locus uid that's in the database, pull asssembly, locus, protein info for those proteins
Source code in socialgene/base/socialgene.py
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 |
|
filter_proteins(hash_list)
Filter proteins by list of hash ids
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hash_list
|
List
|
List of protein hash identifiers |
required |
Returns:
Name | Type | Description |
---|---|---|
Generator |
generator returning tuple of length two -> Generator[(str, 'Protein']) |
Source code in socialgene/base/socialgene.py
412 413 414 415 416 417 418 419 420 421 |
|
hydrate_from_proteins()
Given a SocialGene object with proteins, retrieve from a running Neo4j database all locus and asssembly info for those proteins
Source code in socialgene/base/socialgene.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
hydrate_protein_info()
Pull name (original identifier) and description of proteins from Neo4j
Source code in socialgene/base/socialgene.py
349 350 351 352 353 354 355 356 |
|
table_assembly(**kwargs)
Assembly table for import into Neo4j
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outdir
|
str
|
Defaults to ".". |
required |
Source code in socialgene/base/socialgene.py
710 711 712 713 714 715 716 717 718 719 |
|
table_assembly_to_locus(**kwargs)
Assembly to locus table for import into Neo4j
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outdir
|
str
|
Defaults to ".". |
required |
Source code in socialgene/base/socialgene.py
684 685 686 687 688 689 690 691 692 693 |
|
table_assembly_to_taxid(**kwargs)
Assembly table for import into Neo4j
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outdir
|
str
|
Defaults to ".". |
required |
Source code in socialgene/base/socialgene.py
721 722 723 724 725 726 727 728 729 |
|
table_loci(**kwargs)
Generate a table of loci information.
Yields:
Name | Type | Description |
---|---|---|
tuple |
(internal_locus_id, external_locus_id, [info]) |
Source code in socialgene/base/socialgene.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
|
table_locus_to_protein(**kwargs)
The function table_locus_to_protein
generates a table of protein information from each locus, for import into Neo4j.
Source code in socialgene/base/socialgene.py
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
|
table_protein_ids(include_sequences=False, **kwargs)
Protein hash id table for import into Neo4j
Source code in socialgene/base/socialgene.py
676 677 678 679 680 681 682 |
|
table_protein_to_go(**kwargs)
The function table_protein_to_go
iterates through the assemblies, loci, and features of a
given object, and yields tuples containing the protein hash and GO term for each feature that
has GO terms, for import into Neo4j.
Source code in socialgene/base/socialgene.py
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
write_fasta(outpath, external_id=False, **kwargs)
Write all proteins to a FASTA file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outpath
|
str
|
path of file that FASTA entries will be appended to |
required |
external_id
|
bool
|
Write protein identifiers as the hash (True) or the original identifier (False). Defaults to False. |
False
|
**kwargs
|
see print(open_write.doc) |
{}
|
Source code in socialgene/base/socialgene.py
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 |
|
write_n_fasta(outdir, n_splits=1, **kwargs)
The function write_n_fasta
exports protein sequences split into multiple fasta files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outdir
|
The |
required |
will be saved.
n_splits: The n_splits
parameter in the write_n_fasta
function determines the number of
fasta files the protein sequences will be split into. By default, it is set to 1, meaning all
the protein sequences will be written into a single fasta file. If you specify a value greater
than. Defaults to 1
Source code in socialgene/base/socialgene.py
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 |
|
write_table(outdir, tablename, filename=None, include_sequences=False, **kwargs)
The function writes a table to a specified output directory in TSV format, for import into Neo4j.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outdir
|
str
|
The |
required |
file will be saved.
tablename (str): The tablename
parameter is a string that specifies the name of the table to
be written.
filename (str): The filename
parameter is an optional argument that specifies the name of
the file to be written. If no filename
is provided, the tablename
will be used as the
filename.
Source code in socialgene/base/socialgene.py
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 |
|
Assembly
Container class holding a dictionary of loci (ie genes/proteins)
Source code in socialgene/base/molbio.py
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 |
|
feature_uid_set
property
Return all protein hashes within assembly Returns: set: protein hashes
add_locus(external_id=None)
Add a locus to an assembly object
Source code in socialgene/base/molbio.py
1039 1040 1041 1042 1043 1044 1045 1046 |
|
Domain
Class for holding information about a domain/motif annotation
Source code in socialgene/base/molbio.py
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 |
|
domain_within_threshold
property
Check if a protein's domain annotation is within the threshold for inclusion (currently i_evalue based) Returns: bool: is less than or equal to the set ievalue cutoff?
__hash__()
Used to prevent adding duplicate domains Returns: hash: hash for set()
Source code in socialgene/base/molbio.py
337 338 339 340 341 342 |
|
__init__(hmm_id=None, env_from=None, env_to=None, seq_pro_score=None, evalue=None, i_evalue=None, domain_bias=None, domain_score=None, seq_pro_bias=None, hmm_from=None, hmm_to=None, ali_from=None, ali_to=None, exponentialized=True, **kwargs)
Class for holding information about a domain/motif annotation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hmm_id
|
str
|
The |
None
|
Markov model (HMM) associated with the domain.
env_from (int): The env_from
parameter represents the starting position of the domain in the
target sequence.
env_to (int): The env_to
parameter represents the end position of the environment (sequence)
in the domain. It is an integer value.
seq_pro_score (float): The seq_pro_score
parameter is a floating-point number that
represents the sequence profile score of the domain.
evalue (float): The evalue
parameter is a floating-point number that represents the E-value
of the domain. The E-value is a statistical measure that indicates the expected number of
domains with a similar score or better that would occur by chance in a database of the same
size.
i_evalue (float): The i_evalue
parameter is a floating-point number that represents the
independent E-value of a domain. It is used to assess the statistical significance of the match
between the domain and the sequence.
domain_bias (float): The domain_bias
parameter is a float that represents the bias score of
a domain. It is used to measure the likelihood that a domain is present in a sequence due to
chance rather than functional significance.
domain_score (float): The domain_score
parameter is a float that represents the score of the
domain.
seq_pro_bias (float): The seq_pro_bias
parameter is a float value that represents the
sequence profile bias of a domain. It is used to measure the bias in the sequence profile
alignment.
hmm_from (int): The hmm_from
parameter represents the starting position of the domain in the
HMM (Hidden Markov Model) profile. It is an integer value.
hmm_to (int): The hmm_to
parameter is an integer that represents the ending position of the
hidden Markov model (HMM) alignment in the domain.
ali_from (int): The ali_from
parameter represents the starting position of the alignment in
the sequence alignment. It is an integer value.
ali_to (int): The ali_to
parameter represents the ending position of the alignment in the
sequence.
exponentialized (bool): A boolean flag indicating whether the evalue and i_evalue should be
exponentialized or not. If set to True, the evalue and i_evalue will be converted to exponential
form. Defaults to True
Source code in socialgene/base/molbio.py
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 |
|
Feature
Bases: Location
Container class for describing a feature on a locus
Source code in socialgene/base/molbio.py
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 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
|
__eq__(other)
Used for set() in Assembly.add_locus()
Source code in socialgene/base/molbio.py
672 673 674 675 676 677 678 679 680 681 682 683 |
|
__hash__()
Used to prevent adding duplicate features to a locus (for hash in set() in Assembly.add_locus())
Returns:
Name | Type | Description |
---|---|---|
hash |
hash for set() |
Source code in socialgene/base/molbio.py
664 665 666 667 668 669 670 |
|
__init__(parent=None, uid=None, external_id=None, type=None, locus_tag=None, description=None, note=None, goterms=None, partial_on_complete_genome=None, missing_start=None, missing_stop=None, internal_stop=None, partial_in_the_middle_of_a_contig=None, missing_N_terminus=None, missing_C_terminus=None, frameshifted=None, too_short_partial_abutting_assembly_gap=None, incomplete=None, **kwargs)
The above function is a constructor for a class that represents a feature on a locus, with various attributes and optional arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
A string representing the hash value of the protein. |
None
|
external_id
|
str
|
The unique identifier for the protein associated with the feature. |
None
|
type
|
str
|
The "type" parameter is used to specify the type of feature. In this case, it is |
None
|
used to specify the type of the feature on a locus, such as "protein".
locus_tag (str): The locus_tag parameter is a string that represents the unique identifier for
a feature on a locus. It is typically used in genomics to identify a specific gene or protein
within a genome.
description: A description of the feature on a locus.
note: The note
parameter is used to provide additional information or comments about the
feature. It is an optional parameter and can be any string value.
goterms: The goterms
parameter is used to store the Gene Ontology terms associated with the
feature. Gene Ontology (GO) terms are standardized terms used to describe the function,
location, and involvement of genes and gene products in biological processes.
partial_on_complete_genome: A boolean flag indicating whether the feature is partial on a
complete genome.
missing_start: A boolean indicating whether the start of the feature is missing.
missing_stop: A boolean flag indicating whether the stop codon of the feature is missing.
internal_stop: A boolean flag indicating whether the feature has an internal stop codon.
partial_in_the_middle_of_a_contig: This parameter is used to indicate whether the feature is
partial and located in the middle of a contig.
missing_N_terminus: This parameter is used to indicate whether the N-terminus (the starting
end) of the feature is missing. It is a boolean value, where True indicates that the N-terminus
is missing and False indicates that it is not missing.
missing_C_terminus: The parameter "missing_C_terminus" is used to indicate whether the feature
is missing the C-terminus (the end) of the protein sequence. It is a boolean value that can be
set to True or False.
frameshifted: The "frameshifted" parameter is a boolean flag that indicates whether the
feature has a frameshift mutation. A frameshift mutation occurs when the reading frame of a gene
is disrupted by the insertion or deletion of nucleotides, causing a shift in the codon reading
frame and potentially altering the amino
too_short_partial_abutting_assembly_gap: This parameter is used to indicate whether the
feature is too short and abuts an assembly gap.
incomplete: A boolean flag indicating whether the feature is incomplete.
Source code in socialgene/base/molbio.py
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 |
|
feature_is_protein()
Check if the feature "is a protein"
Returns:
Name | Type | Description |
---|---|---|
bool |
True if socialgene thinks it's a protein, False if not |
Source code in socialgene/base/molbio.py
638 639 640 641 642 643 644 645 646 |
|
FeatureCollection
Source code in socialgene/base/molbio.py
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 |
|
features_sorted_by_midpoint
property
Sorts features by mid-coordinate of each feature
add_feature(**kwargs)
Add a feature to a locus
Source code in socialgene/base/molbio.py
695 696 697 |
|
Location
Source code in socialgene/base/molbio.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
__init__(start=None, end=None, strand=None, **kwargs)
Class describing genomic coordinates and strand direction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
int
|
start coordinate |
None
|
end
|
int
|
end coordinate |
None
|
strand
|
int
|
DNA strand |
None
|
Source code in socialgene/base/molbio.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
Locus
Bases: FeatureCollection
Container holding a set() of genomic features
Source code in socialgene/base/molbio.py
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
|
Molbio
Class for inheriting by SocialGene()
Source code in socialgene/base/molbio.py
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 |
|
add_assembly(uid=None, parent=None)
Add an assembly to a SocialGene object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
Assembly identifier, should be unique across parsed input. Defaults to None. |
None
|
Source code in socialgene/base/molbio.py
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 |
|
add_protein(return_uid=True, **kwargs)
Add a protein to the protein dictionary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
no_return
|
bool
|
Whether the function should return the protein's uid. Defaults to False. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Protein's hash |
Source code in socialgene/base/molbio.py
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 |
|
get_all_feature_uids()
Return a list of all proteins uids
Returns:
Name | Type | Description |
---|---|---|
list |
List of all proteins uids |
Source code in socialgene/base/molbio.py
1133 1134 1135 1136 1137 1138 1139 |
|
Protein
Bases: ProteinSequence
Container class for describing a single protein
Source code in socialgene/base/molbio.py
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 |
|
domain_vector
property
Get the domain uids for a protein as an ordered list
list: list of domain uids
__init__(description=None, external_id=None, domains=None, *args, **kwargs)
summary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description
|
str
|
Protein description. |
None
|
external_id
|
str
|
Non-hash-id descriptor (usually a database accession, e.g. NCBI's). |
None
|
seqlen
|
int
|
Amino acid sequence length |
required |
domains
|
Set
|
Set of Domain() objects. |
None
|
Source code in socialgene/base/molbio.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
|
add_domain(*args, **kwargs)
Add a domain to a protein if it meets threshold (ievalue)
Returns:
Name | Type | Description |
---|---|---|
bool |
used for counting # of domains added to protein |
Source code in socialgene/base/molbio.py
397 398 399 400 401 402 403 404 405 406 407 |
|
filter_domains()
Prune all domains in all proteins that don't meet the inclusion threshold (currently HMMER's i_evalue)
Source code in socialgene/base/molbio.py
465 466 467 468 469 470 471 472 473 474 |
|
ProteinSequence
Class used for working with protein sequences and can be initialized with either a sequence or a uid.
Source code in socialgene/base/molbio.py
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 |
|
seq_len
property
writable
Return the length of the protein
Returns:
Name | Type | Description |
---|---|---|
int |
number of amino acids |
__init__(sequence=None, uid=None, seq_len=None)
Class for holding an amino acid sequence (protein)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str
|
amino acid sequence |
None
|
uid
|
str
|
a uid can be provided if a sequence isn't |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
Must provide either a sequence or a uid |
Source code in socialgene/base/molbio.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
all_attributes()
The function returns a dictionary containing the attributes of an object.
Returns:
Type | Description |
---|---|
The |
attributes of the object. The attributes are obtained using the getattr
function and are filtered
to only include attributes that are defined in the __slots__
list and that exist in the object.
The dictionary is sorted based on the names of the attributes.
Source code in socialgene/base/molbio.py
98 99 100 101 102 103 104 105 106 107 108 |
|
Taxonomy
Class is a reserved word so just underscore all ranks to be consistent
Source code in socialgene/base/molbio.py
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 |
|