マーカーの束ごとにパワーを計算

  • 予定パッケージ名
  • 関数名
    • SpherePowerGene
  • タイトル
SpherePowerGene
  • 説明
フェノタイプ情報のベクトルと、ジェノタイプ情報の行列があるとする。
フェノタイプベクトルから分割表を作り、
ジェノタイプ行列から、テストベクトルを作る。
遺伝子は、1個以上のマーカーを持ち、
その遺伝子に関する検定は、その遺伝子に属するマーカーに関する複数の検定の最大検定統計量であるものとする。
検定閾値を与え、真の関連をマーカーの方向にあるとみなして、パワーを遺伝子単位で推定する
  • 使用例

  • ソース
SpherePowerGene<-function(p,g,ptype=c(0,1),genes,Ks,CheckDists,nperm){
	O<-MakeOTable(p,ptype)
	Sp<-RegularSpherize(O)
	Ngenes<-length(genes[,1])
	Ntobechecked<-sum(genes[,2])-sum(genes[,1])+Ngenes
	df<-length(p)-1

	powouts<-matrix(0,Ntobechecked,length(CheckDists))
	counter<-1
	for(i in 1:Ngenes){
		W<-MakeWTableS(as.matrix(g[,genes[i,1]:genes[i,2]]))
		Tiis<-matrix(0,length(W[,1]),df)
		for(j in 1:length(W[,1])){
			Tiis[j,]<-TestDf1(O,W[j,],Sp)$Tiist
		}
		Tiis<-rbind(Tiis,-Tiis)
		for(j in 1:(length(Tiis[,1])/2)){
			Kv<-Tiis[j,]
			powouts[counter,]<-SpherePower(df,Kv,Ks,CheckDists,Tiis)$p.out
			counter<-counter+1
		}
	}
	#matplot(t(powouts),type="l")
	list(powers=powouts,p=p,g=g,ptype=ptype,genes=genes,Ks=Ks,CheckDists=CheckDists,nperm=nperm)
}
  • Rdファイル
\name{SpherePowerGene}
\alias{SpherePowerGene}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
SpherePowerGene
}
\description{
フェノタイプ情報のベクトルと、ジェノタイプ情報の行列があるとする。
フェノタイプベクトルから分割表を作り、
ジェノタイプ行列から、テストベクトルを作る。
遺伝子は、1個以上のマーカーを持ち、
その遺伝子に関する検定は、その遺伝子に属するマーカーに関する複数の検定の最大検定統計量であるものとする。
検定閾値を与え、真の関連をマーカーの方向にあるとみなして、パワーを遺伝子単位で推定する
}
\usage{
SpherePowerGene(p=p,g=g3,genes=LocGenes,Ks=Ks,CheckDists=CheckDists,nperm=nperm)
}
\arguments{
\item{p}{サンプル数の長さのベクトル、フェノタイプ}
\item{g}{サンプル数の行数、マーカー数の列数の行列、ジェノタイプ}
\item{genes}{2列の行列。各行は、遺伝子などの長さのある要素に対応し、第1列の値から第2列の値までのマーカーが、その要素に属するものとする}
\item{Ks}{対立仮説の原点からの距離}
\item{CheckDists}{帰無仮説検定の検定閾値(原点からの距離)}
\item{nperm}{推定に用いる乱方向の数}
}
%- maybe also 'usage' for other objects documented here.
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
引数を格納するとともに、遺伝子上のマーカーのパワーが行列状で返る
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
}

\examples{
Ns<-1000
Nm<-1000
k<-c(0,1)
p<-sample(k,Ns,replace=TRUE)
num1<-sample(1:(Ns-5),Nm,replace=TRUE)
num1<-sort(num1)

num2<-rep(0,Nm)
for(i in 1:Nm){
	num2[i]<-sample((num1[i]+1):Ns,1)
}
g<-matrix(0,Ns,Nm)
for(i in 1:Nm){
	g[,i]<-c(rep(0,num1[i]),rep(1,num2[i]-num1[i]),rep(2,Ns-num2[i]))
}

Nm2<-500
g2<-matrix(sample(c(0,1,2),Nm2*Ns,replace=TRUE),nrow=Ns)

g3<-cbind(g,g2)
Nm3<-Nm+Nm2
g3<-g3[,sample(1:Nm3)]

image(g3)

Ngenes<-10

LocGenes<-matrix(sort(sample(1:Nm3,Ngenes*2)),ncol=2,byrow=TRUE)

matplot(LocGenes)
Ks<-3
CheckDists<-0:6
nperm<-1000
powerGenes<-SpherePowerGene(p=p,g=g3,genes=LocGenes,Ks=Ks,CheckDists=CheckDists,nperm=nperm)
matplot(t(powerGenes$powers),type="l")
}