Reference Code backup Executable files
Replicate lines in a file based on columns of comma-separated values.
bedtools expand -i <bed> -c <cols>
This tool is part of the bedtools
suite.
This tool expands concatenated feature values for each genome regions as defined in one or multiple columns. Note: the values have to be concatented by comma (,).
$ cat test.txt chr1 10 20 1,2,3 10,20,30 chr1 40 50 4,5,6 40,50,60
$ bedtools expand-i test.txt
-c 5
chr1 10 20 1,2,3 10 chr1 10 20 1,2,3 20 chr1 10 20 1,2,3 30 chr1 40 50 4,5,6 40 chr1 40 50 4,5,6 50 chr1 40 50 4,5,6 60
$ bedtools expand-i test.txt
-c 4,5
chr1 10 20 1 10 chr1 10 20 2 20 chr1 10 20 3 30 chr1 40 50 4 40 chr1 40 50 5 50 chr1 40 50 6 60