R/count_n_tmhs.R

Defines functions count_n_tmhs

Documented in count_n_tmhs

#' Count the number of TMHs in a topology
#' @inheritParams default_params_doc
#' @examples
#' count_n_tmhs("00000000000000000000000000")
#' count_n_tmhs("00000000001111100000000000")
#' count_n_tmhs(c("0", "1"))
#' @export
count_n_tmhs <- function(topology_strs) {
  stringr::str_count(topology_strs, "01") +
    (substring(topology_strs, 1, 1) == "1")
}

Try the pureseqtmr package in your browser

Any scripts or data that you put into this service are public.

pureseqtmr documentation built on April 6, 2023, 5:20 p.m.