README.md

genotyping

20170620: Need to fix the internal code according to this

Importing files

The script assumes that you have a hapmap file. If you do not have a hapmap file then use TASSEL to convert your file and save as hapmap.txt file type.

To run the script change 'Parent1Name' in as.character(sub$Parent1Name[[i]])) to the name of your female parent and 'Parent2Name' in as.character(sub$Parent2Name[[i]])) to your male parent name.

geno_male<-function(sub){
  ro=nrow(sub)
  cl=ncol(sub)
  sub[is.na(sub)]<- "N"
  out<-matrix(0,nrow=ro, ncol=cl)
  for (i in 1:ro){
    for (j in 1:11){
      out[i,j]<-as.character(sub[i,j])
    }
  }

  for (i in 1:ro){
    for (j in 12:cl){
      if (as.character(sub[i,j])==as.character(sub$Parent1Name[[i]])) {
        out[i,j]<- as.character("nn")
      }else if (as.character(sub[i,j])==as.character(sub$Parent2Name[[i]])) {
        out[i,j]<- as.character("np")
      }else
        out[i,j]<- as.character("--")
    }
  }
  colnames(out)<-names(sub)
  rownames(out)<-rownames(sub)
  print(out)
}

male<-read.csv("uneak_male_file1.csv", header=T, row.names=NULL)
filemale<- geno_male(male)
write.table(filemale,file="male_lux.txt", row.names=FALSE)


dpaudel/genotyping documentation built on Feb. 8, 2020, 5:43 p.m.