support
array_intersection(arrays, fields)
Find and return the intersecting entries in multiple arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arrays
|
Iterable[ndarray]
|
Iterable of input structured arrays |
required |
fields
|
Iterable[str]
|
Iterable of fields to use to decide if entires are intersecting |
required |
Returns:
Name | Type | Description |
---|---|---|
selected |
list[ndarray]
|
Output iterable of arrays with only intersecting entries. |
Source code in pyhdx/support.py
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
|
autowrap(start, end, margin=4, step=5)
Automatically finds wrap value for coverage to not have overlapping peptides within margin
Parameters
start end margin
Returns
Source code in pyhdx/support.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
|
clean_types(d)
cleans up nested dict/list/tuple/other d
for exporting as yaml
Converts library specific types to python native types, including numpy dtypes, OrderedDict, numpy arrays
https://stackoverflow.com/questions/59605943/python-convert-types-in-deeply-nested-dictionary-or-array
Source code in pyhdx/support.py
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 |
|
colors_to_pymol(r_number, color_arr, c_term=None, no_coverage='#8c8c8c')
coverts colors (hexadecimal format) and corresponding residue numbers to pml script to color structures in pymol residue ranges in output are inclusive, incluive
c_term
optional residue number of the c terminal of the last peptide doedsnt cover the c terminal
Source code in pyhdx/support.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
|
dataframe_intersection(dataframes, by, reset_index=True)
Return a list of dataframes whos entries are limited to the intersection of rows of selected columns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataframes
|
list[DataFrame]
|
List of dataframes to intersect |
required |
by
|
Union[list, str]
|
Column name or list of column names to intersect on. |
required |
reset_index
|
bool
|
If True, the index is reset to a default integer index. |
True
|
Returns:
Type | Description |
---|---|
list[DataFrame]
|
List of dataframes with intersected rows |
Source code in pyhdx/support.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 |
|
gen_subclasses(cls)
Recursively find all subclasses of cls
Source code in pyhdx/support.py
728 729 730 731 732 |
|
grouper(n, iterable, padvalue=None)
grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')
Source code in pyhdx/support.py
295 296 297 |
|
hex_to_rgb(h)
returns rgb as int 0-255
Source code in pyhdx/support.py
548 549 550 551 |
|
make_color_array(rates, colors, thds, no_coverage='#8c8c8c')
:param rates: array of rates :param colors: list of colors (slow to fast) :param thds: list of thresholds no_coverage: color value for no coverage :return:
Source code in pyhdx/support.py
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
|
make_monomer(input_file, output_file)
reads input_file pdb file and removes all chains except chain A and all water
Source code in pyhdx/support.py
661 662 663 664 665 666 667 668 669 670 671 672 673 |
|
multi_otsu(*rates, classes=3)
global otsu thesholding of multiple rate arrays in log space
Parameters
rates : iterable
iterable of numpy structured arrays with a 'rate' field
classes : :obj:int
Number of classes to divide the data into
Returns
thds : :obj:tuple
tuple with thresholds
Source code in pyhdx/support.py
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
|
pbar_decorator(pbar)
Wraps a progress bar around a function, updating the progress bar with each function call
Source code in pyhdx/support.py
819 820 821 822 823 824 825 826 827 828 829 830 831 |
|
pprint_df_to_file(df, file_path_or_obj)
Pretty print (human-readable) a dataframe to a file
Parameters
df : :class:~pandas.DataFrame
file_path_or_obj : :obj:str
, Path or :class:~io.StringIO
Source code in pyhdx/support.py
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 |
|
reduce_inter(args, gap_size=-1)
Reduce overlapping intervals to its non-overlapping intveral parts
Author: Brent Pedersen Source: https://github.com/brentp/interlap/blob/3c4a5923c97a5d9a11571e0c9ea5bb7ea4e784ee/interlap.py#L224
:obj:int
Gaps of this size between adjacent peptides is not considered to overlap. A value of -1 means that peptides with exactly zero overlap are separated. With gap_size=0 peptides with exactly zero overlap are not separated, and larger values tolerate larger gap sizes.
reduce_inter([(2, 4), (4, 9)]) [(2, 4), (4, 9)] reduce_inter([(2, 6), (4, 10)]) [(2, 10)]
Source code in pyhdx/support.py
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 |
|
rgb_to_hex(rgb_a)
Converts rgba input values are [0, 255]
alpha is set to zero
returns as '#000000'
Source code in pyhdx/support.py
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 |
|
scale(x, out_range=(-1, 1))
rescale input array x to range out_range
Source code in pyhdx/support.py
721 722 723 724 725 |
|
select_config()
When the .pyhdx directory has multiple config files, prompts the users for which config to use and subsequently loads it.
Source code in pyhdx/support.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
|
series_to_pymol(pd_series)
Coverts a pandas series to pymol script to color proteins structures in pymol Series must have hexadecimal color values and residue number as index
Parameters
pd_series : :class:~pandas.Series
Returns
s_out : :obj:str
Source code in pyhdx/support.py
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 |
|
try_wrap(start, end, wrap, margin=4)
Check for a given coverage if the value of wrap is high enough to not have peptides overlapping within margin
start, end interval is inclusive, exclusive
Source code in pyhdx/support.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|