Skip to content

Commit 5f66532

Browse files
committed
new option 'all' in hlaUniqueAllele()
1 parent bd0d457 commit 5f66532

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: HIBAG
22
Type: Package
33
Title: HLA Genotype Imputation with Attribute Bagging
4-
Version: 1.38.4
5-
Date: 2024-03-11
4+
Version: 1.39.4
5+
Date: 2024-03-14
66
Depends: R (>= 3.2.0)
77
Imports: methods, RcppParallel
88
Suggests: parallel, ggplot2, reshape2, gdsfmt, SNPRelate, SeqArray, knitr,

NEWS

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
CHANGES IN VERSION 1.39.4
2+
-------------------------
3+
4+
o new option 'all' in `hlaUniqueAllele()`
5+
6+
17
CHANGES IN VERSION 1.38.3
28
-------------------------
39

R/DataUtilities.R

+14-2
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ hlaAlleleDigit <- function(obj, max.resolution=NA_character_, rm.suffix=FALSE)
11361136
# Get unique HLA alleles
11371137
#
11381138

1139-
hlaUniqueAllele <- function(hla)
1139+
hlaUniqueAllele <- function(hla, all=NA)
11401140
{
11411141
# check
11421142
stopifnot(is.character(hla) | inherits(hla, "hlaAlleleClass"))
@@ -1147,7 +1147,19 @@ hlaUniqueAllele <- function(hla)
11471147
hla <- unique(hla)
11481148
.Call(HIBAG_SortAlleleStr, hla)
11491149
} else {
1150-
hlaUniqueAllele(as.character(c(hla$value$allele1, hla$value$allele2)))
1150+
s <- c(hla$value$allele1, hla$value$allele2)
1151+
if (isTRUE(all))
1152+
{
1153+
if (!is.null(hla$dosage))
1154+
{
1155+
s <- rownames(hla$dosage)
1156+
} else if (!is.null(hla$postprob))
1157+
{
1158+
s <- strsplit(rownames(hla$postprob), "/", fixed=TRUE)
1159+
s <- unique(unlist(s))
1160+
}
1161+
}
1162+
hlaUniqueAllele(as.character(s))
11511163
}
11521164
}
11531165

man/hlaUniqueAllele.Rd

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
Get unique HLA alleles, which are in ascending order.
88
}
99
\usage{
10-
hlaUniqueAllele(hla)
10+
hlaUniqueAllele(hla, all=NA)
1111
}
1212
\arguments{
13-
\item{hla}{character-type HLA alleles, or a
14-
\code{\link{hlaAlleleClass}} object}
13+
\item{hla}{character-type HLA alleles, or a \code{\link{hlaAlleleClass}}
14+
object}
15+
\item{all}{when \code{hla} is a \code{hlaAlleleClass} object and
16+
\code{all=TRUE}, return all HLA alleles if \code{hla$dosage} or
17+
\code{hla$postprob} exists; otherwise, only return the alleles in
18+
\code{hla$value}}
1519
}
1620
\details{
1721
Each HLA allele name has a unique number corresponding to up to four sets

0 commit comments

Comments
 (0)