Question: Edit Column sex in ped file
2
gravatar for mm
2.8 years ago by
mm20
mm20 wrote:

I want to edit my column sex in ped file and place in numbers 2 and 1 instead of F and M . How do I do this Linux?

linux plink • 1.8k views
ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by mm20

Despite Individual ID Paternal ID Maternal ID- how to build Family ID?

ADD REPLYlink written 2.8 years ago by mm20

How to build a family ID?

ADD REPLYlink written 2.8 years ago by WouterDeCoster40k
           yes
ADD REPLYlink written 2.8 years ago by mm20
1
gravatar for Pierre Lindenbaum
2.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum122k wrote:
awk '{OFS="\t";if($5=="M") {$5="1";} else if($5=="F") {$5="2";} else {$5="0";}print;}' in.ped > out.ped
ADD COMMENTlink written 2.8 years ago by Pierre Lindenbaum122k

The output file as follows: It seems that is wrong

SNP Chip    ID  Animal  0   Paternal
R950E03 111006  930226  910008  0   Resistant
R950E06 110917  950085  910043  0   Resistant
R950C09 110892  950085  910125  0   Resistant
R949B05 111101  870141  840409  0   Resistant
ADD REPLYlink modified 2.8 years ago by WouterDeCoster40k • written 2.8 years ago by mm20

I assumed that the sex is in column $5 and there is no header:

$ echo "FAM ID FATHER MOTHER M" | awk '{OFS="\t";if($5=="M") {$5="1";} else if($5=="F") {$5="2";} else {$5="0";}print;}'
FAM ID  FATHER  MOTHER  1
ADD REPLYlink written 2.8 years ago by Pierre Lindenbaum122k

From: http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml The PED file is a white-space (space or tab) delimited file: the first six columns are mandatory:

 Family ID
 Individual ID
 Paternal ID
 Maternal ID
 Sex (1=male; 2=female; other=unknown)
 Phenotype
ADD REPLYlink written 2.8 years ago by WouterDeCoster40k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1361 users visited in the last hour