Internals

Documentation for OscoNet.jl's internal functions.

See the Public Documentation section for documentation of the public interface.

Index

Internal Interface

OscoNet.calc_roughnessMethod

Evaluate roughness of pseudotime. This metric measures the smoothness of the gene expression profile by looking at the differences between consecutive measurements. Smaller values indicate a smoother response.

source
OscoNet.construct_symmetric_matrix_from_upper_triangular_vectorMethod

Construct a symmetric matrix with Inf diagonal values using a vector whose length is a triangular number. This vector is intended to be the output of vec_triu_loop.

Examples

julia> using OscoNet

julia> A = [1 2 3; 4 5 6; 7 8 9]
3×3 Matrix{Int64}:
 1  2  3
 4  5  6
 7  8  9

julia> A_flatten = OscoNet.vec_triu_loop(A)
3-element Vector{Int64}:
 2
 3
 6

julia> OscoNet.construct_symmetric_matrix_from_upper_triangular_vector(A_flatten)
3×3 Matrix{Float64}:
 Inf    2.0   3.0
  2.0  Inf    6.0
  3.0   6.0  Inf
source
OscoNet.f_2Method

Helper function for optimisation. Calculate the sum of the squared distances between a set of data points and the circle centred at c=(xc, yc)

source
OscoNet.find_best_psi_for_each_gene_pairMethod

Compute the minimum distance between gene x and gene y, for a set of genes x, y ∈ X.

Arguments

  • data::Matrix: Matrix of size (ngenes x ncells), whose elements represent gene expression.

Returns

  • Ψ::Array{Float64}: Array of size (ngenes x ngenes), whose (x,y)-th element

represents the phase shift Ψ between gene x and gene y.

  • distance::Array{Float64}: Array of size (ngenes x ngenes), whose (x,y)-th element

represents the minimum distance d between gene x and gene y.

source
OscoNet.get_metrics_for_different_qvalue_thresholdsMethod

Get true positive, false positive and false discovery rates

Arguments

  • qvalues: q-value matrix (ngenes X ngenes)

  • adj_matrix_true: binary adjacency matrix of true gene pairs (ngenes X ngenes)

  • α_values: one dimensional vector for threshold values

Returns

  • true_positive_rate:

  • false_positive_rate:

  • false_discovery_rate:

source
OscoNet.get_permuted_costMethod

getpermutedcost([rng::AbstractRNG,] data, n_permutations::Int)

Compute the minimum distance between gene x and the n-th random permutation of gene y, for a set of genes x, y ∈ X.

Arguments

  • data::Matrix: Matrix of size (ngenes x ncells), whose elements represent gene expression.

  • n_permutations::Int: number of bootstrap permutations

Returns

  • cost_permuted::Array{Float64}: Array of size (ngenes x ngenes x n_permutations), whose (x,y,n)-th element

represents the minimum distance between gene x and the n-th random permutation of gene y.

source
OscoNet.get_pvaluesMethod

Get p-values from the bootstrap hypothesis test

Arguments

  • cost_unpermuted: A matrix of size (ngenes X ngenes) whose upper triangular (x,y)-th element defines the

distance between gene x and gene y

  • cost_permuted: An array of size (ngenes X ngenes X n_permutations) whose upper triangular (x,y,n)-th element

defines the distance between gene x and the n-th permutation of gene y

Returns

  • pvalues: A matrix of size (ngenes X ngenes)
source
OscoNet.istriangularMethod
istriangular(x::Number) -> Bool

Test whether x is a triangular number.

By solving the quadratic formula for the the m-th triangular number n = m(m-1)/2, it can be shown that an integer is triangular if and only if 8n+1 is a perfect square. In other words, if and only if sqrt(8n+1) is an integer.

Examples

julia> using OscoNet

julia> OscoNet.istriangular(45.0)
true
source
OscoNet.qvalue_estimateMethod

Estimates q-values from p-values, see https://github.com/nfusi/qvalue

Arguments

  • pvalues: A vector of p-values

  • n_tests: number of tests. If not specified n_tests = length(pvalues)

  • π₀: Estimate of the proportion of features that are truly null. If not specified,

it's estimated as suggested in Storey and Tibshirani, 2003.

Returns

  • qvalues

  • π₀

source
OscoNet.vec_triu_loopMethod

A function to return the elements of the (strict) upper triangle of a matrix, M, as a vector.

Examples

julia> using OscoNet

julia> A = [1 2 3; 4 5 6; 7 8 9]
3×3 Matrix{Int64}:
 1  2  3
 4  5  6
 7  8  9

julia> OscoNet.vec_triu_loop(A)
3-element Vector{Int64}:
 2
 3
 6
source