Skip to content

Commit f0ab859

Browse files
committed
update docs with alignment pos introduced by #44
1 parent 5a3354e commit f0ab859

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

docs/src/alignments.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ section.
3333
To represent an alignment we use a series of "anchors" stored in the
3434
`AlignmentAnchor` type. Anchors are form of run-length encoding alignment
3535
operations, but rather than store an operation along with a length, we store the
36-
end-point of that operation in both reference and query coordinates.
36+
end-point of that operation in query (`seqpos`), reference (`refpos`) and
37+
alignment (`alnpos`) coordinates.
3738

3839
```julia
3940
struct AlignmentAnchor
4041
seqpos::Int
4142
refpos::Int
43+
alnpos::Int
4244
op::Operation
4345
end
4446
```
@@ -56,30 +58,31 @@ For example, consider the following alignment:
5658
0 4 9 12 15 19
5759
| | | | | |
5860
query: TGGC----ATCATTTAACG---CAAG
61+
alignment: ....----.....---...---....
5962
reference: AGGGTGGCATTTATCAG---ACGTTTCGAGAC
6063
| | | | | | |
6164
4 8 12 17 20 23 27
6265

6366
Using anchors we would represent this as the following series of anchors:
6467
```julia
6568
[
66-
AlignmentAnchor( 0, 4, OP_START),
67-
AlignmentAnchor( 4, 8, OP_MATCH),
68-
AlignmentAnchor( 4, 12, OP_DELETE),
69-
AlignmentAnchor( 9, 17, OP_MATCH),
70-
AlignmentAnchor(12, 17, OP_INSERT),
71-
AlignmentAnchor(15, 20, OP_MATCH),
72-
AlignmentAnchor(15, 23, OP_DELETE),
73-
AlignmentAnchor(19, 27, OP_MATCH),
69+
AlignmentAnchor( 0, 4, 0, OP_START),
70+
AlignmentAnchor( 4, 8, 4, OP_MATCH),
71+
AlignmentAnchor( 4, 12, 8, OP_DELETE),
72+
AlignmentAnchor( 9, 17, 13, OP_MATCH),
73+
AlignmentAnchor(12, 17, 16, OP_INSERT),
74+
AlignmentAnchor(15, 20, 19, OP_MATCH),
75+
AlignmentAnchor(15, 23, 22, OP_DELETE),
76+
AlignmentAnchor(19, 27, 26, OP_MATCH),
7477
]
7578
```
7679

7780
An `Alignment` object can be created from a series of anchors:
7881
```jldoctest
7982
julia> Alignment([
80-
AlignmentAnchor(0, 4, OP_START),
81-
AlignmentAnchor(4, 8, OP_MATCH),
82-
AlignmentAnchor(4, 12, OP_DELETE)
83+
AlignmentAnchor(0, 4, 0, OP_START),
84+
AlignmentAnchor(4, 8, 4, OP_MATCH),
85+
AlignmentAnchor(4, 12, 8, OP_DELETE)
8386
])
8487
Alignment:
8588
aligned range:
@@ -140,9 +143,9 @@ alignment:
140143
julia> AlignedSequence( # pass an Alignment object
141144
dna"ACGTAT",
142145
Alignment([
143-
AlignmentAnchor(0, 0, OP_START),
144-
AlignmentAnchor(3, 3, OP_MATCH),
145-
AlignmentAnchor(6, 3, OP_INSERT)
146+
AlignmentAnchor(0, 0, 0, OP_START),
147+
AlignmentAnchor(3, 3, 3, OP_MATCH),
148+
AlignmentAnchor(6, 3, 6, OP_INSERT)
146149
])
147150
)
148151
···---
@@ -151,9 +154,9 @@ ACGTAT
151154
julia> AlignedSequence( # or pass a vector of anchors
152155
dna"ACGTAT",
153156
[
154-
AlignmentAnchor(0, 0, OP_START),
155-
AlignmentAnchor(3, 3, OP_MATCH),
156-
AlignmentAnchor(6, 3, OP_INSERT)
157+
AlignmentAnchor(0, 0, 0, OP_START),
158+
AlignmentAnchor(3, 3, 3, OP_MATCH),
159+
AlignmentAnchor(6, 3, 6, OP_INSERT)
157160
]
158161
)
159162
···---

0 commit comments

Comments
 (0)