Skip to content

Instantly share code, notes, and snippets.

@arq5x
Last active August 29, 2015 14:02
Show Gist options
  • Save arq5x/b79cb5d4eabb8f500130 to your computer and use it in GitHub Desktop.
Save arq5x/b79cb5d4eabb8f500130 to your computer and use it in GitHub Desktop.
testing bedtools intersect with multiple database (-b) files
# test each database file individually
time bedtools intersect -wa -wb -sorted \
-a hg19.rmsk.bed.gz \
-b hg19.segdup.bed.gz \
> /dev/null
real 0m5.069s
user 0m5.007s
sys 0m0.056s
time bedtools intersect -wa -wb -sorted \
-a hg19.rmsk.bed.gz \
-b hg19.CpG.bed.gz \
> /dev/null
real 0m4.872s
user 0m4.815s
sys 0m0.054s
time bedtools intersect -wa -wb -sorted \
-a hg19.rmsk.bed.gz \
-b hg19.gerp.elements.bed.gz \
> /dev/null
real 0m5.846s
user 0m5.776s
sys 0m0.067s
# now test all three at once.
time bedtools intersect -wa -wb -sorted \
-a hg19.rmsk.bed.gz \
-b hg19.segdup.bed.gz \
hg19.CpG.bed.gz \
hg19.gerp.elements.bed.gz \
> /dev/null
real 0m6.305s
user 0m6.226s
sys 0m0.074s
# test output. fifth column is the file number from which the hit came.
time bedtools intersect -wa -wb -sorted \
-a hg19.rmsk.bed.gz \
-b hg19.segdup.bed.gz \
hg19.CpG.bed.gz \
hg19.gerp.elements.bed.gz \
| grep 223742388
chr1 223742388 223742413 Low_complexity_Low_complexity_GC_rich 1 chr1 223725644 223747846
chr1 223742388 223742413 Low_complexity_Low_complexity_GC_rich 2 chr1 223741965 223744525
chr1 223742388 223742413 Low_complexity_Low_complexity_GC_rich 3 chr1 223741996 223742814 1.8343e-32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment