Entering edit mode
3.4 years ago
er.doug.ragnar
▴
30
Hi
I am trying to join two files, one has 4 columns the other 3. I want to match the third column of the first to the second column on the second file and add the 3rd column of the second file to the first, when the data from each column match. I managed to do it but only when I output all columns from second file. Like this:
join -t' ' -1 3 -2 2 -o 1.1,1.2,1.3,1.4,2.1 join_2.txt join_1.txt > join_try_3.txt
If I run this, it doesn't work:
join -t' ' -1 3 -2 2 -o 1.1,1.2,1.3,1.4,2.3 join_2.txt join_1.txt > join_try_3.txt
Any ideas why? And suggestions to only add the the 3rd column of the second file would be appreciated.
Thanks in advance.
how is it related to bioinformatics ? (and BTW how did you sort join_* ?)
The 2 files are blast results in output format 6, I sorted each file by the columns I wanted to match.
The 2 files are blast results in output format 6, I sorted each file by the columns I wanted to match.
show us the command line please.
The previous values of the columns were of test files I created to practice on them before doing it on my files. My actual is the following: I checked my files and the blast results I think all lines are correct for join, lets call this file A. That file is like this:
The other file, lets call it file B, some lines do not have all the columns :
I want to match the fifth column in file B to the 1st column in file A and when it matches add column 7 to file A. Should I use an AWK instead of join?
It gives this error:
my question 'show us the command line' was about how you sorted both files. Furthermore, from what you showed above, it's hard to say if you used a space or a tab. At this point, I'm leaving this thread.
Well I did not understand, I thought it was the command I was having issues with .
But here is the sort commands: