divbrowse.lib.analysis

Module Contents

Classes

Analysis

Functions

calculate_mean(→ numpy.ndarray)

Calculate the mean for each variant of a variant matrix array holding the number of alternate alleles

impute_with_mean(→ numpy.ndarray)

variant matrix array for that missing values should be imputed (replaced) with the mean for the variant

divbrowse.lib.analysis.calculate_mean(sliced_variant_calls: numpy.ndarray) numpy.ndarray

Calculate the mean for each variant of a variant matrix array holding the number of alternate alleles

Note

Missing variant calls are excluded from the mean calculation

Parameters

sliced_variant_calls (numpy.ndarray) – Numpy array representing a variant matrix holding the number of alternate allele calls

Returns

Numpy array holding the means per variant

Return type

numpy.ndarray

divbrowse.lib.analysis.impute_with_mean(sliced_variant_calls: numpy.ndarray) numpy.ndarray

variant matrix array for that missing values should be imputed (replaced) with the mean for the variant

Parameters

sliced_variant_calls (numpy.ndarray) – Numpy array representing a variant matrix holding the number of alternate allele calls

Returns

Imputed version of the input variant matrix array

Return type

numpy.ndarray

class divbrowse.lib.analysis.Analysis(variant_calls_slice: divbrowse.lib.variant_calls_slice.VariantCallsSlice)
get_imputed_calls()
calc_distance_to_reference(samples)
calc_distance_matrix(samples)
pca()

Calculate a PCA for a variant matrix array

Parameters

slice_of_variant_calls (numpy.ndarray) – Numpy array representing a variant matrix holding the number of alternate allele calls

Returns

PCA result aligned with the sample IDs in the first column

Return type

numpy.ndarray

umap(n_neighbors=15)

Calculate UMAP for a variant matrix array

Parameters

n_neighbors (int) – n_neighbors parameter of umap.UMAP() method

Returns

PCA result aligned with the sample IDs in the first column

Return type

numpy.ndarray