R/data_management.R

#' Filters the input sequences to only return data that meets a criteria
#'
#' @param name A dummy variable that can be filled in to aid code readibility
#' @param seq_data The sequence data to filter
#' @param grep_pattern The pattern that will be used to search for the data to
#' report
#' @export

get_data_of <- function(name = NULL, seq_data, grep_pattern){
  return(seq_data[grep(grep_pattern, names(seq_data))])
}

#' Get all the unique points of a specific criteria in the data (typically time
#' points)
#'
#' @param name A dummy variable that can be filled in to aid code readibility
#' @param seq_data The sequence data to filter
#' @param sep The separator using in the FASTA headers
#' @param indx The index in the FASTA header of the information to separate the
#' points on.
#' @export

get_unique_points_of <- function(name = NULL, seq_data, sep = '_', indx = 1){
  return(unique(unlist(lapply(strsplit(names(seq_data), sep), `[[`, indx))))
}
philliplab/toolmania documentation built on May 25, 2019, 5:06 a.m.