Internals
Documentation for OscoNet.jl's internal functions.
See the Public Documentation section for documentation of the public interface.
Index
OscoNet.calc_roughnessOscoNet.calculate_error_ratesOscoNet.calculate_metricsOscoNet.construct_symmetric_matrix_from_upper_triangular_vectorOscoNet.distance_from_centreOscoNet.f_2OscoNet.find_best_psi_for_each_gene_pairOscoNet.get_circleOscoNet.get_metrics_for_different_qvalue_thresholdsOscoNet.get_peak_timeOscoNet.get_permuted_costOscoNet.get_pvaluesOscoNet.istriangularOscoNet.qvalue_estimateOscoNet.scale_dataOscoNet.vec_triu_loop
Internal Interface
OscoNet.calc_roughness — MethodEvaluate 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.
OscoNet.calculate_error_rates — MethodArguments
Returns
OscoNet.calculate_metrics — MethodCalculate various metrics
OscoNet.construct_symmetric_matrix_from_upper_triangular_vector — MethodConstruct 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 InfOscoNet.distance_from_centre — MethodCalculate the distance of a set of 2D points from the centre (xc, yc) of a circle
OscoNet.f_2 — MethodHelper function for optimisation. Calculate the sum of the squared distances between a set of data points and the circle centred at c=(xc, yc)
OscoNet.find_best_psi_for_each_gene_pair — MethodCompute 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.
OscoNet.get_circle — MethodCalculate mean circle
OscoNet.get_metrics_for_different_qvalue_thresholds — MethodGet 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:
OscoNet.get_peak_time — MethodCalculate time of peak expression for a specific gene given pseudotime
OscoNet.get_permuted_cost — Methodgetpermutedcost([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.
OscoNet.get_pvalues — MethodGet 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)
OscoNet.istriangular — Methodistriangular(x::Number) -> BoolTest 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)
trueOscoNet.qvalue_estimate — MethodEstimates q-values from p-values, see https://github.com/nfusi/qvalue
Arguments
pvalues: A vector of p-valuesn_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π₀
OscoNet.scale_data — MethodZ-Score normalisation of a matrix of size (ngenes x ncells), applied row-wise
OscoNet.vec_triu_loop — MethodA 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