2
$\begingroup$

Is there a pedigree viewer that works with PLINK pedigree files? I saw an old post by Pierre, but I don't see the script on his blog.

$\endgroup$
1

1 Answer 1

3
$\begingroup$

We use kinship2 R package to visualize pedigree files (.fam plink files). For some reasons, some characters from plink ped aren't supported (like "-9" for unknown genre or affected status).
Here is the R script we use:

args<-commandArgs(TRUE)
pedPath<-args[1]
pdfFile<-args[2]

library(kinship2)
pedfile <- read.table(pedPath,sep="\t")
pedfile$V5 <- apply(pedfile,1,function(data){if(data[5] == 1 || data[5] ==2){data[5]}else{3}}) 
pedfile$affected <- apply(pedfile,1,function(data){if(as.numeric(data[6]) == 1){res <- data[6]}else{if(as.numeric(data[6]) == 2){res <- data[6]}else{res <- NA}}})

familyIDs <- as.character(unique(pedfile$V1))

pdf(file=pdfFile)
for(famID in familyIDs){
    ped <- pedigree(id=as.character(pedfile$V2[pedfile$V1==famID]),dadid=as.character(pedfile$V3[pedfile$V1==famID]),momid=as.character(pedfile$V4[pedfile$V1==famID]),sex=as.numeric(pedfile$V5[pedfile$V1==famID]),affected=as.numeric(pedfile$affected[pedfile$V1==famID]))
    plot.pedigree(ped,cex=0.7,align=TRUE)
    title(famID)
}

And we call it this way:

Rscript <kinshipScript.R> <plink ped file> <pdf output>
$\endgroup$
2
  • $\begingroup$ Now, if only I could convince people to include affected information in the actual .fam files. :-) $\endgroup$ Aug 18, 2018 at 14:15
  • $\begingroup$ @MarkEbbert affected status is not really necessary but it still looks good on the pdf :) $\endgroup$
    – Eric C.
    Aug 20, 2018 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.