inst/doc/Biostrings2Classes.R

### R code from vignette source 'Biostrings2Classes.Rnw'

###################################################
### code chunk number 1: a1
###################################################
library(Biostrings)
b <- BString("I am a BString object")
b
length(b)


###################################################
### code chunk number 2: a2
###################################################
d <- DNAString("TTGAAAA-CTC-N")
d
length(d)


###################################################
### code chunk number 3: a3
###################################################
d[3]
d[7:12]
d[]
b[length(b):1]


###################################################
### code chunk number 4: a4
###################################################
bb <- subseq(b, 3, 6)
dd1 <- subseq(d, end=7)
dd2 <- subseq(d, start=8)


###################################################
### code chunk number 5: a5
###################################################
toString(dd2)


###################################################
### code chunk number 6: b1
###################################################
bb == "am a"
dd2 != DNAString("TG")


###################################################
### code chunk number 7: b2
###################################################
cat('> bb == ""')
cat('> d == bb')


###################################################
### code chunk number 8: b3
###################################################
r <- RNAString(d)
r
r == d


###################################################
### code chunk number 9: c1
###################################################
v4 <- Views(dd2, start=3:0, end=5:8)
v4
length(v4)


###################################################
### code chunk number 10: c3
###################################################
v4[4:2]


###################################################
### code chunk number 11: c4
###################################################
v4[[2]]


###################################################
### code chunk number 12: c6
###################################################
cat('> v4[[3]]')
cat(try(v4[[3]], silent=TRUE))


###################################################
### code chunk number 13: c7
###################################################
v4[-3]
v4[c(TRUE, FALSE)]


###################################################
### code chunk number 14: d1
###################################################
v12 <- Views(DNAString("TAATAATG"), start=-2:9, end=0:11)


###################################################
### code chunk number 15: d2
###################################################
as(d, "Views")


###################################################
### code chunk number 16: d3
###################################################
as(d, "Views")[[1]]


###################################################
### code chunk number 17: d4
###################################################
v12[0]
v12[FALSE]
Views(d)


###################################################
### code chunk number 18: e1
###################################################
v12 == DNAString("TAA")


###################################################
### code chunk number 19: e2
###################################################
v12[v12 == v12[4]]
v12[v12 == v12[1]]


###################################################
### code chunk number 20: e2
###################################################
v12[3] == Views(RNAString("AU"), start=0, end=2)


###################################################
### code chunk number 21: f1
###################################################
start(v4)
end(v4)
width(v4)

Try the Biostrings package in your browser

Any scripts or data that you put into this service are public.

Biostrings documentation built on Nov. 8, 2020, 11:12 p.m.