R/prot_seq_check.R

Defines functions prot_seq_check

Documented in prot_seq_check

prot_seq_check <- function(prot_seq, label = NULL) {
    result <- NULL
    
    if (!is.null(label)) {
        if (length(prot_seq) != length(label)) {
            stop("check the number of samples")
        }
    }
    
    check <- NULL
    for (i in seq_len(length(prot_seq))) {
        check[i] <- grepl("^[A-Z-]+$", prot_seq[i])
    }
    
    if (!all(check)) {
        result$removed_prot_seq <- which(!check)
        message("at least one of protein sequences may not be valid")
    }
    
    result$prot_seq <- prot_seq[check]
    result$label <- label[check]
    result
}
dongminjung/GenProSeq documentation built on May 3, 2022, 10:28 p.m.