Base
Pipeline utility functions and classes.
get_abundance(omic_df, analyte, use_median=False)
Get the mean or median abundance of an analyte from an omics dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
omic_df
|
DataFrame
|
Polars dataframe containing the omics data, with the first column being the index. |
required |
analyte
|
str
|
analyte that should have an exact match in omic_df. |
required |
use_median
|
bool
|
Aggregate samples by median instead of mean. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
float | None
|
float | None: abundance value or None if not found. |
Source code in src/xlranker/util/__init__.py
get_pair_id(a, b)
Get a string representation of the pair. Input order independent.
Order is determine alphabetically.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a
|
Protein | Peptide
|
entity a |
required |
b
|
Protein | Peptide
|
entity b |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
pair representation with entities separated by '+'. |
Source code in src/xlranker/util/__init__.py
safe_a_greater_or_equal_to_b(a, b)
Returns True if a is greater or equal to b, with checks for None.
None is treated as missing value. Any float is greater than None. If both are None, return True.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a
|
float | None
|
a value |
required |
b
|
float | None
|
b value |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if a is greater or equal to b. If both are None, return True. Any float is greater than None. |
Source code in src/xlranker/util/__init__.py
set_seed(seed)
Set seed to provide consistent results between runs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed
|
int
|
number to initialize random number generators with |
required |