This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merge/Collapse regions within a certain distance

Hello, I am sure this has been asked before but I can't find it. Basically:

scaffold_1 100 200
scaffold_1 300 400
scaffold_1 1000 2100

merge features at a minimum proximity of 200bp and:

scaffold_1 100 400
scaffold_1 1000 2100

Is this possible? Thanks, Adrian

bedtools

1 answer

bedtools merge with option -d

-d  Maximum distance between features allowed for features
    to be merged.

Did not realize that would work for only one file. Thanks!

Actually it seems like it takes only one file as input. This makes things complicated in certain cases. Is there any way to only merge features from file A to those of file B, but not merge features within file A or within B?

Log in to answer this question.