old_dir <- getwd()
setwd(tempdir())
data(hapRes)
res <- hapRes$res
sPF <- hapRes$sPF
annot <- hapRes$annot
nnL <- length(Z(res)[1,])
labelsA <- cbind(as.character(1:nnL),
as.character(1:nnL),as.character(1:nnL),
as.character(1:nnL))
resIBDsegmentList <-
extractIBDsegments(res=res,sPF=sPF,
annot=annot,chrom="1",labelsA=labelsA,
ps=0.9,psZ=0.8,inteA=50,thresA=6,mintagSNVs=6,
off=0,procMinIndivids=0.1,thresPrune=1e-3)
tagSNVPositions <-
tagSNVPositions(resIBDsegmentList[[1]])
snvR <- sample(min(tagSNVPositions):max(tagSNVPositions),
length(tagSNVPositions))
snvA <- sort(unique(c(tagSNVPositions,snvR)))
func = c("stopGain","stopLoss","synonymous",
"non-synonymous","-","-","-","-","-","-")
for (i in 1:length(snvA)) {
if (i>1) {
write(paste(snvA[i],"1",sample(func,1),sep=" "),
file="snvAnnotation.txt",ncolumns=100,append=TRUE)
} else {
write(paste(snvA[i],"1",sample(func,1),sep=" "),
file="snvAnnotation.txt",ncolumns=100,append=FALSE)
}
}
tagSNVAnno(resIBDsegmentList[[1]])
resIBDsegmentList <- setAnnotation(resIBDsegmentList,
filename="snvAnnotation.txt")
tagSNVAnno(resIBDsegmentList[[1]])
setwd(old_dir)
Run the code above in your browser using DataCamp Workspace