MatrixGenotypeReader(GWASTools)
MatrixGenotypeReader()所属R语言包:GWASTools
Class MatrixGenotypeReader
类MatrixGenotypeReader
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The MatrixGenotypeReader class stores a matrix of genotypes as well as SNP and scan IDs, chromosome, and position.
MatrixGenotypeReader类存储以及基因型的SNP和扫描ID,染色体,和位置矩阵。
构造----------Constructor----------
MatrixGenotypeReader(genotype=genotype, snpID=snpID, chromosome=chromosome, position=position, scanID=scanID):
MatrixGenotypeReader(genotype=genotype, snpID=snpID, chromosome=chromosome, position=position, scanID=scanID):
genotype must be a matrix with dimensions ('snp','scan') containing the number of A alleles : 2=AA, 1=AB, 0=BB.
genotype必须与维矩阵(单核苷酸多态性“,”扫描“),含A等位基因数:2 = AA = AB公司,0 = BB,1。
snp must be a unique integer vector of SNP ids.
snp必须是一个独特的SNP ID的整数向量。
chromosome must be an integer vector of chromosomes. 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.
chromosome必须是一个整数染色体的向量。染色体的编码的默认值是1-22,23 = X 24 = XY,25 = Y 26 = M可改变参数的默认XchromCode,XYchromCode,YchromCode,MchromCode。
position must be an integer vector of base positions
position碱基的位置必须是整数向量
scanID must be a unique integer vector of scan ids .
scanID必须是唯一的整数向量扫描IDS。
The MatrixGenotypeReader constructor creates and returns a MatrixGenotypeReader instance.
MatrixGenotypeReader构造创建和返回MatrixGenotypeReader实例。
存取----------Accessors----------
In the code snippets below, object is a MatrixGenotypeReader object. snp and scan indicate which elements to return along the snp and scan dimensions. They must be integer vectors of the form (start, count), where start is the index of the first data element to read and count is the number of elements to read. A value of '-1' for count indicates that the entire dimension should be read. If snp and/or is scan omitted, the entire variable is returned.
在下面的代码片段,object是MatrixGenotypeReader的对象。 snp和scan表明该元素返回沿SNP和扫描尺寸。他们必须是整数的形式向量(启动,计数),在那里开始的第一个数据元素的索引,阅读和计算元素的数量,阅读。 “-1”为计数的值表明整个维度应读。如果SNP和/或扫描省略,整个变量返回。
See NcdfReader for additional methods.
看到NcdfReader的其他方法。
nsnp(object): The number of SNPs.
nsnp(object):SNP的数量。
nscan(object): The number of scans.
nscan(object):扫描的数量。
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是一个逻辑或整数向量,指定要提取的元素。
getScanID(object, index): A unique integer vector of scan IDs. The optional index is a logical or integer vector specifying elements to extract.
getScanID(object, index):一个独特的扫描标识的整数向量。可选的index是一个逻辑或整数向量,指定要提取的元素。
getGenotype(object, snp, scan): Extracts genotype values (number of A alleles). The result is a vector or matrix, depending on the number of dimensions in the returned values. Missing values are represented as NA.
getGenotype(object, snp, scan):提取基因型值(A等位基因数)。其结果是一个向量或矩阵,根据返回值的尺寸。遗漏值表示为NA。
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----------
NcdfGenotypeReader, GenotypeData
NcdfGenotypeReader,GenotypeData
举例----------Examples----------
snpID <- 1:100
chrom <- rep(1:20, each=5)
pos <- 1001:1100
scanID <- 1:20
geno <- matrix(sample(c(0,1,2,NA), 2000, replace=TRUE), nrow=100, ncol=20)
mgr <- MatrixGenotypeReader(genotype=geno, snpID=snpID,
chromosome=chrom, position=pos, scanID=scanID)
# dimensions[尺寸]
nsnp(mgr)
nscan(mgr)
# get snpID and chromosome[获取snpID和染色体]
snpID <- getSnpID(mgr)
chrom <- getChromosome(mgr)
# get positions only for chromosome 10[只得到10号染色体上的位置]
pos10 <- getPosition(mgr, index=(chrom == 10))
# get all snps for first scan[第一次扫描得到所有的SNPs]
geno <- getGenotype(mgr, snp=c(1,-1), scan=c(1,1))
# starting at snp 50, get 10 snps for the first 5 scans[SNP 50起,获得第5扫描10个SNPs]
geno <- getGenotype(mgr, snp=c(50,10), scan=c(1,5))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|