updateNets: Synchronize patient set in sample table and network table.

Description Usage Arguments Details Value Examples

View source: R/updateNets.R

Description

Synchronize patient set in sample table and network table.

Usage

1
2
3
4
5
6
7
8
9
updateNets(
  p_net,
  pheno_DF,
  writeNewNets = TRUE,
  oldNetDir,
  newNetDir,
  verbose = TRUE,
  ...
)

Arguments

p_net

(matrix) rows are patients, columns are networks. a[i,j] = 1 if patient i occurs in network j, else 0.

pheno_DF

(data.frame) patient ID and STATUS.

writeNewNets

(logical) if TRUE writes new networks to newNetDir.

oldNetDir

(char) path to directory with networks to be updated

newNetDir

(char) path to directory where updated networks are to be written

verbose

(logical) print messages

...

passed to pruneNets()

Details

This function is useful in applications with highly missing data or where each patient contributes data points not present in the others; e.g. networks based on individual patient CNVs, which are highly sparse. In such a scenario, any kind of patient subsetting - for example, limiting to training samples - changes the population of eligible networks for analysis. Networks that no longer have samples, or that have one patient with the neighbour removed, have to be excluded. This function updates networks and patients so that each network contains at least two patients and only patients in networks are retained. In other words, it keeps pheno_DF and p_net in sync.

Value

list with updated p_net and pheno_DF. pheno_DF will contain IDs in the updated p_net. p_net will contain only those networks with 2+ patients and those patients present in 1+ network.

Examples

1
2
3
4
data(npheno)
netDir <- system.file("extdata","example_nets",package="netDx")
netmat <- countPatientsInNet(netDir,dir(netDir,pattern='txt$'), npheno[,1])
x <- updateNets(netmat, npheno,writeNewNets=FALSE)

BaderLab/netDx documentation built on Sept. 26, 2021, 9:13 a.m.