Skip to content

Commit

Permalink
makeNetworks added
Browse files Browse the repository at this point in the history
  • Loading branch information
dosorio committed Oct 2, 2019
1 parent 5328db1 commit 7e0b5f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(installPyDependencies)
export(makeNetworks)
export(manifoldAlignment)
export(pcNet)
export(tensorDecomposition)
Expand Down
17 changes: 17 additions & 0 deletions R/makeNetworks.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' @export makeNetworks
#' @importFrom Matrix Matrix
makeNetworks <- function(X, nNet = 10, nCells = 1000, nComp = 3, scaleScores = TRUE, symmetric = FALSE, q = 0.95){
sapply(seq_len(nNet), function(W){
Z <- sample(x = colnames(X), size = nCells, replace = TRUE)
Z <- as.matrix(X[,Z])
Z <- Z[apply(Z,1,sum) > 0,]
Z <- pcNet(Z, nCom = nComp, scaleScores = scaleScores, symmetric = symmetric, q = q)
geneList <- rownames(X)
nGenes <-length(geneList)
O <- matrix(data = 0, nrow = nGenes, ncol = nGenes)
rownames(O) <- colnames(O) <- geneList
O[rownames(Z), colnames(Z)] <- as.matrix(Z)
O <- Matrix::Matrix(O)
return(O)
})
}

0 comments on commit 7e0b5f4

Please sign in to comment.