File: show-methods.r

package info (click to toggle)
r-bioc-tfbstools 1.20.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 920 kB
  • sloc: xml: 1,137; ansic: 590; asm: 54; sh: 13; makefile: 2
file content (87 lines) | stat: -rw-r--r-- 3,189 bytes parent folder | download | duplicates (4)
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

### -----------------------------------------------------------------------
### The "show" method.
###

setMethod("show", "XMatrix",
          function(object){
            cat("An object of class ", class(object), "\n", sep="")
            cat("ID: ", object@ID, "\n", sep="")
            cat("Name: ", object@name, "\n", sep="")
            cat("Matrix Class: ", object@matrixClass, "\n", sep="")
            cat("strand: ", object@strand, "\n", sep="")
            if(is(object, "PWMatrix")){
              cat("Pseudocounts: ", object@pseudocounts, "\n", sep="")
            }
            if(is(object, "ICMatrix")){
              cat("Schneider correction: ", object@schneider, "\n", sep="")
            }
            #for(i in 1:length(object@tags)){
            #  cat(names(object@tags)[i], ": ", object@tags[[i]], "\n", sep="")
            #}
            cat("Tags: \n")
            print(object@tags)
            cat("Background: ", "\n", sep="")
            print(object@bg)
            cat("Matrix: ", "\n", sep="")
  # add the tags later and print pretty
            print(object@profileMatrix)
          }
          )

### -----------------------------------------------------------------
### The "show" method.
###
setMethod("show", "TFFM",
          function(object){
            cat("An object of class ", class(object), "\n", sep="")
            cat("ID: ", object@ID, "\n", sep="")
            cat("Name: ", object@name, "\n", sep="")
            cat("Matrix Class: ", object@matrixClass, "\n", sep="")
            cat("strand: ", object@strand, "\n", sep="")
            cat("Tags: \n")
            print(object@tags)
            cat("Background: ", "\n", sep="")
            print(object@bg)
            cat("Matrix: ", "\n", sep="")
            print(object@profileMatrix)
            cat("TFFM type: ", "\n", sep="")
            print(object@type)
            cat("Emission: ", "\n", sep="")
            print(object@emission)
            cat("Transition: ", "\n", sep="")
            print(object@transition)
          })

### -----------------------------------------------------------------
### The "show" method
### Perhaps it is not a bad idea to show them in gff format.
setMethod("show", "SiteSet",
          function(object){
            cat("An object of class", class(object), "with",
                length(object), "site",
                ifelse(length(object)==1, "sequence", "sequences"))
            cat("\n")
            if(length(object) > 10000)
              object = object[1:10000]
            gff = writeGFF3(object)
            print(gff)
          }
          )


### -----------------------------------------------------------------
### The "show" method
### put them in a extended gff. any good idea?
setMethod("show", "SitePairSet",
          function(object){
            gff1 = writeGFF3(siteset1(object))
            gff2 = writeGFF3(siteset2(object))
            ans = cbind(gff1, gff2)
            cat("An object of class", class(object), "with",
                length(object), "site pair set",
                ifelse(length(object)==1, "sequence", "sequences"))
            cat("\n")
            print(ans)
          }
          )