Description Usage Arguments Value Note Author(s) Examples
This functions takes in a functional module from scPPIN and a countTable for gene reads as a data frame and computes the edge weight for each connection in the functional module and returns a network data frame with edge weights included. Used for creating Cytoscape graphs.
1 | getEdgeWeightsG(FM, countTable)
|
FM |
A scPPIN object that is returned from the function getFM. Used here to generate the network |
countTable |
A data frame containing counts of gene expression for different cell barcodes. Used here to generate edge weights |
returns a functional Modeule (igraph) with weight attribute set for edges based on spearman's correlation
Called by getCyGraphs
Matt Heffernan, University of Illinois at Chicago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
getEdgeWeightsG(FM=FM0, countTable=countTable)
## The function is currently defined as
function(FM, countTable)
{
network <- as.data.frame(get.edgelist(FM))
nEdges <- nrow(network)
i=1
while(i <= nEdges)
{
G1 = network[i,1]
G2 = network[i,2]
G1C <- countTable[G1,]
G2C <- countTable[G2,]
corr <- unname(cor.test(G1C,G2C,method="spearman", exact=FALSE)$estimate)
FM <- set_edge_attr(FM, "weight", index = E(FM, P = c(G1,G2),directed = FALSE), value = corr)
i = i+1
}
return(FM)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.