Tab to bedgraph

The script below (also on GitHub) converts a three-columns bedgraph-like tab-separated file to actual bedgraph format. The original three columns are “chr”, “start” and “value”. An “end” column is added by the script to make it a bedgraph format.


Merging in R

A common task I happen to do in R is merging tables (for instance, using gene symbol as a join) and renaming columns with a suffix to indicate their table of origin. Below is a function that automatizes most of the process, taking any number of dataframes as input. It is also posted on GitHub.