Skip to content

Commit 2f3d65a

Browse files
committed
Fix '##INFO=<>'
1 parent 00aa28b commit 2f3d65a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ BUG FIXES
4444
alt. alleles and the AC for the ref. alleles, when a dosage GDS file is
4545
used; a new 'alt' is used to specify the ref. or alt. alleles.
4646

47+
o Fix '##INFO=<>' in the output of `seqGDS2VCF()` when the INFO variable is
48+
added by users
49+
4750

4851
CHANGES IN VERSION 1.48.0
4952
-------------------------

R/Conversion.R

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,12 @@ seqGDS2VCF <- function(gdsfile, vcf.fn, info.var=NULL, fmt.var=NULL,
209209
# INFO field
210210
for (nm in z$info$ID)
211211
{
212-
a <- get.attr.gdsn(index.gdsn(gdsfile,
213-
paste("annotation/info/", nm, sep="")))
212+
nd <- index.gdsn(gdsfile, paste0("annotation/info/", nm))
213+
a <- get.attr.gdsn(nd)
214214
if (is.null(a$Number))
215-
{
216-
}
215+
a$Number <- z$info$Number[which(z$info$ID == nm)]
217216
if (is.null(a$Type))
218-
{
219-
}
217+
a$Type <- z$info$Type[which(z$info$ID == nm)]
220218
s <- sprintf("ID=%s,Number=%s,Type=%s,Description=%s",
221219
nm, .dquote(a$Number), .dquote(a$Type), .dquote(a$Description))
222220
if (!is.null(a$Source))
@@ -246,9 +244,12 @@ seqGDS2VCF <- function(gdsfile, vcf.fn, info.var=NULL, fmt.var=NULL,
246244
a$VariableName, .dquote(a$Description)))
247245
for (nm in z$format$ID)
248246
{
249-
a <- get.attr.gdsn(index.gdsn(gdsfile,
250-
paste("annotation/format/", nm, sep="")))
251-
# ToDo
247+
nd <- index.gdsn(gdsfile, paste0("annotation/format/", nm))
248+
a <- get.attr.gdsn(nd)
249+
if (is.null(a$Number))
250+
a$Number <- z$format$Number[which(z$format$ID == nm)]
251+
if (is.null(a$Type))
252+
a$Type <- z$format$Type[which(z$format$ID == nm)]
252253
txt <- c(txt, sprintf(
253254
"##FORMAT=<ID=%s,Number=%s,Type=%s,Description=%s>",
254255
nm, .dquote(a$Number), .dquote(a$Type), .dquote(a$Description)))

0 commit comments

Comments
 (0)