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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
|
# each test will be expanded into 6 tests, to check stream, file, and generator
# versions of input and output BedTools
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# intersect
- method: intersect
kwargs:
a: a.bed
b: b.bed
s: True
expected: |
chr1 155 200 feature3 0 -
chr1 900 901 feature4 0 +
- method: intersect
kwargs:
a: a.bed
b: b.bed
s: False
expected: |
chr1 155 200 feature2 0 +
chr1 155 200 feature3 0 -
chr1 900 901 feature4 0 +
- method: intersect
kwargs:
a: a.bed
b: b.bed
u: True
expected: |
chr1 100 200 feature2 0 +
chr1 150 500 feature3 0 -
chr1 900 950 feature4 0 +
- method: intersect
kwargs:
a: a.bed
b: b.bed
u: True
s: True
expected: |
chr1 150 500 feature3 0 -
chr1 900 950 feature4 0 +
- method: intersect
kwargs:
a: a.bed
b: b.bed
v: True
expected: |
chr1 1 100 feature1 0 +
- method: intersect
kwargs:
a: a.bed
b: b.bed
v: True
s: True
expected: |
chr1 1 100 feature1 0 +
chr1 100 200 feature2 0 +
- method: intersect
kwargs:
abam: gdc.bam
b: gdc.gff
bed: True
v: True
expected: |
chr2L 10 15 None 255 + 10 15 0,0,0 1 5, 0,
- method: intersect
kwargs:
abam: gdc.bam
b: gdc.gff
bed: True
u: True
expected: |
chr2L 70 75 None 255 - 70 75 0,0,0 1 5, 0,
chr2L 140 145 None 255 - 140 145 0,0,0 1 5, 0,
chr2L 150 155 None 255 - 150 155 0,0,0 1 5, 0,
chr2L 210 215 None 255 + 210 215 0,0,0 1 5, 0,
chr2L 70 75 None 255 + 70 75 0,0,0 1 5, 0,
chr2L 140 145 None 255 + 140 145 0,0,0 1 5, 0,
chr2L 160 165 None 255 + 160 165 0,0,0 1 5, 0,
# same thing, but no explicit -abam, just -a
- method: intersect
kwargs:
a: gdc.bam
b: gdc.gff
bed: True
u: True
expected: |
chr2L 70 75 None 255 - 70 75 0,0,0 1 5, 0,
chr2L 140 145 None 255 - 140 145 0,0,0 1 5, 0,
chr2L 150 155 None 255 - 150 155 0,0,0 1 5, 0,
chr2L 210 215 None 255 + 210 215 0,0,0 1 5, 0,
chr2L 70 75 None 255 + 70 75 0,0,0 1 5, 0,
chr2L 140 145 None 255 + 140 145 0,0,0 1 5, 0,
chr2L 160 165 None 255 + 160 165 0,0,0 1 5, 0,
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# subtract
- method: subtract
kwargs:
a: a.bed
b: b.bed
expected: |
chr1 1 100 feature1 0 +
chr1 100 155 feature2 0 +
chr1 150 155 feature3 0 -
chr1 200 500 feature3 0 -
chr1 901 950 feature4 0 +
- method: subtract
kwargs:
a: a.bed
b: b.bed
s: True
expected: |
chr1 1 100 feature1 0 +
chr1 100 200 feature2 0 +
chr1 150 155 feature3 0 -
chr1 200 500 feature3 0 -
chr1 901 950 feature4 0 +
# the difference in f=0.2 and f=0.1 is in feature5 of b. Since feature2
# and feature3 of a overlap, it's seeing the 'a' feature as a 399-bp
# feature (chr1:100-500), and feature5 of 'b' overlaps this by 44 bp.
#
# So the threshold fraction should be
#
# 44/399 = 0.1103
#
# f > 0.1103 should return no subtractions, because nothing in b overlaps by that much.
# However, 0.12 doesn't work; need to go to 0.13 . . .
- method: subtract
kwargs:
a: a.bed
b: b.bed
s: True
f: 0.13
expected: |
chr1 1 100 feature1 0 +
chr1 100 200 feature2 0 +
chr1 150 500 feature3 0 -
chr1 900 950 feature4 0 +
# f < 0.1103, so should get a subtraction
- method: subtract
kwargs:
a: a.bed
b: b.bed
s: True
f: 0.1
expected: |
chr1 1 100 feature1 0 +
chr1 100 200 feature2 0 +
chr1 150 155 feature3 0 -
chr1 200 500 feature3 0 -
chr1 900 950 feature4 0 +
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# slop
#
- method: slop
kwargs:
i: a.bed
b: 100
genome: 'hg19'
expected: |
chr1 0 200 feature1 0 +
chr1 0 300 feature2 0 +
chr1 50 600 feature3 0 -
chr1 800 1050 feature4 0 +
- method: slop
kwargs:
i: a.bed
l: 100
r: 1
genome: 'hg19'
expected: |
chr1 0 101 feature1 0 +
chr1 0 201 feature2 0 +
chr1 50 501 feature3 0 -
chr1 800 951 feature4 0 +
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# merge
#
- method: merge
kwargs:
i: a.bed
expected: |
chr1 1 500
chr1 900 950
- method: merge
kwargs:
i: b.bed
d: 700
expected: |
chr1 155 901
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# to_bed
#
- method: bam_to_bed
kwargs:
i: small.bam
expected: |
chr2L 9329 9365 HWUSI-NAME:2:69:512:1017#0 3 -
chr2L 10212 10248 HWUSI-NAME:2:91:1201:1113#0 255 -
chr2L 10255 10291 HWUSI-NAME:2:57:765:914#0 255 +
chr2L 10427 10463 HWUSI-NAME:2:53:900:1397#0 255 -
chr2L 10474 10510 HWUSI-NAME:2:64:398:565#0 255 -
chr2L 10516 10552 HWUSI-NAME:2:69:139:283#0 255 +
chr2L 10521 10557 HWUSI-NAME:2:49:1095:1884#0 255 +
chr2L 10628 10664 HWUSI-NAME:2:27:973:1468#0 255 -
chr2L 10782 10818 HWUSI-NAME:2:21:67:543#0 255 +
chr2L 10818 10854 HWUSI-NAME:2:27:1324:2012#0 255 -
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# bed6
#
- method: bed6
kwargs:
i: mm9.bed12
expected: |
chr1 4797973 4798063 Lypla1,uc007afh.1 1 +
chr1 4798535 4798567 Lypla1,uc007afh.1 1 +
chr1 4818664 4818730 Lypla1,uc007afh.1 1 +
chr1 4820348 4820396 Lypla1,uc007afh.1 1 +
chr1 4822391 4822462 Lypla1,uc007afh.1 1 +
chr1 4827081 4827155 Lypla1,uc007afh.1 1 +
chr1 4829467 4829569 Lypla1,uc007afh.1 1 +
chr1 4831036 4831213 Lypla1,uc007afh.1 1 +
chr1 4835043 4836816 Lypla1,uc007afh.1 1 +
chr1 4797973 4798063 Lypla1,uc007afg.1 1 +
chr1 4798535 4798567 Lypla1,uc007afg.1 1 +
chr1 4818664 4818730 Lypla1,uc007afg.1 1 +
chr1 4820348 4820396 Lypla1,uc007afg.1 1 +
chr1 4822391 4822462 Lypla1,uc007afg.1 1 +
chr1 4827081 4827155 Lypla1,uc007afg.1 1 +
chr1 4829467 4829569 Lypla1,uc007afg.1 1 +
chr1 4831036 4832908 Lypla1,uc007afg.1 1 +
chr1 4847894 4848057 Tcea1,uc007afi.1 1 +
chr1 4857550 4857613 Tcea1,uc007afi.1 1 +
chr1 4868107 4868213 Tcea1,uc007afi.1 1 +
chr1 4876824 4876912 Tcea1,uc007afi.1 1 +
chr1 4879537 4879683 Tcea1,uc007afi.1 1 +
chr1 4880820 4880877 Tcea1,uc007afi.1 1 +
chr1 4881995 4882150 Tcea1,uc007afi.1 1 +
chr1 4883497 4883644 Tcea1,uc007afi.1 1 +
chr1 4885014 4885086 Tcea1,uc007afi.1 1 +
chr1 4886436 4887985 Tcea1,uc007afi.1 1 +
chr1 4848118 4848584 Tcea1,uc007afj.1 1 +
chr1 4857550 4857613 Tcea1,uc007afj.1 1 +
chr1 4868107 4868213 Tcea1,uc007afj.1 1 +
chr1 4876824 4876912 Tcea1,uc007afj.1 1 +
chr1 4879537 4879683 Tcea1,uc007afj.1 1 +
chr1 4880820 4880877 Tcea1,uc007afj.1 1 +
chr1 5073253 5073359 Atp6v1h,uc007afn.1 1 +
chr1 5074497 5074644 Atp6v1h,uc007afn.1 1 +
chr1 5079089 5079192 Atp6v1h,uc007afn.1 1 +
chr1 5083443 5083533 Atp6v1h,uc007afn.1 1 +
chr1 5085695 5085809 Atp6v1h,uc007afn.1 1 +
chr1 5088109 5088214 Atp6v1h,uc007afn.1 1 +
chr1 5091150 5091204 Atp6v1h,uc007afn.1 1 +
chr1 5107470 5107568 Atp6v1h,uc007afn.1 1 +
chr1 5114357 5114550 Atp6v1h,uc007afn.1 1 +
chr1 5123164 5123343 Atp6v1h,uc007afn.1 1 +
chr1 5125892 5126018 Atp6v1h,uc007afn.1 1 +
chr1 5133830 5133932 Atp6v1h,uc007afn.1 1 +
chr1 5140028 5140142 Atp6v1h,uc007afn.1 1 +
chr1 5152185 5152630 Atp6v1h,uc007afn.1 1 +
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# annotate
#
- method: annotate
kwargs:
i: a.bed
files: [b.bed, a.bed]
expected: |
chr1 1 100 feature1 0 + 0.000000 1.000000
chr1 100 200 feature2 0 + 0.450000 1.000000
chr1 150 500 feature3 0 - 0.128571 1.000000
chr1 900 950 feature4 0 + 0.020000 1.000000
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# flank
#
- method: flank
kwargs:
i: a.bed
b: 100
genome: hg19
expected: |
chr1 0 1 feature1 0 +
chr1 100 200 feature1 0 +
chr1 0 100 feature2 0 +
chr1 200 300 feature2 0 +
chr1 50 150 feature3 0 -
chr1 500 600 feature3 0 -
chr1 800 900 feature4 0 +
chr1 950 1050 feature4 0 +
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# genomeCoverage
#
- method: genome_coverage
kwargs:
ibam: gdc.bam
#genome: dm3
bg: True
expected: |
chr2L 10 15 1
chr2L 70 75 2
chr2L 140 145 2
chr2L 150 155 1
chr2L 160 165 1
chr2L 210 215 1
# same thing, but auto-detect BAM
- method: genome_coverage
kwargs:
i: gdc.bam
#genome: dm3
bg: True
expected: |
chr2L 10 15 1
chr2L 70 75 2
chr2L 140 145 2
chr2L 150 155 1
chr2L 160 165 1
chr2L 210 215 1
#
# now auto-detect BAM and allow genome
- method: genome_coverage
kwargs:
i: gdc.bam
genome: dm3
bg: True
expected: |
chr2L 10 15 1
chr2L 70 75 2
chr2L 140 145 2
chr2L 150 155 1
chr2L 160 165 1
chr2L 210 215 1
# force BAM and allow genome
- method: genome_coverage
kwargs:
ibam: gdc.bam
genome: dm3
bg: True
expected: |
chr2L 10 15 1
chr2L 70 75 2
chr2L 140 145 2
chr2L 150 155 1
chr2L 160 165 1
chr2L 210 215 1
- method: genome_coverage
kwargs:
i: gdc.bed
genome: dm3
bg: True
expected: |
chr2L 10 15 1
chr2L 70 75 2
chr2L 140 145 2
chr2L 150 155 1
chr2L 160 165 1
chr2L 210 215 1
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# coverage
#
- method: coverage
kwargs:
a: b.bed
b: a.bed
expected: |
chr1 155 200 feature5 0 - 2 45 45 1.0000000
chr1 800 901 feature6 0 + 1 1 101 0.0099010
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# coverage
#
- method: closest
kwargs:
a: a.bed
b: b.bed
expected: |
chr1 1 100 feature1 0 + chr1 155 200 feature5 0 -
chr1 100 200 feature2 0 + chr1 155 200 feature5 0 -
chr1 150 500 feature3 0 - chr1 155 200 feature5 0 -
chr1 900 950 feature4 0 + chr1 800 901 feature6 0 +
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# tagBam
#
- method: tag_bam
kwargs:
i: gdc.bam
files: ['tag_test1.bed', 'tag_test2.bed']
labels: ['1', '2']
expected: |
None 0 chr2L 11 255 5M * 0 0 CGACA IIIII NM:i:0 NH:i:1 YB:Z:1
None 16 chr2L 71 255 5M * 0 0 TTCTC IIIII NM:i:0 NH:i:1 YB:Z:1;2
None 16 chr2L 141 255 5M * 0 0 CACCA IIIII NM:i:0 NH:i:1 YB:Z:1;2
None 16 chr2L 151 255 5M * 0 0 GTTCA IIIII NM:i:0 NH:i:1 YB:Z:2
None 0 chr2L 211 255 5M * 0 0 AAATA IIIII NM:i:0 NH:i:1
None 0 chr2L 71 255 5M * 0 0 GAGAA IIIII NM:i:0 NH:i:1 YB:Z:1;2
None 0 chr2L 141 255 5M * 0 0 TGGTG IIIII NM:i:0 NH:i:1 YB:Z:1;2
None 0 chr2L 161 255 5M * 0 0 GATAA IIIII NM:i:0 NH:i:1 YB:Z:2
- method: tag_bam
kwargs:
i: gdc.bam
files: ['tag_test1.bed', 'tag_test2.bed']
labels: ['1', '2']
s: True
expected: |
None 0 chr2L 11 255 5M * 0 0 CGACA IIIII NM:i:0 NH:i:1 YB:Z:1
None 16 chr2L 71 255 5M * 0 0 TTCTC IIIII NM:i:0 NH:i:1 YB:Z:2
None 16 chr2L 141 255 5M * 0 0 CACCA IIIII NM:i:0 NH:i:1 YB:Z:2
None 16 chr2L 151 255 5M * 0 0 GTTCA IIIII NM:i:0 NH:i:1 YB:Z:2
None 0 chr2L 211 255 5M * 0 0 AAATA IIIII NM:i:0 NH:i:1
None 0 chr2L 71 255 5M * 0 0 GAGAA IIIII NM:i:0 NH:i:1 YB:Z:1
None 0 chr2L 141 255 5M * 0 0 TGGTG IIIII NM:i:0 NH:i:1 YB:Z:1
None 0 chr2L 161 255 5M * 0 0 GATAA IIIII NM:i:0 NH:i:1
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# nucBed
#
- method: nucleotide_content
kwargs:
bed: a.bed
fi: test.fa
expected: |
chr1 1 100 feature1 0 + 0.626263 0.373737 29 21 16 33 0 0 99
chr1 100 200 feature2 0 + 0.710000 0.290000 36 15 14 35 0 0 100
chr1 150 500 feature3 0 - 0.651429 0.348571 136 67 55 92 0 0 350
chr1 900 950 feature4 0 + 0.620000 0.380000 14 6 13 17 0 0 50
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# multiBamCoverage
#
- method: multi_bam_coverage
kwargs:
bed: multibamcov_test.bed
bams: ['gdc.1.100.bam', 'gdc.50.200.bam']
expected: |
chr2L 1 100 + 3 2
chr2L 50 200 - 2 6
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# windowBed
#
- method: window
kwargs:
a: a.bed
b: b.bed
expected: |
chr1 1 100 feature1 0 + chr1 155 200 feature5 0 -
chr1 1 100 feature1 0 + chr1 800 901 feature6 0 +
chr1 100 200 feature2 0 + chr1 155 200 feature5 0 -
chr1 100 200 feature2 0 + chr1 800 901 feature6 0 +
chr1 150 500 feature3 0 - chr1 155 200 feature5 0 -
chr1 150 500 feature3 0 - chr1 800 901 feature6 0 +
chr1 900 950 feature4 0 + chr1 155 200 feature5 0 -
chr1 900 950 feature4 0 + chr1 800 901 feature6 0 +
- method: window
kwargs:
a: a.bed
b: b.bed
Sm: True
expected: |
chr1 1 100 feature1 0 + chr1 155 200 feature5 0 -
chr1 100 200 feature2 0 + chr1 155 200 feature5 0 -
chr1 150 500 feature3 0 - chr1 800 901 feature6 0 +
chr1 900 950 feature4 0 + chr1 155 200 feature5 0 -
- method: window
kwargs:
a: a.bed
b: b.bed
sm: True
expected: |
chr1 1 100 feature1 0 + chr1 800 901 feature6 0 +
chr1 100 200 feature2 0 + chr1 800 901 feature6 0 +
chr1 150 500 feature3 0 - chr1 155 200 feature5 0 -
chr1 900 950 feature4 0 + chr1 800 901 feature6 0 +
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# mapBed
- method: map
kwargs:
a: a.bed
b: d.gff
expected: |
chr1 1 100 feature1 0 + 750
chr1 100 200 feature2 0 + 1025
chr1 150 500 feature3 0 - 875
chr1 900 950 feature4 0 + .
- method: map
kwargs:
a: a.bed
b: d.gff
o: collapse
expected: |
chr1 1 100 feature1 0 + 300,300,150
chr1 100 200 feature2 0 + 300,300,150,275
chr1 150 500 feature3 0 - 300,300,275
chr1 900 950 feature4 0 + .
- method: map
kwargs:
a: a.bed
b: d.gff
o: collapse
c: 3
expected: |
chr1 1 100 feature1 0 + gene,mRNA,CDS
chr1 100 200 feature2 0 + gene,mRNA,CDS,CDS
chr1 150 500 feature3 0 - gene,mRNA,CDS
chr1 900 950 feature4 0 + .
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# clusterBed
- method: cluster
kwargs:
i: a.bed
expected: |
chr1 1 100 feature1 0 + 1
chr1 100 200 feature2 0 + 1
chr1 150 500 feature3 0 - 1
chr1 900 950 feature4 0 + 2
- method: cluster
kwargs:
i: a.bed
d: -10
expected: |
chr1 1 100 feature1 0 + 1
chr1 100 200 feature2 0 + 2
chr1 150 500 feature3 0 - 2
chr1 900 950 feature4 0 + 3
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# bedpeToBam
- method: bedpe_to_bam
kwargs:
i: bedpe.bed
genome: hg19
expected: |
bedpe_example1 97 chr1 101 255 100M chr5 5001 0 * *
bedpe_example1 145 chr5 5001 255 100M chr1 101 0 * *
bedpe_example2 113 chr9 1001 255 4000M = 3001 2000 * *
bedpe_example2 177 chr9 3001 255 800M = 1001 2000 * *
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# pairToPair
- method: pair_to_pair
kwargs:
a: bedpe.bed
b: bedpe2.bed
type: either
expected: |
chr1 100 200 chr5 5000 5100 bedpe_example1 30 + - chr5 5000 5100 chr1 1000 2000 bedpe_example1 - +
chr9 1000 5000 chr9 3000 3800 bedpe_example2 100 - - chr9 3000 3800 chr9 100 500 bedpe_example2 - -
chr9 1000 5000 chr9 3000 3800 bedpe_example2 100 - - chr9 3000 3800 chr9 100 500 bedpe_example2 - -
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# pairToBed
- method: pair_to_bed
kwargs:
a: bedpe.bed
b: b.bed
expected: |
chr1 100 200 chr5 5000 5100 bedpe_example1 30 + - chr1 155 200 feature5 0 -
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# expandCols
#
- method: expand
kwargs:
i: expand_test.bed
c: 5
expected: |
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
#88888888888888888888888888888888888888888888888888888888888888888888888888888
# sample
#
- method: sample
kwargs:
i: gdc.bed
seed: 1
n: 2
expected: |
chr2L 140 145 None 255 -
chr2L 70 75 None 255 -
|