-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCARPcls.R
44 lines (39 loc) · 1.41 KB
/
CARPcls.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
#####################################################################################
########## Script containing definition of classes used in CARP programm ###########
# Marie Zufferey - UNIL - December 2015 #############################################
# License: Open Source AGPL v3 ######################################################
#####################################################################################
loading <- try(library("methods", verbose=F))
if(class(loading)=="try-error"){
loading2 <- try(install.packages("methods", verbose=F))
if(class(loading2)=="try-error"){
stop("\"methods\" package is needed and could not be installed.")
}
}
setClass("genData",
representation(
labels = "character",
type = "character")
)
setMethod("show", "genData",
function(x){
b <- ifelse(x@type=="str", "STR", "sequence")
cat(paste0("Contains ", b, " data used to build recent phylogeny.\n"))
cat(paste0("Individuals: "));cat(x@labels)
if(x@type=="str"){
cat(paste0("\nMarkers: "));cat(x@markers)
}
cat("\n")
}
)
setClass("strData",
representation(
data = "data.frame",
markers = "character"),
contains="genData"
)
setClass("seqData",
representation(
data = 'ANY'),
contains="genData"
)