Move the notional position of a deletion or insertion as far left as possible.
Source:R/justify_indel.R
justify_indel.Rdshort_string should be generated by a deletion in long-str at (1-based) position pos. If supplied, the expected_delta should be the deleted sequence. If expected_delta is not NULL, the function checks this and aborts if this is not the case.
Dually, pos is the 1-based position in short string in front o which one can make an insertion to get long_str.
This function moves pos as far to left as possible so that a deletion at that position still results in an edit of long_str to generate short_str.
Value
A list with elements
leftmost_pos
del_string
del_string_plus del_string plus one base to the left the position of that base to the left is leftmost_pos - 1
edge_warning See the third example. We are not sure how far to the left we could have moved the indel if we had more context on the left.
error if non-NULL we did not see the expected value for expected_delta
Examples
justify_indel("CAAAG", "CAAG", pos = 2, expected_delta = "A")
#> $leftmost_pos
#> [1] 2
#>
#> $del_str
#> [1] "A"
#>
#> $del_str_plus
#> [1] "CA"
#>
#> $edge_warning
#> [1] FALSE
#>
#> $error
#> NULL
#>
justify_indel("CAAAG", "CAAG", pos = 3, expected_delta = "A")
#> $leftmost_pos
#> [1] 2
#>
#> $del_str
#> [1] "A"
#>
#> $del_str_plus
#> [1] "CA"
#>
#> $edge_warning
#> [1] FALSE
#>
#> $error
#> NULL
#>
justify_indel("CACAG", "CAG", pos = 3, expected_delta = "CA")
#> $leftmost_pos
#> [1] 2
#>
#> $del_str
#> [1] "AC"
#>
#> $del_str_plus
#> [1] "CAC"
#>
#> $edge_warning
#> [1] TRUE
#>
#> $error
#> NULL
#>