/usr/share/bedtools/test/jaccard/test-jaccard.sh is in bedtools-test 2.25.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | #!/bin/bash
BT=${BT-../../bin/bedtools}
check()
{
if diff $1 $2; then
echo ok
else
echo fail
fi
}
###########################################################
# Test a basic self intersection
###########################################################
echo " jaccard.t01...\c"
echo \
"intersection union-intersection jaccard n_intersections
110 110 1 2" > exp
$BT jaccard -a a.bed -b a.bed > obs
check obs exp
rm obs exp
echo " jaccard.t02...\c"
echo \
"intersection union-intersection jaccard n_intersections
10 140 0.0714286 1" > exp
$BT jaccard -a a.bed -b b.bed > obs
check obs exp
rm obs exp
echo " jaccard.t03...\c"
echo \
"intersection union-intersection jaccard n_intersections
10 200 0.05 1" > exp
$BT jaccard -a a.bed -b c.bed > obs
check obs exp
rm obs exp
# TEST #4 IS DEPRECATED
###########################################################
# Test stdin
###########################################################
echo " jaccard.t05...\c"
echo \
"intersection union-intersection jaccard n_intersections
10 140 0.0714286 1" > exp
cat a.bed | $BT jaccard -a - -b b.bed > obs
check obs exp
rm obs exp
###########################################################
# Test symmetry
###########################################################
echo " jaccard.t06...\c"
$BT jaccard -a a.bed -b b.bed > obs1
$BT jaccard -a b.bed -b a.bed > obs2
check obs1 obs2
rm obs1 obs2
###########################################################
# Test partially matching blocks without -split option.
###########################################################
echo " jaccard.t07...\c"
echo \
"intersection union-intersection jaccard n_intersections
10 50 0.2 1" > exp
$BT jaccard -a three_blocks_match.bed -b e.bed > obs
check obs exp
rm obs exp
###########################################################
# Test partially matching blocks with -split option.
###########################################################
echo " jaccard.t08...\c"
echo \
"intersection union-intersection jaccard n_intersections
5 35 0.142857 1" > exp
$BT jaccard -a three_blocks_match.bed -b e.bed -split > obs
check obs exp
rm obs exp
###########################################################
# Test jaccard of Bam with Bam
###########################################################
echo " jaccard.t09...\c"
echo \
"intersection union-intersection jaccard n_intersections
10 150 0.0666667 1" > exp
$BT jaccard -a a.bam -b three_blocks_match.bam -bed > obs
check exp obs
rm exp obs
###########################################################
# Test jaccard with mixed strand files
###########################################################
echo " jaccard.t10...\c"
echo \
"intersection union-intersection jaccard n_intersections
145 180 0.805556 2" >exp
$BT jaccard -a aMixedStrands.bed -b bMixedStrands.bed > obs
check obs exp
rm obs exp
###########################################################
# Test jaccard with mixed strand files, -s option
# (match strand, either forward or reverse)
###########################################################
echo " jaccard.t11...\c"
echo \
"intersection union-intersection jaccard n_intersections
120 290 0.413793 4" >exp
$BT jaccard -a aMixedStrands.bed -b bMixedStrands.bed -s > obs
check obs exp
rm obs exp
###########################################################
# Test jaccard with mixed strand files, -S + option
# (match strand, forward only)
###########################################################
echo " jaccard.t12...\c"
echo \
"intersection union-intersection jaccard n_intersections
40 135 0.296296 2" >exp
$BT jaccard -a aMixedStrands.bed -b bMixedStrands.bed -S + > obs
check obs exp
rm obs exp
###########################################################
# Test jaccard with mixed strand files, -S - option
# (match strand, reverse only)
###########################################################
echo " jaccard.t13...\c"
echo \
"intersection union-intersection jaccard n_intersections
80 155 0.516129 2" > exp
$BT jaccard -a aMixedStrands.bed -b bMixedStrands.bed -S - > obs
check obs exp
rm obs exp
|