Skip to content

Instantly share code, notes, and snippets.

@elowy01
Last active September 5, 2022 10:42
Show Gist options
  • Save elowy01/43b617f8eb4b9e47927dbfac56d37136 to your computer and use it in GitHub Desktop.
Save elowy01/43b617f8eb4b9e47927dbfac56d37136 to your computer and use it in GitHub Desktop.
# merge
bedtools merge -i ifile.bed -c 4 -o collapse # print the merged feature names (4th column)
# intersect
$ cat A.bed
chr1 10 20
chr1 30 40
$ cat B.bed
chr1 15 20
$ bedtools intersect -a A.bed -b B.bed -wa # print only intersecting entry in A.bed
chr1 10 20
$ bedtools intersect -a A.bed -b B.bed -wa -wb # print both intersecting entries in A.bed and B.bed
chr1 10 20 chr1 15 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment