Edit Column sex in ped file
1
2
Entering edit mode
7.4 years ago
mm ▴ 20

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?

plink linux • 4.1k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode
           yes
ADD REPLY
1
Entering edit mode
7.4 years ago
awk '{OFS="\t";if($5=="M") {$5="1";} else if($5=="F") {$5="2";} else {$5="0";}print;}' in.ped > out.ped
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 2695 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6