@@ -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