This functions takes a vector path object from a list of path objects, usually output from an igraph path trace. This vector is comprised of vertex numbered numeric vector with gene names comprising the vector namespace. These names are matched to a weights vector comprised of gene weights and a namespace of gene names. The frist and last gene of the trace are droped as they are the start and end of all traces in the trace object. the mean score of the path is returned unless the mean score is equal to or less than zero or NA.
path_calc(indv_path, weights)
indv_path | an indv path |
---|---|
weights | the omics scores as a gene-named vector |
mean score of the path trace input without the starting and ending gene
example_path <- list( c('319', "49", "23", "86", "690", "238", "102") ) names(example_path[[1]]) <- c( "GeneA","GeneZ", "GeneAlpha", "GeneB", "GeneX", "GeneOmega" ) sampweights <- c(1.45, 2.45, 0.89, .003, 1.3, 2.1) names(sampweights) <- c( "GeneA","GeneZ", "GeneAlpha", "GeneB", "GeneX", "GeneOmega" ) path_calc(example_path[[1]], sampweights)#> [1] 1.3486