Functions
These functions are exposed at the top level of the module, e.g. hl.case
.
- Core language functions
- Constructor functions
- Collection functions
- Numeric functions
abs()
approx_equal()
bit_and()
bit_or()
bit_xor()
bit_lshift()
bit_rshift()
bit_not()
bit_count()
exp()
expit()
is_nan()
is_finite()
is_infinite()
log()
log10()
logit()
floor()
ceil()
sqrt()
sign()
min()
nanmin()
max()
nanmax()
mean()
median()
product()
sum()
cumulative_sum()
argmin()
argmax()
corr()
uniroot()
binary_search()
- String functions
- Statistical functions
- Random functions
- Genetics functions
locus()
locus_from_global_position()
locus_interval()
parse_locus()
parse_variant()
parse_locus_interval()
variant_str()
call()
unphased_diploid_gt_index_call()
parse_call()
downcode()
triangle()
is_snp()
is_mnp()
is_transition()
is_transversion()
is_insertion()
is_deletion()
is_indel()
is_star()
is_complex()
is_strand_ambiguous()
is_valid_contig()
is_valid_locus()
contig_length()
allele_type()
numeric_allele_type()
pl_dosage()
gp_dosage()
get_sequence()
mendel_error_code()
liftover()
min_rep()
reverse_complement()
Core language functions
|
Captures and broadcasts a Python variable or object as an expression. |
|
Deprecated in favor of |
|
Expression for an if/else statement; tests a condition and returns one of two options based on the result. |
|
Build a conditional tree on the value of an expression. |
|
Chain multiple if-else statements with a |
|
Bind a temporary variable and use it in a function. |
|
Bind a temporary variable and use it in a function. |
|
Deprecated in favor of |
|
Returns |
|
Returns |
|
Returns the first non-missing value of args. |
|
If a is missing, return b. |
|
Returns value if predicate is |
|
Returns an array of integers from start to stop by step. |
|
Query records from a table corresponding to a given point or range of keys. |
Constructors
|
Convert to a Boolean expression. |
|
Convert to a 64-bit floating point expression. |
|
Convert to a 32-bit floating point expression. |
|
Convert to a 64-bit floating point expression. |
|
Convert to a 32-bit integer expression. |
|
Convert to a 32-bit integer expression. |
|
Convert to a 64-bit integer expression. |
|
Construct an interval expression. |
|
Returns the string representation of x. |
|
Construct a struct expression. |
|
Construct a tuple expression. |
Collection constructors
|
Construct an array expression. |
|
Returns an empty array of elements of a type t. |
|
Convert a set expression. |
|
Returns an empty set of elements of a type t. |
|
Creates a dictionary. |
|
Returns an empty dictionary with key type key_type and value type value_type. |
Collection functions
|
Returns the size of a collection or string. |
|
Transform each element of a collection. |
|
Map each element of the collection to a new collection, and flatten the results. |
|
Zip together arrays into a single array. |
|
Returns an array of (index, element) tuples. |
|
Deprecated in favor of |
|
Flatten a nested collection by concatenating sub-collections. |
|
Check for any |
|
Check for all |
|
Returns a new collection containing elements where f returns |
|
Returns a sorted array. |
|
Returns the first element where f returns |
|
Group collection elements into a dict according to a lambda function. |
|
Reduces a collection with the given function f, provided the initial value zero. |
|
Map each element of a to cumulative value of function f, with initial value zero. |
|
Reverses the elements of a collection. |
|
Compute the intersection of sorted arrays on a given key. |
|
Compute the distinct union of sorted arrays on a given key. |
Numeric functions
|
Take the absolute value of a numeric value, array or ndarray. |
|
Tests whether two numbers are approximately equal. |
|
Bitwise and x and y. |
|
Bitwise or x and y. |
|
Bitwise exclusive-or x and y. |
|
Bitwise left-shift x by y. |
|
Bitwise right-shift x by y. |
|
Bitwise invert x. |
|
Count the number of 1s in the in the two's complement binary representation of x. |
|
|
|
|
|
|
|
|
|
|
|
Take the logarithm of the x with base base. |
|
|
|
|
|
Returns the sign of a numeric value, array or ndarray. |
|
|
|
Convert to a 32-bit integer expression. |
|
Convert to a 32-bit integer expression. |
|
Convert to a 64-bit integer expression. |
|
Convert to a 64-bit floating point expression. |
|
Convert to a 32-bit floating point expression. |
|
Convert to a 64-bit floating point expression. |
|
|
|
|
|
Finds a root of the function f within the interval [min, max]. |
Numeric collection functions
|
Returns the minimum element of a collection or of given numeric expressions. |
|
Returns the minimum value of a collection or of given arguments, excluding NaN. |
|
Returns the maximum element of a collection or of given numeric expressions. |
|
Returns the maximum value of a collection or of given arguments, excluding NaN. |
|
Returns the mean of all values in the collection. |
|
Returns the median value in the collection. |
|
Returns the product of values in the collection. |
|
Returns the sum of values in the collection. |
|
Returns an array of the cumulative sum of values in the array. |
|
Return the index of the minimum value in the array. |
|
Return the index of the maximum value in the array. |
|
Compute the Pearson correlation coefficient between x and y. |
|
Binary search array for the insertion point of elem. |
String functions
|
Returns a formatted string using a specified format string and arguments. |
|
Convert an expression to a JSON string expression. |
|
Convert a JSON string to a structured expression. |
|
Returns the Hamming distance between the two strings. |
|
Joins elements of collection into single string delimited by delimiter. |
|
Returns the Shannon entropy of the character distribution defined by the string. |
|
Parse a string as a 32-bit integer. |
|
Parse a string as a 32-bit integer. |
|
Parse a string as a 64-bit integer. |
|
Parse a string as a 64-bit floating point number. |
Parse a string as a 32-bit floating point number. |
|
Parse a string as a 64-bit floating point number. |
Statistical functions
|
Performs chi-squared test of independence on a 2x2 contingency table. |
|
Calculates the p-value, odds ratio, and 95% confidence interval using Fisher's exact test for a 2x2 table. |
|
Performs chi-squared or Fisher's exact test of independence on a 2x2 contingency table. |
|
Perform the Cochran-Mantel-Haenszel test for association. |
|
Returns the probability density at x of a beta distribution with parameters a (alpha) and b (beta). |
|
Compute the (log) probability density at x of a Poisson distribution with rate parameter lamb. |
|
Performs test of Hardy-Weinberg equilibrium. |
|
Returns the probability under the right-tail starting at x for a chi-squared distribution with df degrees of freedom. |
|
The cumulative probability function of a normal distribution with mean mu and standard deviation sigma. |
|
The cumulative probability function of a Poisson distribution. |
|
The quantile function of a chi-squared distribution with df degrees of freedom, inverts |
|
The quantile function of a normal distribution with mean mu and standard deviation sigma, inverts |
|
The quantile function of a Poisson distribution with rate parameter lamb, inverts |
Randomness
|
Returns |
|
Samples from a beta distribution with parameters a (alpha) and b (beta). |
|
Samples from a categorical distribution. |
|
Samples from a Dirichlet distribution. |
|
Samples from a gamma distribution with parameters shape and scale. |
|
Samples from a normal distribution with mean mean and standard deviation sd. |
|
Samples from a Poisson distribution with rate parameter lamb. |
|
Samples from a uniform distribution within the interval [lower, upper]. |
|
Samples from a uniform distribution of 32-bit integers. |
|
Samples from a uniform distribution of 64-bit integers. |
|
Randomly permute an array |
Genetics functions
|
Construct a locus expression from a chromosome and position. |
|
Constructs a locus expression from a global position and a reference genome. |
|
Construct a locus interval expression. |
|
Construct a locus expression by parsing a string or string expression. |
|
Construct a struct with a locus and alleles by parsing a string. |
|
Construct a locus interval expression by parsing a string or string expression. |
|
Create a variant colon-delimited string. |
|
Construct a call expression. |
|
Construct an unphased, diploid call from a genotype index. |
|
Construct a call expression by parsing a string or string expression. |
|
Create a new call by setting all alleles other than i to ref |
|
Returns the triangle number of n. |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns the length of contig in reference_genome. |
|
Returns the type of the polymorphism as a string. |
|
Return expected genotype dosage from array of Phred-scaled genotype likelihoods with uniform prior. |
|
Return expected genotype dosage from array of genotype probabilities. |
|
Return the reference sequence at a given locus. |
|
Compute a Mendelian violation code for genotypes. |
|
Lift over coordinates to a different reference genome. |
|
Computes the minimal representation of a (locus, alleles) polymorphism. |
|
Reverses the string and translates base pairs into their complements . |