Skip to content

Instantly share code, notes, and snippets.

@indapa
Created March 11, 2013 15:08
Show Gist options
  • Save indapa/5134896 to your computer and use it in GitHub Desktop.
Save indapa/5134896 to your computer and use it in GitHub Desktop.
pedobjects=[] #list of pedobjects, represents lines in a pedfile
pedfh=open(options.pedfile, 'r')
for line in pedfh:
fields=line.strip().split('\t')
(fid,iid,pid,mid,sex,phenotype)=fields[0:6]
phenotype=int(phenotype)
pedobjects.append( Ped(fid,iid,pid,mid,sex,phenotype) )
#the phenotype status is set to 2 if the sample is affected: http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped
affecteds=[ pedobj.getid() for pedobj in pedobjects if pedobj.getpheno() == 2 ]
unaffecteds=[ pedobj.getid() for pedobj in pedobjects if pedobj.getpheno() == 1 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment