Skip to content

More strict ruels for context simplifier #6

@davidmasp

Description

@davidmasp

in the function helperMut::simplify_ctx

k = unique((nchar(ctx) - 1)/2)
stopifnot(k%%1 == 0)

then add this function:

simplify_ctx_any <- function(x, k, ref_set = c("TT", "CC", "CT", "TC")){
  bigK = nchar(x)
  cpl = bigK - (k*2)
  # they are both inclusive
  cpi = k + 1
  cpe = k+cpl
  
  cp_str = stringr::str_sub(x, cpi, cpe)
  mask = cp_str %in% ref_set
  Biostrings::DNAStringSet(x) %>% Biostrings::reverseComplement() %>% 
    as.character() -> rc
  ifelse(mask, 
         x,
         rc) -> result_simpl
  return(result_simpl)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions