This commit is contained in:
hyginn 2017-11-03 15:20:16 -04:00
parent 2b6ca615b9
commit f1e222f4e0

View File

@ -89,7 +89,7 @@ DNAString("AUG") # Error! No "U" in IUPAC DNA codes
x <- readLines("./data/S288C_YDL056W_MBP1_coding.fsa") x <- readLines("./data/S288C_YDL056W_MBP1_coding.fsa")
x <- dbSanitizeSequence(x) x <- dbSanitizeSequence(x)
myDNAseq <- DNAString(x) # takes the nucleotide sequence and converts into a myDNAseq <- DNAString(x) # takes the nucleotide sequence and converts into a
# object of class DNAstring # object of class DNAstring
# Multi FASTA files can be read directly as a "XStringSet) ... # Multi FASTA files can be read directly as a "XStringSet) ...
(myDNASet <- readDNAStringSet("./data/S288C_YDL056W_MBP1_coding.fsa")) (myDNASet <- readDNAStringSet("./data/S288C_YDL056W_MBP1_coding.fsa"))
@ -109,9 +109,9 @@ identical(myDNAseq, Xseq) # ... and indeed the objects are deemed identical.
# == 3.1 Properties ======================================================== # == 3.1 Properties ========================================================
str(myDNAseq) str(myDNAseq)
length(myDNAseq) # This gives you the _number of nucleotides_! length(myDNAseq) # This gives you the _number of nucleotides_!
# By comparison ... # By comparison ...
length(x) # ... is 1: one string only. To get the number of length(x) # ... is 1: one string only. To get the number of
# characters in a string, you need nchar(). # characters in a string, you need nchar().
nchar(x) # However ... nchar(x) # However ...
nchar(myDNAseq) # ... also works. nchar(myDNAseq) # ... also works.
@ -159,7 +159,7 @@ subseq(myDNAseq, start = 1, end = 30)
# RNAstring() and DNAstring() objects compare U and T as equals! # RNAstring() and DNAstring() objects compare U and T as equals!
RNAString("AUGUCUAACCAAAUAUACUCAGCGAGAUAU") == RNAString("AUGUCUAACCAAAUAUACUCAGCGAGAUAU") ==
DNAString("ATGTCTAACCAAATATACTCAGCGAGATAT") DNAString("ATGTCTAACCAAATATACTCAGCGAGATAT")
# == 3.4 Transformations =================================================== # == 3.4 Transformations ===================================================