XString-class(Biostrings)
XString-class()所属R语言包:Biostrings
BString objects
BString对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The BString class is a general container for storing a big string (a long sequence of characters) and for making its manipulation easy and efficient.
BString类是为存储大串(长的字符序列)和一般容器,其操作简单,高效。
The DNAString, RNAString and AAString classes are similar containers but with the more biology-oriented purpose of storing a DNA sequence (DNAString), an RNA sequence (RNAString), or a sequence of amino acids (AAString).
DNAString,RNAString和AAString类是类似容器,但更注重生物学与存储(DNAString)的DNA序列,RNA序列(RNAString),或(AAString)氨基酸序列的目的。
All those containers derive directly (and with no additional slots) from the XString virtual class.
所有这些容器派生直接从XString虚拟类(与没有额外的插槽)。
Details
详情----------Details----------
The 2 main differences between an XString object and a standard character vector are: (1) the data stored in an XString object are not copied on object duplication and (2) an XString object can only store a single string (see the XStringSet container for an efficient way to store a big collection of strings in a single object).
2的XString对象和标准特征向量之间的主要差异是:(1)在XString对象中存储的数据不会被复制对象的重复和(2)XString对象只能存储一个字符串(见的XStringSet容器一个有效的方法大集合一个字符串存储在一个单一的对象)。
Unlike the DNAString, RNAString and AAString containers that accept only a predefined set of letters (the alphabet), a BString object can be used for storing any single string based on a single-byte character set.
只接受字母(字母)的一组预定义的容器,不像的DNAString,RNAString和AAString中,BString对象可用于存储任何单字节字符集为基础的单一的字符串。
构造类似的功能和泛型----------Constructor-like functions and generics----------
In the code snippet below, x can be a single string (character vector of length 1) or an XString object.
在下面的代码片段,x可以是一个字符串(字符长度为1的向量)或XString对象。
BString(x="", start=1, nchar=NA): Tries to convert x into a BString object by reading nchar letters starting at position start in x.
BString(x="", start=1, nchar=NA):尝试转换x,成BString对象的阅读nchar字母位置开始startx。
存取方法----------Accessor methods----------
In the code snippets below, x is an XString object.
在下面的代码片段,x是XString的对象。
alphabet(x): NULL for a BString object. See the corresponding man pages when x is a DNAString, RNAString or AAString object.
alphabet(x):NULLBString对象。请参阅相应的手册页时x是DNAString,RNAString或AAString的对象。
length(x) or nchar(x): Get the length of an XString object, i.e., its number of letters.
length(x)或nchar(x):获取长度一个XString对象,即其字母数量。
强迫----------Coercion----------
In the code snippets below, x is an XString object.
在下面的代码片段,x是XString的对象。
as.character(x): Converts x to a character string.
as.character(x):x字符串转换。
toString(x): Equivalent to as.character(x).
toString(x):as.character(x)等效。
子集----------Subsetting----------
In the code snippets below, x is an XString object.
在下面的代码片段,x是XString的对象。
x[i]: Return a new XString object made of the selected letters (subscript i must be an NA-free numeric vector specifying the positions of the letters to select). The returned object belongs to the same class as x.
x[i]:返回新XString的对象选定的字母(下标i必须NA免费的数字向量,指定字母的位置选择)。返回的对象属于同一类x。
Note that, unlike subseq, x[i] does copy the sequence data and therefore will be very inefficient for extracting a big number of letters (e.g. when i contains millions of positions).
注意的是,不像subseq,x[i]复制序列数据,因此将是非常低效的提取一个字母的大数目(例如,当i包含数以百万计的职位)。
平等----------Equality----------
In the code snippets below, e1 and e2 are XString objects.
在下面的代码片段,e1和e2是XString对象。
e1 == e2: TRUE if e1 is equal to e2. FALSE otherwise.
e1 == e2:TRUE如果e1等于e2。 FALSE不然。
Comparison between two XString objects of different base types (e.g. a BString object and a DNAString object) is not supported with one exception: a DNAString object and an RNAString object can be compared (see RNAString-class for more details about this).
比较两种不同的基本类型(如的BString对象和DNAString的对象)XString对象不支持有一个例外:1 DNAString对象和RNAString的对象进行比较(见关于此的更多细节级RNAString)。
Comparison between a BString object and a character string is also supported (see examples below).
还支持BString对象和字符串之间比较(见下面的例子)。
e1 != e2: Equivalent to !(e1 == e2).
e1 != e2:!(e1 == e2)等效。
作者(S)----------Author(s)----------
H. Pages
参见----------See Also----------
subseq, letter, DNAString-class, RNAString-class, AAString-class, XStringSet-class, XStringViews-class, reverseComplement, compact, XVector-class
subseq,letter,级AAString,级RNAString,DNAString-级,级XStringSet,级XStringViews,reverseComplement,compact,XVector级
举例----------Examples----------
b <- BString("I am a BString object")
b
length(b)
## Extracting a linear subsequence:[#提取一个线性序列:]
subseq(b)
subseq(b, start=3)
subseq(b, start=-3)
subseq(b, end=-3)
subseq(b, end=-3, width=5)
## Subsetting:[#子集:]
b2 <- b[length(b):1] # better done with reverse(b)[(二)更好地完成与反向]
as.character(b2)
b2 == b # FALSE[假]
b2 == as.character(b2) # TRUE[真]
## b[1:length(b)] is equal but not identical to b![#B [1:长度(B)]是平等的,但不完全相同到B!]
b == b[1:length(b)] # TRUE[真]
identical(b, 1:length(b)) # FALSE[假]
## This is because subsetting an XString object with [ makes a copy[#这是因为子集[XString对象的副本]
## of part or all its sequence data. Hence, for the resulting object,[#部分或所有的序列数据。因此,所产生的对象,]
## the internal slot containing the memory address of the sequence[#含有该序列的内存地址的内部插槽]
## data differs from the original. This is enough for identical() to[#数据从原来的不同。这是相同的,足够的()]
## see the 2 objects as different.[#看到不同的2个对象。]
## Compacting. As a particular type of XVector objects, XString[#压缩。作为一个特别是XVector对象,XString的类型]
## objects can eventually be compacted. Compacting is done typically[#对象最终可以被压缩。压缩通常完成]
## before serialization. See ?compact for more information.[#序列化之前。看到了什么?紧凑更多信息。]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|