Merge multiple bedMethyl files
If you generate bedMethyl tables from multiple samples and want to perform a "join" where the counts summed modkit bedmethyl merge
will perform an outer join for you.
An example command is below:
modkit bedmethyl merge sample_a.bed.gz sample_b.bed.gz \
-o samples_a_and_b.bed \
-g genome_sizes.tsv # could be reference.fa.fai
The input bedMethyl files must be bgzipped and tabix indexed.
bgzip sample_a.bed
tabix sample_a.bed.gz
bgzip sample_b.bed
tabix sample_b.bed.gz
The genome_sizes.tsv
is a tab-separated file containing the lengths of the contigs in the reference sequence, you can also use a .fai file generated by samtools faidx
.
For example taken from bedtools
:
The schema should be <chromName><TAB><chromSize>
.
For example, Human (hg19):
chr1 249250621
chr2 243199373