Line 196: |
Line 196: |
| For Example: | | For Example: |
| Reference: ACTGAACCTTGGAAACTGCCGGGGACT | | Reference: ACTGAACCTTGGAAACTGCCGGGGACT |
− | Read: ACTGACTGAAACCACT | + | Read: ACTGACTGAAACCATT |
| CIGAR: 4M10N4M3I2M4D3M | | CIGAR: 4M10N4M3I2M4D3M |
| POS: 5 | | POS: 5 |
Line 202: |
Line 202: |
| This means it aligns: | | This means it aligns: |
| Reference: ACTGAACCTTGGAAACTG CCGGGGACT | | Reference: ACTGAACCTTGGAAACTG CCGGGGACT |
− | Read: ACTG ACTGAAACC ACT | + | Read: ACTG ACTGAAACC ATT |
| | | |
| Adding the position: | | Adding the position: |
| RefPos: 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 | | RefPos: 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 |
| Reference: A C T G A A C C T T G G A A A C T G C C G G G G A C T | | Reference: A C T G A A C C T T G G A A A C T G C C G G G G A C T |
− | Read: A C T G A C T G A A A C C A C T | + | Read: A C T G A C T G A A A C C A T T |
| | | |
| Adding the offsets: | | Adding the offsets: |
Line 213: |
Line 213: |
| refOffset: 0 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 | | refOffset: 0 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 |
| Reference: A C T G A A C C T T G G A A A C T G C C G G G G A C T | | Reference: A C T G A A C C T T G G A A A C T G C C G G G G A C T |
− | Read: A C T G A C T G A A A C C A C T | + | Read: A C T G A C T G A A A C C A T T |
| queryIndex: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | | queryIndex: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
| | | |
Line 234: |
Line 234: |
| | | |
| === Determining the Number of Reference and Read/Query Overlaps === | | === Determining the Number of Reference and Read/Query Overlaps === |
| + | |
| + | A useful concept is determining the number of bases that overlap between the reference and the read in a given region. |
| + | |
| + | To do this, use <code>getNumOverlaps</code>, passing in the reference start and end positions for the region as well as the reference position where the read begins. start is inclusive, while end is exclusive. |
| + | |
| + | Using the above example: |
| + | RefPos: 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 |
| + | refOffset: 0 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 |
| + | Reference: A C T G A A C C T T G G A A A C T G C C G G G G A C T |
| + | Read: A C T G A C T G A A A C C A T T |
| + | queryIndex: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
| + | |
| + | getNumOverlaps(5,32,5) = 13 - [5, 32) covers the whole read - 13 cigar positions are "M" (found in both the reference and the read) |
| + | getNumOverlaps(5,31,5) = 12 - skips the last overlapping position |
| + | getNumOverlaps(0,100,5) = 13 - covers the whole read. |
| + | getNumOverlaps(-1, -1,5) = 13 - covers the whole read. |
| + | getNumOverlaps(-1,10,5) = 4 |
| + | getNumOverlaps(10,-1,5) = 9 |
| + | getNumOverlaps(9,19,5) = 0 - all skipped |
| + | getNumOverlaps(9,20,5) = 1 |
| + | getNumOverlaps(9,6,5) = 0 - start is before end |
| + | getNumOverlaps(0,5,5) = 0 - outside of read |
| + | getNumOverlaps(32,40,5) = 0 - outside of read |