Problems awking columns from map file
1
0
Entering edit mode
4.2 years ago
Nuthatch • 0

Hi everyone, I've converted three PACKEDANCESTRYMAP format files (myfile.geno, myfile.snp, myfile.ind) into PED files (myfile.ped, myfile.map, myfile.pedind), using convertf.

myfile.map obtained from the conversion has six columns, and looks like this:

1     rs3094315     0.020130       752566 G A
1    rs12124819     0.020242       776546 A G
1    rs28765502     0.022137       832918 T C
1     rs7419119     0.022518       842013 T G
1      rs950122     0.022720       846864 G C

I want to remove the last two columns of this file. So I've tried with this command:

awk '{print $1" "$2" "$3" "$4"}' myfile.map > myfile_fourcol.map

It worked for other map files in the past, but now I get this message:

awk: cmd. line:1: {print $1" "$2" "$3" "$4"}
awk: cmd. line:1:                         ^ unterminated string
awk: cmd. line:1: {print $1" "$2" "$3" "$4"}
awk: cmd. line:1:                         ^ syntax error

Can anyone help me to fix this? Thank you!

awk unix map ped convertf • 1.2k views
ADD COMMENT
2
Entering edit mode
4.2 years ago

The error is clear :

awk: cmd. line:1: {print $1" "$2" "$3" "$4"}
awk: cmd. line:1:                         ^ unterminated string

The " after $4 should be remove

Tabulation is a better delimiter than white spaces

awk -F '\t' '{print $1"\t"$2"\t"$3"\t"$4}' myfile.map > myfile_fourcol.map
ADD COMMENT
0
Entering edit mode

I tried with your command, but I got tha same error message. Apparently tabulation is not the delimiter. How to know which is the actual delimiter?

ADD REPLY
0
Entering edit mode

Sorry. I forgot to remove the " after $4! Now it's ok! Problem solved.

ADD REPLY

Login before adding your answer.

Traffic: 2364 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