dRWRcontact
is supposed to estimate sample relationships (ie.
contact strength between samples) from an input genesample matrix, an
input graph and its affinity matrix precomputed according to random
walk restart (RWR) of the input graph. It includes: 1) RWRsmoothed
columns of input genesample matrix based on the precomputed affinity
matrix; 2) calculation of contact strength (inner products of
RWRsmooth columns of input genesample matrix); 3) estimation of the
contact signficance by a randomalisation procedure. Parallel computing
is also supported for Linux or Mac operating systems.
1 2 3 4 
data 
an input genesample data matrix used for seeds. Each value in input genesample matrix does not necessarily have to be binary (nonzeros will be used as a weight, but should be nonnegative for easy interpretation). 
g 
an object of class "igraph" or "graphNEL" 
Amatrix 
an affinity matrix precomputed from the input graph. Notes: columns for starting nodes walking from, and rows for ending nodes walking to 
permutation 
how to do permutation. It can be 'degree' for degreepreserving permutation, 'random' for permutation purely in random 
num.permutation 
the number of permutations used to for generating the distribution of contact strength under randomalisation 
p.adjust.method 
the method used to adjust pvalues. It can be one of "BH", "BY", "bonferroni", "holm", "hochberg" and "hommel". The first two methods "BH" (widely used) and "BY" control the false discovery rate (FDR: the expected proportion of false discoveries amongst the rejected hypotheses); the last four methods "bonferroni", "holm", "hochberg" and "hommel" are designed to give strong control of the familywise error rate (FWER). Notes: FDR is a less stringent condition than FWER 
adjp.cutoff 
the cutoff of adjusted pvalue to construct the contact graph 
parallel 
logical to indicate whether parallel computation with
multicores is used. By default, it sets to true, but not necessarily
does so. It will depend on whether these two packages "foreach" and
"doParallel" have been installed. It can be installed via:

multicores 
an integer to specify how many cores will be registered as the multicore parallel backend to the 'foreach' package. If NULL, it will use a half of cores available in a user's computer. This option only works when parallel computation is enabled 
verbose 
logical to indicate whether the messages will be displayed in the screen. By default, it sets to true for display 
an object of class "dContact", a list with following components:
ratio
: a symmetric matrix storing ratio (the observed
against the expected) between pairwise samples
zscore
: a symmetric matrix storing zscore between pairwise
samples
pval
: a symmetric matrix storing pvalue between pairwise
samples
adjpval
: a symmetric matrix storing adjusted pvalue
between pairwise samples
cgraph
: the constructed contact graph (as a 'igraph'
object) under the cutoff of adjusted value
call
: the call that produced this result
none
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  ## Not run:
# 1) generate a random graph according to the ER model
g < erdos.renyi.game(100, 1/100)
# 2) produce the induced subgraph only based on the nodes in query
subg < dNetInduce(g, V(g), knn=0)
V(subg)$name < 1:vcount(subg)
# 3) precompute affinity matrix from the input graph
Amatrix < dRWR(g=subg, parallel=FALSE)
# 4) estimate RWRbased sample relationships
# define sets of seeds as data
# each seed with equal weight (i.e. all nonzero entries are '1')
aSeeds < c(1,0,1,0,1)
bSeeds < c(0,0,1,0,1)
data < data.frame(aSeeds,bSeeds)
rownames(data) < 1:5
# calcualte their two contacts
dContact < dRWRcontact(data=data, g=subg, Amatrix=Amatrix,
parallel=FALSE)
dContact
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.