brentp / vcfgo

a golang library to read, write and manipulate files in the variant call format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

INFO with `Number=.,Type=String` parsed as `string` or `[]string`.

liserjrqlxue opened this issue · comments

I parse INFO.CSQ with header line ##INFO=<ID=CSQ,Number=.,Type=String,Description=".
I found that variant.Info_.Get("CSQ") will return interface{} as string or []string.
I use switch to handle this uncertain.

switch csqInfos.(type){
case string:
  // handle as string
case []string:
  // handle as []string
}

I wonder if there are more efficient and simpler way.

Yes, that's probably the best way. Is there a reason you're using Info_ instead of Info ?

I found v.Info() is a function simply return v.Info_.
Since Info is public, I use it directly.
Emmm, is using struct method more general and more stable?

Yes, it's fine to use v.INFO_. I haven't done any development on vcfgo for a while so I had forgotten.