Dear community,
i have the following code and error as follow
library(ABHgenotypeR)
library(onemap)
library(ggplot2)
library(qtl)
geno0<-bp[-c(3,4),]
View(bp)
View(geno0)
pheno<-geno0[-c(1,2),1:5]
pheno[pheno=='-']<-NA
pheno<-data.frame(apply(pheno,2,as.numeric))
rownames(pheno)<-geno0$Markername[-c(1,2)]
x<-data.frame(t(geno0[1:2,-c(1:6)]))
map<-data.frame(marker=rownames(x),chr=as.numeric(x[,1]),pos=as.numeric(x[,2]))
rownames(map)<-map$marker
geno<-geno0[-c(1:2),-c(1:6)]
rownames(geno)<-rownames(pheno)
Warning message:
Setting row names on a tibble is deprecated.
geno[geno=='-']<-NA
seg<-t(apply(geno,2,function(x){
- w<-c(0,0,0)
- names(w)<-c('A','B','H')
- y<-table(x)
- w[names(y)]<-y
- return(w)
- }))
f<-which(seg[,3]>10)
geno<-geno[,-f]
map<-map[-f,]
geno[geno=='H']<-NA
mm<-apply(geno,2,function(x){
- length(which(is.na(x)))/length(x)
- })
f<-which(mm>.2)
geno<-geno[,-f]
map<-map[-f,]
seg<-t(apply(geno,2,function(x){
- w<-c(0,0)
- names(w)<-c('A','B')
- y<-table(x)
- w[names(y)]<-y
- return(w)
- }))
ra<-seg[,1]/seg[,2]
Error in seg[, 1] : subscript out of bounds
and i think the Warning message:
Setting row names on a tibble is deprecated. is making the error subscript out of bounds for inproper matrix