| Title: | CBN2Path: an R/Bioconductor package for the analysis of cancer progression pathways using Conjunctive Bayesian Networks |
|---|---|
| Description: | CBN2Path package provides a unifying interface to facilitate CBN-based quantification, analysis and visualization of cancer progression pathways. |
| Authors: | William Choi-Kim [aut, cre], Sayed-Rzgar Hosseini [aut, cre] |
| Maintainer: | William Choi-Kim <[email protected]>, Sayed-Rzgar Hosseini <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.3.0 |
| Built: | 2026-05-29 08:31:40 UTC |
| Source: | https://github.com/bioc/CBN2Path |
base2Indexing
base2Indexing(mat)base2Indexing(mat)
mat |
A given poset represented by a binary matrix (in B-CBN) |
#Poset weight vectors based on the frequency of occurrence in the BCBN MCMC-sampling scheme.
set.seed(100) mat <- matrix(sample(c(0, 1), 16, replace = TRUE), 4, 4) base2Indexing(mat)set.seed(100) mat <- matrix(sample(c(0, 1), 16, replace = TRUE), 4, 4) base2Indexing(mat)
base2IndVec
base2IndVec(vec)base2IndVec(vec)
vec |
a binary genotype vector |
a number used for indexing a given genotype
vec <- c(0, 1, 0, 1) base2IndVec(vec)vec <- c(0, 1, 0, 1) base2IndVec(vec)
B-CBN
bcbn( data = defaultData(), nSamples = 25000, theta = 0, epsilon = 0.05, nChains = 4, thin = 10, maxL = 1000, nCores = 1, progressBar = FALSE )bcbn( data = defaultData(), nSamples = 25000, theta = 0, epsilon = 0.05, nChains = 4, thin = 10, maxL = 1000, nCores = 1, progressBar = FALSE )
data |
Generated data |
nSamples |
Number of samples <def: 25000> |
theta |
Theta <def: 0> |
epsilon |
Epsilon <def: 0.05> |
nChains |
N-Chains <def: 4> |
thin |
Thin <def: 10> |
maxL |
The maximum number of iteration <def: 1000> |
nCores |
Number of parallelized cores <def: 1> |
progressBar |
Print out progress bar; default is FALSE |
A matrix
bcbn()bcbn()
CT-CBN
ctcbn( datasets, bootstrapSamples = 0, randomSeed = 1, samplingRate = 1, epsilon = 2, numDrawnSamples = 0, numEmRuns = 1, nCores = 1, progressBar = FALSE )ctcbn( datasets, bootstrapSamples = 0, randomSeed = 1, samplingRate = 1, epsilon = 2, numDrawnSamples = 0, numEmRuns = 1, nCores = 1, progressBar = FALSE )
datasets |
Vector of |
bootstrapSamples |
Number of bootstrap samples (requires |
randomSeed |
Random seed. |
samplingRate |
Sampling rate. |
epsilon |
If between 0 and 1, the fraction of violations allowed per edge. If negative, the interval 0 to 0.5 will be sampled equidistantly with N points and the output |
numDrawnSamples |
If > 0, the number of samples to draw from the model. If zero (default), the model will be learned from data. |
numEmRuns |
Number of em runs. |
nCores |
Maximum number of threads to use to parallelize. |
progressBar |
Print out progress bar; default is FALSE |
A matrix of results.
examplePath <- getExamples()[3] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) ctcbn(bc) ctcbn(c(bc, bc, bc))examplePath <- getExamples()[3] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) ctcbn(bc) ctcbn(c(bc, bc, bc))
CT-CBN Single Batch
ctcbnSingle( dataset, bootstrapSamples = 0, randomSeed = 1, samplingRate = 1, epsilon = 2, numDrawnSamples = 0, numEmRuns = 1 )ctcbnSingle( dataset, bootstrapSamples = 0, randomSeed = 1, samplingRate = 1, epsilon = 2, numDrawnSamples = 0, numEmRuns = 1 )
dataset |
|
bootstrapSamples |
Number of bootstrap samples (requires |
randomSeed |
Random seed. |
samplingRate |
Sampling rate. |
epsilon |
If between 0 and 1, the fraction of violations allowed per edge. If negative, the interval 0 to 0.5 will be sampled equidistantly with N points and the output |
numDrawnSamples |
If > 0, the number of samples to draw from the model. If zero (default), the model will be learned from data. |
numEmRuns |
Number of em runs. |
A list of output data.
examplePath <- getExamples()[1] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) ctcbnSingle(bc)examplePath <- getExamples()[1] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) ctcbnSingle(bc)
edgeMarginalized
edgeMarginalized(pathProb, x)edgeMarginalized(pathProb, x)
pathProb |
The pathway probabilities returned in the step 3 of the R-CBN algorithm |
x |
The number of mutations to consider |
returns the marginal probability of all the potential edges
dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x) edgeMarginalized(pathP, x)dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x) edgeMarginalized(pathP, x)
Generate Data
generateData(poset, theta, eps, n)generateData(poset, theta, eps, n)
poset |
Poset matrix |
theta |
Vector of theta values |
eps |
Epsilon |
n |
N |
A matrix
poset <- matrix(0, 10, 10) poset[1, 2] <- 1 poset[2, 3] <- 1 poset[3, 4] <- 1 poset[5, 4] <- 1 poset[6, 7] <- 1 poset[8, 9] <- 1 poset[8, 10] <- 1 poset[6, 9] <- 1 tr <- transitiveClosure(poset) theta <- c(0.8, 0.7, 0.6, 0.7, 0.4, 0.25, 0.6, 0.75, 0.5, 0.2) eps <- 0.1 n <- 400 generateData(tr, theta, eps, n)poset <- matrix(0, 10, 10) poset[1, 2] <- 1 poset[2, 3] <- 1 poset[3, 4] <- 1 poset[5, 4] <- 1 poset[6, 7] <- 1 poset[8, 9] <- 1 poset[8, 10] <- 1 poset[6, 9] <- 1 tr <- transitiveClosure(poset) theta <- c(0.8, 0.7, 0.6, 0.7, 0.4, 0.25, 0.6, 0.75, 0.5, 0.2) eps <- 0.1 n <- 400 generateData(tr, theta, eps, n)
generateMatrixGenotypes
generateMatrixGenotypes(g)generateMatrixGenotypes(g)
g |
genotype length |
a genotype matrix with ncol=g and nrow=2^g
generateMatrixGenotypes(4)generateMatrixGenotypes(4)
Generate TCGA Genotype Matrix
generateTCGAMatrix( rawData = suppressMessages(getRawTCGAData("TCGA-BLCA")), genes = c("TP53", "ARID1A", "KDM6A", "PIK3CA", "RB1", "EP300", "FGFR3", "CREBBP", "STAG2", "ATM") )generateTCGAMatrix( rawData = suppressMessages(getRawTCGAData("TCGA-BLCA")), genes = c("TP53", "ARID1A", "KDM6A", "PIK3CA", "RB1", "EP300", "FGFR3", "CREBBP", "STAG2", "ATM") )
rawData |
Raw TCGA data generated using |
genes |
Genes to generate genotype matrix on |
A genotype matrix where each row is a patient and each column is a gene
generateTCGAMatrix(rawData = data.frame()) # generateTCGAMatrix()generateTCGAMatrix(rawData = data.frame()) # generateTCGAMatrix()
genotypeFeasibility
genotypeFeasibility(genotypes, dag, x)genotypeFeasibility(genotypes, dag, x)
genotypes |
the full set of potential binary genotypes of a given length. |
dag |
matrix representing the DAG of restrictions. |
x |
the number of mutations considered. |
a binary vector, which indicates feasibility or infeasibility of a set of genotypes
geno4 <- generateMatrixGenotypes(4) dag <- matrix(c(4, 4, 4, 1, 2, 3), 3, 2) x <- 4 genoF4 <- genotypeFeasibility(geno4, dag, x)geno4 <- generateMatrixGenotypes(4) dag <- matrix(c(4, 4, 4, 1, 2, 3), 3, 2) x <- 4 genoF4 <- genotypeFeasibility(geno4, dag, x)
genotypeMatrixMutator
genotypeMatrixMutator(mat, fp, fn)genotypeMatrixMutator(mat, fp, fn)
mat |
The genotype matrix including sampled genotypes, which need to be mutated. |
fp |
False positive rate |
fn |
False negative rate |
The mutated version of the genotype matrix
set.seed(100) gMat <- matrix(sample(c(0, 1), 800, replace = TRUE), 200, 4) gMatMut <- genotypeMatrixMutator(gMat, 0.2, 0.2)set.seed(100) gMat <- matrix(sample(c(0, 1), 800, replace = TRUE), 200, 4) gMatMut <- genotypeMatrixMutator(gMat, 0.2, 0.2)
Get paths to examples
getExamples()getExamples()
A vector of paths
getExamples()getExamples()
Get Raw TCGA Data
getRawTCGAData(project)getRawTCGAData(project)
project |
TCGA project ID; pass "help" to see list of all project IDs |
data frame of TCGA data for given project
getRawTCGAData("help")getRawTCGAData("help")
H-CBN
hcbn( datasets, anneal = FALSE, temp = 0, annealingSteps = 0, epsilon = 2, nCores = 1, progressBar = FALSE )hcbn( datasets, anneal = FALSE, temp = 0, annealingSteps = 0, epsilon = 2, nCores = 1, progressBar = FALSE )
datasets |
Vector of |
anneal |
If |
temp |
Temperature of simulated annealing. |
annealingSteps |
Number of simulated annealing steps. |
epsilon |
Value of eps for CT-CBN model selection. Requires both pattern and lambda data in input |
nCores |
Maximum number of threads to use to parallelize. |
progressBar |
Print out progress bar; default is FALSE |
A matrix of results.
examplePath <- getExamples()[3] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) hcbn(bc) hcbn(c(bc, bc, bc))examplePath <- getExamples()[3] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) hcbn(bc) hcbn(c(bc, bc, bc))
H-CBN Single Batch
hcbnSingle( datasetObj, anneal = FALSE, temp = 0, annealingSteps = 0, epsilon = 2 )hcbnSingle( datasetObj, anneal = FALSE, temp = 0, annealingSteps = 0, epsilon = 2 )
datasetObj |
|
anneal |
If |
temp |
Temperature of simulated annealing. |
annealingSteps |
Number of simulated annealing steps. |
epsilon |
Value of eps for CT-CBN model selection. Requires both pattern and lambda data in input |
A list of output data.
examplePath <- getExamples()[1] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) hcbnSingle(bc)examplePath <- getExamples()[1] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) ) hcbnSingle(bc)
jensenShannonDivergence
jensenShannonDivergence(prob1, prob2)jensenShannonDivergence(prob1, prob2)
prob1 |
The first (discrete) probability distribution (vector) |
prob2 |
The second (discrete) probability distribution (vector) |
Jensen Shannon Divergence between the two (discrete) probability distributions
set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathCT <- pathProbQuartetCTCBN(gMat) pathH <- pathProbQuartetHCBN(gMat) jensenShannonDivergence(pathCT, pathH)set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathCT <- pathProbQuartetCTCBN(gMat) pathH <- pathProbQuartetHCBN(gMat) jensenShannonDivergence(pathCT, pathH)
pathEdgeMapper
pathEdgeMapper(x)pathEdgeMapper(x)
x |
number of mutations to consider |
Pathway to edge compatibility matrix, each element of which indicates whether a given edge is included in the transitive closure of a given pathway (1) or not (0).
peMap <- pathEdgeMapper(4)peMap <- pathEdgeMapper(4)
pathNormalization
pathNormalization(pathProb, x)pathNormalization(pathProb, x)
pathProb |
The pathway probabilities returned in the step 3 of the R-CBN algorithm |
x |
The number of mutations to consider |
The updated pathway probabilities (the step 5 of the R-CBN algorithm)
dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x) pathN <- pathNormalization(pathP, x)dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x) pathN <- pathNormalization(pathP, x)
pathProbCBN: quantifies pathway probabilities using the output of CT-CBN or H-CBN
pathProbCBN(dag, lambda, x)pathProbCBN(dag, lambda, x)
dag |
matrix representing the DAG of restrictions. |
lambda |
the lambda values, which are produced by the CBN model. |
x |
the number of mutations considered. |
vector of probabilities assigned to all potential pathways of length x
dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x)dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x)
pathProbQuartetBCBN
pathProbQuartetBCBN(gMat)pathProbQuartetBCBN(gMat)
gMat |
The n by 4 binary genotype matrix representing a given quartet for a sample of n genotypes. |
The probability distribution (returned by the B-CBN model), which is represented as a vector of length 24.
set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetBCBN(gMat)set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetBCBN(gMat)
pathProbQuartetCTCBN
pathProbQuartetCTCBN(gMat)pathProbQuartetCTCBN(gMat)
gMat |
The n by 4 binary genotype matrix representing a given quartet for a sample of n genotypes. |
The probability distribution (returned by the CT-CBN model), which is represented as a vector of length 24.
set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetCTCBN(gMat)set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetCTCBN(gMat)
pathProbQuartetHCBN
pathProbQuartetHCBN(gMat)pathProbQuartetHCBN(gMat)
gMat |
The n by 4 binary genotype matrix representing a given quartet for a sample of n genotypes. |
The probability distribution (returned by the H-CBN model), which is represented as a vector of length 24.
set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetHCBN(gMat)set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetHCBN(gMat)
pathProbQuartetRCBN
pathProbQuartetRCBN(gMat)pathProbQuartetRCBN(gMat)
gMat |
The n by 4 binary genotype matrix representing a given quartet for a sample of n genotypes. |
The probability distribution (returned by the R-CBN model), which is represented as a vector of length 24
set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetRCBN(gMat)set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathProbQuartetRCBN(gMat)
pathProbSSWM
pathProbSSWM(fitness, x)pathProbSSWM(fitness, x)
fitness |
A vector of length 2^x, each element of which representing the fitness assigned to one of the 2^x genotypes. |
x |
The number of mutations considered. |
vector of probabilities assigned to all potential pathways of length x
f <- c(0, 0.1, 0.2, 0.1, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0, 0.6, 0.4, 0.3, 0.2, 1) x <- 4 pathP <- pathProbSSWM(f, x)f <- c(0, 0.1, 0.2, 0.1, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0, 0.6, 0.4, 0.3, 0.2, 1) x <- 4 pathP <- pathProbSSWM(f, x)
pathwayCompatibilityQuartet
pathwayCompatibilityQuartet(gMat)pathwayCompatibilityQuartet(gMat)
gMat |
The n by 4 binary genotype matrix representing a given quartet for a sample of n genotypes. |
The compatibility score, which is represented as a vector of length 24, each element of which corresponds to one of the 24 pathways of length 4.
set.seed(100) gMat <- matrix(sample(c(0, 1), 800, replace = TRUE), 200, 4) pathwayCompatibilityQuartet(gMat)set.seed(100) gMat <- matrix(sample(c(0, 1), 800, replace = TRUE), 200, 4) pathwayCompatibilityQuartet(gMat)
pathwayFeasibility
pathwayFeasibility(dag, x)pathwayFeasibility(dag, x)
dag |
matrix representing the DAG of restrictions. |
x |
the number of mutations considered. |
a binary vector, which indicates feasibility or infeasibility of a set of pathways
dag <- matrix(c(4, 4, 4, 1, 2, 3), 3, 2) x <- 4 pathwayFeasibility(dag, x)dag <- matrix(c(4, 4, 4, 1, 2, 3), 3, 2) x <- 4 pathwayFeasibility(dag, x)
pathwayGenotypeCompatibility
pathwayGenotypeCompatibility(pathway, genotype)pathwayGenotypeCompatibility(pathway, genotype)
pathway |
a vector representing the given pathway. |
genotype |
a binary vector representing the given genotype. |
returns 1 (if the given genotype is compatible with the given pathway), and 0 otherwise
geno1 <- c(1, 0, 1, 0) geno2 <- c(1, 1, 0, 0) path <- c(1, 2, 3, 4) pathwayGenotypeCompatibility(path, geno1) pathwayGenotypeCompatibility(path, geno2)geno1 <- c(1, 0, 1, 0) geno2 <- c(1, 1, 0, 0) path <- c(1, 2, 3, 4) pathwayGenotypeCompatibility(path, geno1) pathwayGenotypeCompatibility(path, geno2)
pathwayWeightingRCBN
pathwayWeightingRCBN(edgeProb, peMap)pathwayWeightingRCBN(edgeProb, peMap)
edgeProb |
Marginal edge probabilities |
peMap |
Pathway-edge compatibility matrix |
The pathway weights (step 4 of the R-CBN algorithm)
dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x) edgeProb <- edgeMarginalized(pathP, x) peMap <- pathEdgeMapper(4) pathwayWeightingRCBN(edgeProb, peMap)dag <- matrix(c(2, 2, 4, 1, 3, 3), 3, 2) lambda <- c(1, 4, 3, 2.5, 2) x <- 4 pathP <- pathProbCBN(dag, lambda, x) edgeProb <- edgeMarginalized(pathP, x) peMap <- pathEdgeMapper(4) pathwayWeightingRCBN(edgeProb, peMap)
permutations
permutations(n, r, v = 1:n, set = TRUE, repeatsAllowed = FALSE)permutations(n, r, v = 1:n, set = TRUE, repeatsAllowed = FALSE)
n |
total number of elements in the set |
r |
subset size |
v |
1:n |
set |
Logical flag indicating whether duplicates should be removed from the source vector v. Defaults to TRUE. |
repeatsAllowed |
Logical flag indicating whether the constructed vectors may include duplicated values. Defaults to FALSE. |
a matrix with (n!/(n-r)!) rows and r columns
perm <- permutations(4, 4)perm <- permutations(4, 4)
posetWeightingRCBN
posetWeightingRCBN(vec)posetWeightingRCBN(vec)
vec |
The likelihood vector corresponding to a given set of posets |
The poset weight vector determined using the reciprocal ranking method
set.seed(100) logLik <- runif(219) w1 <- posetWeightingRCBN(logLik)set.seed(100) logLik <- runif(219) w1 <- posetWeightingRCBN(logLik)
predictability
predictability(prob, x)predictability(prob, x)
prob |
Pathway probability vector |
x |
The length of genotype vectors |
predictability
set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathCT <- pathProbQuartetCTCBN(gMat) pathH <- pathProbQuartetHCBN(gMat) predC <- predictability(pathCT, 4) predictability(pathH, 4)set.seed(100) gMat <- matrix(sample(c(0, 1), 12, replace = TRUE), 3, 4) pathCT <- pathProbQuartetCTCBN(gMat) pathH <- pathProbQuartetHCBN(gMat) predC <- predictability(pathCT, 4) predictability(pathH, 4)
Read a .lambda file
readLambda(fileStem)readLambda(fileStem)
fileStem |
The filename of the .lambda file without the .lambda suffix. |
A matrix.
bcPath <- getExamples()[1] readLambda(bcPath)bcPath <- getExamples()[1] readLambda(bcPath)
Read a .pat file
readPattern(fileStem)readPattern(fileStem)
fileStem |
The filename of the .pat file without the .pat suffix. |
A matrix.
bcPath <- getExamples()[1] readPattern(bcPath)bcPath <- getExamples()[1] readPattern(bcPath)
Read a .poset file
readPoset(fileStem)readPoset(fileStem)
fileStem |
The filename of the .poset file without the .poset suffix. |
A list containing the number of mutations and a matrix.
bcPath <- getExamples()[1] readPoset(bcPath)bcPath <- getExamples()[1] readPoset(bcPath)
Read a .time file
readTime(fileStem)readTime(fileStem)
fileStem |
The filename of the .time file without the .time suffix. |
A matrix.
bcPath <- getExamples()[1] readPattern(bcPath)bcPath <- getExamples()[1] readPattern(bcPath)
A data class containing poset and pattern/lambda matrices.
Use the read_ methods to feed data from files.
a Spock object
posetPoset matrix.
numMutationsNumber of mutations.
genotypeMatrixGenotype matrix.
lambdaLambda list.
new()
Create a new Spock object.
Spock$new(poset, numMutations, genotypeMatrix, lambda = NULL)
posetPoset matrix or list of poset matrices.
numMutationsNumber of mutations.
genotypeMatrixGenotype matrix.
lambdaLambda list.
A new Spock object.
getSize()
Get the number of posets.
Spock$getSize()
Number of posets.
getPoset()
Write poset data to a tempfile.
Spock$getPoset(index = 1)
indexIndex of poset.
File path to tempfile.
getSecond()
Write pattern/lambda data to a tempfile.
Spock$getSecond(n)
nNumber of drawn samples.
File path to tempfile.
getPattern()
Write pattern data to a tempfile.
Spock$getPattern()
File path to tempfile.
getLambda()
Write lambda data to a tempfile.
Spock$getLambda()
File path to tempfile.
show()
Print summary information to console.
Spock$show(verbose = FALSE)
verboseMethod prints contents as well as dimensions to console if TRUE.
Nothing.
clone()
The objects of this class are cloneable with this method.
Spock$clone(deep = FALSE)
deepWhether to make a deep clone.
examplePath <- getExamples()[1] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) )examplePath <- getExamples()[1] bc <- Spock$new( poset = readPoset(examplePath)$sets, numMutations = readPoset(examplePath)$mutations, genotypeMatrix = readPattern(examplePath) )
Transitive Closure
transitiveClosure(poset)transitiveClosure(poset)
poset |
Poset matrix |
Poset matrix
poset <- matrix(0, 10, 10) poset[1, 2] <- 1 poset[2, 3] <- 1 poset[3, 4] <- 1 poset[5, 4] <- 1 poset[6, 7] <- 1 poset[8, 9] <- 1 poset[8, 10] <- 1 poset[6, 9] <- 1 transitiveClosure(poset)poset <- matrix(0, 10, 10) poset[1, 2] <- 1 poset[2, 3] <- 1 poset[3, 4] <- 1 poset[5, 4] <- 1 poset[6, 7] <- 1 poset[8, 9] <- 1 poset[8, 10] <- 1 poset[6, 9] <- 1 transitiveClosure(poset)
Visualize CBN Model
visualizeCBNModel( poset, nodeColor = "darkgreen", numNodes = max(4, max(poset)) )visualizeCBNModel( poset, nodeColor = "darkgreen", numNodes = max(4, max(poset)) )
poset |
Poset object to visualize |
nodeColor |
Color of nodes in resulting graph |
numNodes |
Number of nodes (default is the larger number between 4 and the largest index given in the poset) |
Plot (gg object) visualization of CBN model
poset <- readPoset(getExamples()[1]) visualizeCBNModel(poset$sets)poset <- readPoset(getExamples()[1]) visualizeCBNModel(poset$sets)
Visualize Fitness Landscape
visualizeFitnessLandscape( fitness, selectNodes = NULL, nGenes = 4, lowColor = "white", highColor = "blue" )visualizeFitnessLandscape( fitness, selectNodes = NULL, nGenes = 4, lowColor = "white", highColor = "blue" )
fitness |
Fitness vectors for each genotype provided in selectNodes or for all genotypes if none selected |
selectNodes |
Select genotypes to visualize |
nGenes |
Length of each genotype |
lowColor |
Color for wild type genotype |
highColor |
Color for fully mutated genotype |
Plot (gg object) visualization of fitness landscape
genotypes <- c( "0000", "1000", "0100", "0010", "0001", "1100", "1010", "1001", "0110", "0101", "0011", "1110", "1101", "1011", "0111", "1111" ) # colIntensity <- c(0, rep(0.25, 4), rep(0.5, 6), rep(0.75, 4), 1) visualizeFitnessLandscape(colIntensity)genotypes <- c( "0000", "1000", "0100", "0010", "0001", "1100", "1010", "1001", "0110", "0101", "0011", "1110", "1101", "1011", "0111", "1111" ) # colIntensity <- c(0, rep(0.25, 4), rep(0.5, 6), rep(0.75, 4), 1) visualizeFitnessLandscape(colIntensity)
Visualize Pathway Probabilities
visualizeProbabilities( probabilities, outputFile = NULL, geneNames = as.character(1:inverseFactorial(length(probabilities))), geneColors = rainbow(length(geneNames), v = 0.5), columnTitles = TRUE )visualizeProbabilities( probabilities, outputFile = NULL, geneNames = as.character(1:inverseFactorial(length(probabilities))), geneColors = rainbow(length(geneNames), v = 0.5), columnTitles = TRUE )
probabilities |
List or matrix of probabilities for each pathway (matrix if multiple models) |
outputFile |
File to output to; if none provided, a plot will be returned |
geneNames |
Gene names; if single character, rendered in circles |
geneColors |
Gene colors |
columnTitles |
Include column titles |
Plot or file name
visualizeProbabilities(c(0.05, 0.03, 0.12, 0.04, 0.02, 0, 0.05, 0.04, 0.05, 0.06, 0.04, 0.02, 0.03, 0.02, 0.05, 0.03, 0.01, 0.09, 0.06, 0.04, 0, 0.08, 0.05, 0.02)) visualizeProbabilities(c(0.05, 0.03, 0.12, 0.04, 0.02, 0, 0.05, 0.04, 0.05, 0.06, 0.04, 0.02, 0.03, 0.02, 0.05, 0.03, 0.01, 0.09, 0.06, 0.04, 0, 0.08, 0.05, 0.02), geneNames = c("AAAA", "BBBB", "CCCC", "DDDD")) mat <- matrix(c(0.1, 0.3, 0, 0.2, 0.4, 0, 0.2, 0.2, 0.1, 0, 0.2, 0.3), ncol = 2) visualizeProbabilities(mat, columnTitles = TRUE)visualizeProbabilities(c(0.05, 0.03, 0.12, 0.04, 0.02, 0, 0.05, 0.04, 0.05, 0.06, 0.04, 0.02, 0.03, 0.02, 0.05, 0.03, 0.01, 0.09, 0.06, 0.04, 0, 0.08, 0.05, 0.02)) visualizeProbabilities(c(0.05, 0.03, 0.12, 0.04, 0.02, 0, 0.05, 0.04, 0.05, 0.06, 0.04, 0.02, 0.03, 0.02, 0.05, 0.03, 0.01, 0.09, 0.06, 0.04, 0, 0.08, 0.05, 0.02), geneNames = c("AAAA", "BBBB", "CCCC", "DDDD")) mat <- matrix(c(0.1, 0.3, 0, 0.2, 0.4, 0, 0.2, 0.2, 0.1, 0, 0.2, 0.3), ncol = 2) visualizeProbabilities(mat, columnTitles = TRUE)