Common function

Common function

ModMashup.rwrFunction.
rwr(A::Matrix, restart_prob = 0.5)

Random walk with restart.

Arguments

A: Initial matrix for random walk.

restart_prob: Restart probability. Default 0.5.

Outputs

Q::Matrix: matrix after random walk.

source
ModMashup.pcaFunction.
pca(A::Matrix, num::Int64=size(A,2))

Perform PCA for a matrix.

Arguments

A::Matrix: matrix for PCA

keywords

num::Int64=size(A,2): Number of diensions selected.

Output

pca vector and pca value

eigenvalue::Vector: as name suggested. eigenvector::Matrix: columns represent eigen vector.

Example

julia> a = rand(5,5)
5×5 Array{Float64,2}:
 0.149599  0.318179  0.235567  0.779247  0.276985
 0.175398  0.109825  0.532561  0.723127  0.621328
 0.68087   0.639779  0.754652  0.781525  0.264776
 0.77962   0.446314  0.805693  0.88001   0.655808
 0.19243   0.43587   0.945708  0.109192  0.196602

julia> pca_value, pca_vector = pca(a)
([2.77556e-17,0.000524192,0.0396649,0.113626,0.128647],
[0.483429 0.397074 … -0.376334 -0.679859; -0.738733 0.15917 … -0.379275 -0.170866; … ;
 -0.0942359 -0.593824 … 0.444543 -0.643074; -0.457645 0.345674 … 0.1949 -0.306201])
source
build_index(index_file::String)

Get two dictionary, one map patients name to its id, another map patient id to its name.

Arguments

index_file::String:

Outputs

patients_index::Dict{String, Int}: map patientd name to its internal id.

inverse_index::Dict{Int, String}: map patientd internal id to its name.

Example

# get example data directory
example_data_dir = joinpath(Pkg.dir("ModMashup"), "test/data")

# Id file contains all the name of patients.
id = joinpath(example_data_dir,"ids.txt")

# Build the index
patients_index, inverse_index = build_index(id)
source
parse_target(target::Matrix,
    patients_index::Dict{String, Int})

Get a vector of annotation for patients. (+1 for interested, -1 for others)

Inputs

target::Matrix: colume one is patient name, colume two is patient label.

patients_index::Dict{String, Int}: map patientd name to its internal id.

Outputs

id_label::Matrix: colume one is patient id, colume two is patient label.

Example


# get example data directory
example_data_dir = joinpath(Pkg.dir("ModMashup"), "test/data")

# Id file contains all the name of patients.
id = joinpath(example_data_dir,"ids.txt")

# Build the patient index
patients_index, inverse_index = build_index(id)

# target_file should be a flat file contains disaese for patient
target_file = joinpath(example_data_dir,"target.txt")

# Build the annotation for each patients
annotation = parse_target(readdlm(target_file), patients_index)
source
parse_query(query_file, patients_index)

Get query patient id from the query file.

Inputs

query_file::String: query filename whose format same with GeneMANIA query.

patients_index::Dict{String, Int}: map patientd name to its internal id.

Outputs

query_id::Vector: query patient id.

Example


# get example data directory
example_data_dir = joinpath(Pkg.dir("ModMashup"), "test/data")

# Id file contains all the name of patients.
id = joinpath(example_data_dir,"ids.txt")

# Build the patient index
patients_index, inverse_index = build_index(id)

# Query file using the same format with genemania query
query = joinpath(example_data_dir,"query.txt")

# Build the annotation for each patients
query = parse_query(query, patients_index)
source
ModMashup.load_netMethod.
load_net(filename::String,
              database::Database)

Load similairity network from a flat file. Format patient_name patient_name simialirty_score. Use databse to map patient_name to internal id.

Inputs

filename::String: similairty network filename.

database::Database: store general information.

Outputs

A::Matrix: similairty network as a matrix.

source
searchdir(path,key)

Inputs

path::String: directory we want to search

key::String: keyword that the file we seached contains.

Outputs

  • a list of files whose name contains the keyword provided.

  • Input: directory we want to search and the keyword.

  • Output: a list of files whose name contains the keyword provided.

source
get_combined_network(model::IgAbstractParams)

Get combined network from network integration model.

Input

Network integration model after perfrom network_integration!.

Output

Combined network.

source
ModMashup.get_weightsFunction.
get_weights(model::IgAbstractParams)

Get a dictionalry to map network name to its network weights from network integration model.

Input

Network integration model after perfrom network_integration!.

Output

a dictionalry to map network name to its network weights.

source
ModMashup.get_scoreFunction.
get_score(model::LabelPropagation)

Arguments

model::LabelPropagation: Label propagation model.

Outputs

score::Dict{String, Float64}: A dictionary maps patients' name to their score.

Pick up score from model after label propagation.

source