Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions to align flanks of breakpoing regions. #19

Open
charles-plessy opened this issue Jun 2, 2022 · 0 comments
Open

Functions to align flanks of breakpoing regions. #19

charles-plessy opened this issue Jun 2, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@charles-plessy
Copy link
Collaborator

                   TSD
query       …──────────━━━━━─────────━━━━━─────────────…
alignment    ...............              .............
target      …──────────━━━━━              ─────────────…

Service functions

Align breakpoints

pat          ++++
range  --------==========----------
sub                    ++++             (or ---- if rev = F)
alignBreakPoints <- function(gr, n = 20, reverseComplement = FALSE) {
  if (isFALSE(reverseComplement)) reverseComplement <- identity
  pairwiseAlignment(getSeq(gr |> flank(n, both = T, start = T)),
                    getSeq(gr |> flank(n, both = T, start = F)) |> reverseComplement(),
                    type="global")
}

Align ends

pat            ++++
range  --------==========----------
sub                  ++++             (or ---- if rev = F)
alignEnds <- function(gr, n = 20, reverseComplement = FALSE) {
  resize_ <- function(...) resize(...) |> trim() |> suppressWarnings()
  if (isFALSE(reverseComplement)) reverseComplement <- identity
  pairwiseAlignment(getSeq(gr |> resize_(n, fix = "start")),
                    getSeq(gr |> resize_(n, fix = "end")) |> reverseComplement(),
                    type="global")
}

Search for TSDs

pat            +
range  --------==========----------
sub                      +         
searchForTSDs <- function(gr, n = 8) {
  pairwiseAlignment(getSeq(gr |> resize(n, fix = "start")),
                    getSeq(gr |>  flank(n, start = F)),
                    type="global")
}

Align indels

                          ++++          ++++
query       …──────────────────────────────────────────…
target      …───────────────              ─────────────…
                          ++..............++
alignInDel <- function(gb) {
  list(
    q_l = getSeq(gb$query[1] |> flank(20, both = T, start = T))[[1]],
    trg = getSeq(gb[1]       |> flank(20, both = T, start = F))[[1]],
    q_r = getSeq(gb$query[2] |> flank(20, both = T, start = F))[[1]]
  ) |> as("DNAStringSet") |> msa::msaClustalW(order = "input")
}

Align to self

alignToSelf <- function(gr) {
  pairwiseAlignment(getSeq(gr),
                    getSeq(gr) |> reverseComplement(),
                    type="global")
}
@charles-plessy charles-plessy added the enhancement New feature or request label Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant