I have multiple files in format: chr position value.
I want to combine them in format "chr", "position", "samp1", "samp2", "samp3", "samp4",........
For example:
Samp1:
chr position value
1 3774318 1
1 3774319 1
1 3775200 2
1 3775201 7
1 3775202 70
1 3775203 7
1 3775204 270
1 3775205 3
1 3775206 5
Samp 2:
chr position value
1 3775200 1
1 3775201 1
1 3775202 10
1 3775203 1
1 3775204 12
1 3775205 1
1 3775206 13
1 3775207 1
1 3775208 1
1 3775209 18
and so on ....
Desired output file: / I put random values in the output file
chr, position, value-samp1, value-samp2, value-samp3, value-samp4
1 50204 2 17 5 2
1 50205 2 17 5 2
1 50206 2 18 5 2
1 50207 2 19 5 3
1 50208 3 19 5 3
1 50209 3 19 5 3
Or in this case : { chr position samp1 samp2
1 3774318 1 0
1 3774319 1 0
1 3775200 2 1
1 3775201 0 1
1 3775202 70 10
1 3775203 7 1
1 3775204 270 12
1 3775205 3 1
1 3775206 5 13
1 3775207 7 1
1 3775208 0 1
1 3775209 0 18 }
I tried join, merge, cat, but it does not work as I expected. I am a begginer. Do you have any ideas how it can be done?
Sounds like bedtools intersect can help. Just duplicate the position column to two columns, probably should use -loj, then remove unnecessary columns
I don't think there are some one-click tools can do this job. It may require some coding work to do this task, python, R , etc .