Include HGVS IDs in anno2vcf.
authorTom Clegg <tom@curii.com>
Mon, 13 Dec 2021 15:29:56 +0000 (10:29 -0500)
committerTom Clegg <tom@curii.com>
Mon, 13 Dec 2021 15:29:56 +0000 (10:29 -0500)
refs #18579

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

anno2vcf.go

index a1a320ff34e2e2f592e4f385769c8b46cc917821..4b1295f5c0aa7102049156dfdf9b4c3b390ee173 100644 (file)
@@ -105,6 +105,7 @@ func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
                position  int
                deletion  []byte
                insertion []byte
+               hgvsID    []byte
        }
        allcalls := map[string][]*call{}
        var mtx sync.Mutex
@@ -134,6 +135,12 @@ func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
                                if len(fields) < 8 {
                                        return fmt.Errorf("%s line %d: wrong number of fields (%d < %d): %q", fi.Name(), lineIdx+1, len(fields), 8, line)
                                }
+                               hgvsID := fields[3]
+                               if len(hgvsID) < 2 {
+                                       // "=" reference or ""
+                                       // non-diffable tile variant
+                                       continue
+                               }
                                tile, _ := strconv.ParseInt(string(fields[0]), 10, 64)
                                variant, _ := strconv.ParseInt(string(fields[2]), 10, 64)
                                position, _ := strconv.ParseInt(string(fields[5]), 10, 64)
@@ -165,6 +172,7 @@ func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
                                        position:  int(position),
                                        deletion:  del,
                                        insertion: ins,
+                                       hgvsID:    hgvsID,
                                })
                        }
                        mtx.Lock()
@@ -238,7 +246,7 @@ func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
                                if len(insertion) == 0 {
                                        insertion = placeholder
                                }
-                               _, err = fmt.Fprintf(bufw, "%s\t%d\t.\t%s\t%s\t.\t.\t%s\n", seq, call.position, deletion, insertion, info)
+                               _, err = fmt.Fprintf(bufw, "%s\t%d\t%s\t%s\t%s\t.\t.\t%s\n", seq, call.position, call.hgvsID, deletion, insertion, info)
                                if err != nil {
                                        return err
                                }