sortAlleles - Sort allele names

Description

sortAlleles returns a sorted vector of strings respresenting Ig allele names. Names are first sorted by gene family, then by gene, then by allele. Duplicated genes have their alleles are sorted as if they were part of their non-duplicated counterparts (e.g. IGHV1-69D01 comes after IGHV1-6901 but before IGHV1-6902), and non-localized genes (e.g. IGHV1-NL101) come last within their gene family.

Usage

sortAlleles(allele_calls, method = c("name", "position"))

Arguments

allele_calls
a vector of strings respresenting Ig allele names
method
a string defining the method to use when sorting alleles. If "name" then sort in lexicographic order. If "position" then sort by position in the locus, as determined by the final two numbers in the gene name.

Value

A sorted vector of strings respresenting Ig allele names

Examples

# Create a list of allele names
alleles = c("IGHV1-69D*01","IGHV1-69*01","IGHV1-2*01","IGHV1-69-2*01",
"IGHV2-5*01","IGHV1-NL1*01", "IGHV1-2*01,IGHV1-2*05", 
"IGHV1-2", "IGHV1-2*02", "IGHV1-69*02")

# Sort the alleles by name
sortAlleles(alleles)

 [1] "IGHV1-2"               "IGHV1-2*01"            "IGHV1-2*01,IGHV1-2*05" "IGHV1-2*02"            "IGHV1-69*01"          
 [6] "IGHV1-69D*01"          "IGHV1-69*02"           "IGHV1-69-2*01"         "IGHV1-NL1*01"          "IGHV2-5*01"           


# Sort the alleles by position in the locus
sortAlleles(alleles, method="pos")
 [1] "IGHV1-NL1*01"          "IGHV1-69-2*01"         "IGHV1-69*01"           "IGHV1-69D*01"          "IGHV1-69*02"          
 [6] "IGHV2-5*01"            "IGHV1-2"               "IGHV1-2*01"            "IGHV1-2*01,IGHV1-2*05" "IGHV1-2*02"           

See also

Like sortAlleles, updateAlleleNames can help format a list of allele names.