#' Length of the first M-region
#'
#' If a probe maps exon-exon border region of a transcript,
#' it does not appear in the Genomic Alignment as a mapping with
#' CIGAR = "25M", but as mapping with xxM in the beginning of
#' the CIGAR string, and xxM in the end,
#' which represents length of the regions mapped
#' to the left and right exons correspondingly.
#' The \code{cigar2_left} function gets length of the left exon mapping,
#' if CIGAR string has <integer>M in the left-most position.
#'
#' @title cigar - to - length of the left exon mapping
#' @param cigar_string CIGAR character string
#' @return returns \code{integer}.
#' @seealso \code{cigar2_right}, \code{cigar2length}
#' @author Vladislava Milchevskaya \email{milchv@gmail.com}
cigar2_left <- function(cigar_string)
{
M_values = as.numeric(unlist(stringr::str_extract_all(
stringr::str_extract_all(cigar_string, "^[0-9]+[M]"), "[0-9]+")))
return(M_values)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.