R/searchPublished.R

Defines functions searchPublished

Documented in searchPublished

#' Search for T cell receptor beta CDR3 amino acid sequences with known antigen 
#' specificity
#' 
#' Search for published T cell receptor beta CDR3 amino acid sequences with 
#' known antigen specificity in a list of data frames.
#' 
#' @param study_table A tibble generated by the LymphoSeq functions 
#' readImmunoSeq or productiveSeq.  "junction_aa", "frequencyCount", and "count" 
#' are required columns.
#' @return Returns a data frame of each repertoire_id name and instance in the repertoire_id 
#' that the published TCR sequence appeared along with additional 
#' information including antigen specificity, epitope, HLA type, and PubMed ID 
#' (PMID) for the reference where the sequence was characterized.  The 
#' publishedTRB database is located in a separate package called LymphoSeqDB 
#' that should be loaded automatically.
#' @examples
#' file_path <- system.file("extdata", "TCRB_sequencing", package = "LymphoSeq2
#' stable <- readImmunoSeq(path = file_path)
#' atable <- productiveSeq(study_table = stable, aggregate = "junction_aa")
#' searchPublished(atable)
#' @seealso Refer to the LymphoSeqDB package for details regarding the 
#' publishedTRB database.
#' @export
#' @import tidyverse
searchPublished <- function(study_table) {
    study_table <- dplyr::left_join(study_table, LymphoSeq2ishedTRB,
                                    by=c("junction_aa" = "aminoAcid"))
    return(study_table)
}
elulu3/LymphoSeqTest documentation built on Aug. 27, 2022, 5:47 a.m.