How to rename first column of bedgraph file based on another reference table?

How to rename first column of bedgraph file based on another reference table?

1

I have a bedgraph file that looks like this:

chr1    0   35  0
chr1    35  56  0.18636
chr3    56  73  0.37273
chr3    73  123 0.55909
chr4    123 142 0.37273
chr4    142 144 0.55909
chr5    144 161 0.37273

And I have another reference table in a tab delimited format that has alternative values for the first column:

chr1    scaffold_A
chr2    scaffold_B
chr3    scaffold_C
chr4    scaffold_D
chr5    scaffold_E

How can I take the values in the reference table to replace values in the first column of the bedgraph file so the final output is:

scaffold_A  0   35  0
scaffold_A  35  56  0.18636
scaffold_C  56  73  0.37273
scaffold_C  73  123 0.55909
scaffold_D  123 142 0.37273
scaffold_D  142 144 0.55909
scaffold_E  144 161 0.37273


ChIP-seq


bedgraph

• 136 views

Read more here: Source link