/
Cascade-package.R
161 lines (142 loc) · 5.74 KB
/
Cascade-package.R
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#' @title The Cascade Package: Selection, Reverse-Engineering and Prediction in Cascade Networks
#'
#' @description A modeling tool allowing gene selection, reverse engineering, and prediction in cascade networks. Jung, N., Bertrand, F., Bahram, S., Vallat, L., and Maumy-Bertrand, M. (2014) <doi:10.1093/bioinformatics/btt705>.
#'
#' @docType package
#' @name Cascade-package
#' @aliases Cascade-package Cascade
#' @author This package has been written by Frédéric Bertrand, Myriam
#' Maumy-Bertrand and Nicolas Jung with biological insights from Laurent
#' Vallat. Maintainer: Frédéric Bertrand <frederic.bertrand@@math.unistra.fr>
#'
#' @references Jung, N., Bertrand, F., Bahram, S., Vallat, L., and
#' Maumy-Bertrand, M. (2014). Cascade: a R-package to study, predict and
#' simulate the diffusion of a signal through a temporal gene network.
#' \emph{Bioinformatics}, btt705.
#'
#' Vallat, L., Kemper, C. A., Jung, N., Maumy-Bertrand, M., Bertrand, F.,
#' Meyer, N., ... & Bahram, S. (2013). Reverse-engineering the genetic
#' circuitry of a cancer cell with predicted intervention in chronic
#' lymphocytic leukemia. \emph{Proceedings of the National Academy of
#' Sciences}, 110(2), 459-464.
#' @keywords package
#'
#' @importFrom VGAM rlaplace rpareto zeta
#' @importFrom grDevices col2rgb colorRamp dev.new grey rainbow rgb
#' @importFrom graphics abline hist legend lines matplot par rect text
#' @importFrom methods new
#' @importFrom stats aggregate cor lm loess model.matrix quantile rbinom reshape rmultinom rnorm runif var wilcox.test
#' @importFrom utils sessionInfo
#' @importFrom cluster agnes
#' @importFrom animation ani.options saveHTML
#' @importFrom abind abind
#' @import grid
#' @import igraph
#' @import lattice
#' @import limma
#' @import magic
#' @import nnls
#' @import splines
#' @import stats4
#' @import survival
#' @import tnet
#'
NULL
setGeneric("geneSelection",package="Cascade",def = function(x,y,tot.number,... ){standardGeneric("geneSelection")})
setGeneric("genePeakSelection",package="Cascade",def = function(x,peak,... ){standardGeneric("genePeakSelection")})
setGeneric("unionMicro",package="Cascade",def = function(M1,M2 ){standardGeneric("unionMicro")})
setGeneric("position",package="Cascade",def = function(net,... ){standardGeneric("position")})
setGeneric("geneNeighborhood",package="Cascade",def = function(net,targets,... ){standardGeneric("geneNeighborhood")})
setGeneric("evolution",package="Cascade",def = function(net,list_nv,... ){standardGeneric("evolution")})
setGeneric("inference",package="Cascade",def = function(M,... ){standardGeneric("inference")})
setGeneric("cutoff",package="Cascade",def = function(Omega,... ){standardGeneric("cutoff")})
setGeneric("analyze_network",package="Cascade",def = function(Omega,nv,...){standardGeneric("analyze_network")})
#setGeneric("predict",def = function(object,...){standardGeneric("predict")})
setGeneric("gene_expr_simulation",package="Cascade",def = function(network,...){standardGeneric("gene_expr_simulation")})
setGeneric("compare",package="Cascade",def = function(Net,Net_inf,nv){standardGeneric("compare")})
#' Class \code{"micro_array"}
#'
#' The \code{"micro_array"} class
#'
#'
#' @name micro_array-class
#' @docType class
#' @section Objects from the Class: Objects can be created by calls of the form
#' \code{new("micro_array", ...)}. %% ~~ describe objects here ~~
#' @keywords classes
#' @examples
#'
#' showClass("micro_array")
#'
#' @export
setClass(
Class = "micro_array",
representation(
microarray = "matrix",
name = "vector",
group = c("vector", NULL),
start_time = c("vector", NULL),
time = c("vector", NULL),
subject = "numeric"
),
prototype = prototype(group = 0, start_time = 0),
validity = function(object) {
if(dim(object@microarray)[2] != length(object@time)*object@subject){
stop("[Error: ]Number of colomns must be equal to the number of time points * the number of subject")
}
if(dim(object@microarray)[1] != length(object@name)&&length(object@name)!=0){
stop("[Error: ] Length of the vector of names must equal to the number of genes")
}
if(dim(object@microarray)[1] != length(object@group)&&length(object@group)!=1){
print(object@group)
stop("[Error: ] Length of the vector of group must equal to the number of genes or null")
}
if(dim(object@microarray)[1] != length(object@start_time)&&length(object@start_time)!=1){
stop("[Error: ] Length of the vector of starting time must equal to the number of genes or null")
}
if(object@subject<1){
stop("[Error: ] There must be at least one subject")
}
}
)
#' Class \code{"network"}
#'
#' The \code{"network"} class
#'
#'
#' @name network-class
#' @docType class
#' @section Objects from the Class: Objects can be created by calls of the form
#' \code{new("network", ...)}. %% ~~ describe objects here ~~
#' @keywords classes
#' @examples
#'
#' showClass("network")
#'
#' @export
setClass(Class = "network",
representation(network="matrix",name="vector",F="array",convF="matrix",convO="vector",time_pt="vector")
)
#' Class \code{"micropredict"}
#'
#' The \code{"micropredict"} class
#'
#'
#' @name micropredict-class
#' @docType class
#' @section Objects from the Class: Objects can be created by calls of the form
#' \code{new("micropredict", ...)}.
#' @keywords classes
#' @examples
#'
#' showClass("micropredict")
#'
#' @export
setClass(Class = "micropredict",
representation(microarray_unchanged="micro_array"
,microarray_changed="micro_array"
,microarray_predict="micro_array"
,nv="numeric"
,network="network"
,targets="numeric")
)