methfast is a program for extracting methylation values from a bed-like file for a target bed file. It can accept gzipped or plain text files and by default assumes the format for the bed file with methylation is like this:
chrom start end methylation coverage
Other formats can be used by specifying the column numbers for the methylation and coverage values.
methfast is written in C using Heng Li's cgranges library to perform overlap queries between methylation and bed intervals.
methfast can be compiled via:
gcc methfast.c cgranges.c -o methfast -lz -lm
methfast <methylation_bed(.gz)> <target_bed> [-f <frac_col>] [-c <cov_col>] [-m <meth_col>] [-u <unmeth_col>]
Options: -f column number for methylation fraction (default is 4) -c column number for total coverage (default is 5) -m column number for methylated coverage (no default) -u column number for unmethylated coverage (no default)
A small test dataset is included, which can be tested via:
methfast meth.bed.gz regions.bed