SnpAnnotationDataFrame(GWASTools)
SnpAnnotationDataFrame()所属R语言包:GWASTools
Class SnpAnotationDataFrame
类SnpAnotationDataFrame
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The SnpAnnotationDataFrame class stores annotation data associated with SNPs, as well as metadata describing each column. It extends the AnnotatedDataFrame class.
SnpAnnotationDataFrame类存储注释与单核苷酸多态性相关的数据,以及描述每个列的元数据。它延伸AnnotatedDataFrame类。
延伸----------Extends----------
AnnotatedDataFrame
AnnotatedDataFrame
构造----------Constructor----------
SnpAnnotationDataFrame(data, metadata):
SnpAnnotationDataFrame(data, metadata):
data must be a data.frame containing the SNP annotation. It must contain at least the following columns:
data必须是一个数据框包含的SNP注解。它必须至少包含以下几列:
"snpID": integer vector containing unique SNP ids.
“snpID”:含有独特的SNP ID的整数向量。
"chromosome": integer vector containing chromosome codes.
“染色体”:整数向量染色体代码。
"position": integer vector containing position (in base pairs) on the chromosome.
“位置”:整数向量(碱基对)染色体上的位置。
Default values for chromosome codes are 1-22, 23=X, 24=XY, 25=Y, 26=M. The defaults may be changed with the arguments XchromCode, XYchromCode, YchromCode, and MchromCode.
染色体的编码的默认值是1-22,23 = X 24 = XY,25 = Y 26 = M可改变参数的默认XchromCode,XYchromCode,YchromCode,MchromCode。
metadata is an optional data.frame containing a description for each column in data. It should contain a column "labelDescription", with row.names(metadata) == names(data).
metadata是一个可选的数据框包含为每个列在data描述。它应该包含列“labelDescription”,用row.names(metadata) == names(data)。
The SnpAnnotationDataFrame constructor creates and returns a SnpAnnotationDataFrame instance.
SnpAnnotationDataFrame构造创建和返回SnpAnnotationDataFrame实例。
存取----------Accessors----------
In the code snippets below, object is a SnpAnnotationDataFrame object.
在下面的代码片段,object是SnpAnnotationDataFrame的对象。
getSnpID(object, index): A unique integer vector of snp IDs. The optional index is a logical or integer vector specifying elements to extract.
getSnpID(object, index):一个独特的SNP ID的整数向量。可选的index是一个逻辑或整数向量,指定要提取的元素。
getChromosome(object, index, char=FALSE): A vector of chromosomes. The optional index is a logical or integer vector specifying elements to extract. If char=FALSE (default), returns an integer vector. If char=TRUE, returns a character vector with elements in (1:22,X,XY,Y,M,U). "U" stands for "Unknown" and is the value given to any chromosome code not falling in the other categories.
getChromosome(object, index, char=FALSE):一个染色体的向量。可选的index是一个逻辑或整数向量,指定要提取的元素。如果char=FALSE(默认),返回一个整数向量。如果char=TRUE,返回一个字符向量中的元素(1:22,X,XY,Y,男,ü)。的“U”代表“未知”,是不能在其他类别的任何染色体代码的价值。
getPosition(object, index): An integer vector of base pair positions. The optional index is a logical or integer vector specifying elements to extract.
getPosition(object, index):一个碱基对位置的整数向量。可选的index是一个逻辑或整数向量,指定要提取的元素。
getVariable(object, varname, index): A vector of the column varname. The optional index is a logical or integer vector specifying elements to extract. If varname is itself a vector, returns a data.frame. Returns NULL if varname is not found in object.
getVariable(object, varname, index):一个列varname向量。可选的index是一个逻辑或整数向量,指定要提取的元素。 varname如果本身就是一个向量,返回一个数据框。返回NULL如果varname不object发现。
hasVariable(object, varname): Returns TRUE if varname is a column in object, FALSE if not.
hasVariable(object, varname):返回TRUE如果varname是一个列在object,FALSE如果不是。
getVariableNames(object): Returns a character vector with the names of all columns in object.
getVariableNames(object):返回所有列在object的名称字符向量。
getAnnotation(object): Returns all annotation variables as a data frame.
getAnnotation(object):返回一个数据框的所有注释的变量。
getMetadata(object): Returns metadata describing the annotation variables as a data frame.
getMetadata(object):返回元数据描述的注释变量作为一个数据框。
Inherited methods from AnnotatedDataFrame:
继承的方法,从AnnotatedDataFrame:
varLabels(object): Returns a character vector with the names of all columns in object.
varLabels(object):返回所有列在object的名称字符向量。
pData(object): Returns all annotation variables as a data frame, or sets the annotation variables with pData(object) <- df.
pData(object):返回一个数据框的所有注释的变量,或设置pData(object) <- df注释变量。
varMetadata(object): Returns metadata describing the annotation variables as a data frame, or sets the metadata with varMetadata(object) <- df.
varMetadata(object):返回元数据描述一个数据框注释的变量,或设置varMetadata(object) <- df元数据。
The operators [, $, and [[ work just as they do in standard data frames, for both retrieval and assignment.
运营商[,$,[[工作,就像他们在做标准数据框检索和分配。
XchromCode(object): Returns the integer code for the X chromosome.
XchromCode(object):返回整数代码为X染色体。
XYchromCode(object): Returns the integer code for the pseudoautosomal region.
XYchromCode(object):返回整数代码为拟常区域。
YchromCode(object): Returns the integer code for the Y chromosome.
YchromCode(object):返回的整数代码为Y染色体。
MchromCode(object): Returns the integer code for mitochondrial SNPs.
MchromCode(object):返回线粒体单核苷酸多态性的整数代码。
作者(S)----------Author(s)----------
Stephanie Gogarten
参见----------See Also----------
AnnotatedDataFrame, ScanAnnotationDataFrame, GenotypeData, IntensityData
AnnotatedDataFrame,ScanAnnotationDataFrame,GenotypeData,IntensityData
举例----------Examples----------
library(GWASdata)
data(affy_snp_annot)
snpAnnot <- SnpAnnotationDataFrame(affy_snp_annot)
# list columns[列表中的列]
varLabels(snpAnnot)
# add metadata[添加元数据]
meta <- varMetadata(snpAnnot)
meta["snpID", "labelDescription"] <- "unique integer ID"
varMetadata(snpAnnot) <- meta
# get snpID and chromosome[获取snpID和染色体]
snpID <- getSnpID(snpAnnot)
chrom <- getChromosome(snpAnnot)
# get positions only for chromosome 22[只得到22号染色体的位置]
pos22 <- getPosition(snpAnnot, index=(chrom == 22))
# get rsID[获得RSID]
if (hasVariable(snpAnnot, "rsID")) rsID <- getVariable(snpAnnot, "rsID")
# display data[显示数据]
head(pData(snpAnnot))
# standard operators[标准的运营商]
snpID <- snpAnnot$snpID
chrom <- snpAnnot[["chromosome"]]
subset <- snpAnnot[1:10, 1:5]
snpAnnot$newVar <- rep(1, nrow(snpAnnot))
# replace data[替换数据]
df <- pData(snpAnnot)
pData(snpAnnot) <- df
# PLINK chromosome coding[砰砰染色体编码]
snpID <- 1:10
chrom <- c(rep(1L,5), 23:27)
pos <- 101:110
df <- data.frame(snpID=snpID, chromosome=chrom, position=pos)
snpAnnot <- SnpAnnotationDataFrame(df, YchromCode=24L, XYchromCode=25L)
getChromosome(snpAnnot, char=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|