## import example data(data.frame)
# data(genotypeData)
## get the first line: affection state for samples
#data1=genotypeData[1,,drop=FALSE]
## get the second line: genotype data for a sepcifed snp
# data2=genotypeData[2,,drop=FALSE]
## Statistical allele and genotype frequency of the specified snp(rs#) for case-control data.
# result2=genotypeStat(data2,data1,fromCol=2,naString="?_?",sep="_")
## allele frequency for case and control samples
# alleleResult=result2$alleleCount
## genotype frequency for case and control samples
# genotypeReslut=result2$genotypeCount
## matrix
# genotypeLine=matrix(c("rs12","AA","AT","NN","AT","AT","AT"),nrow=1)
# affectionLine=matrix(c("Affection",0,0,1,1,0,0),nrow=1)
# fromCol=2
# naString="NN"
# sep=""
# genotypeStat(genotypeLine, affectionLine, fromCol, naString, sep)
## connect file
# datafile=file("F:/data.txt","r")
## get the affection status of samples: the first line from "data.txt"
# dataLine1=readLines(datafile,n=1)
# dataLine1=t(unlist(strsplit(dataLine1,sep="")))
## get the genotypes of samples: the second line from "data.txt"
# dataLine2=readLines(datafile,n=1)
# dataLine2=t(unlist(strsplit(dataLine2,sep="")))
# genotypeStat(dataLine2,dataLine1,fromCol=2,naString="NN",sep="")
Run the code above in your browser using DataLab