projects
/
lightning.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0bf5a0d
)
Avoid empty "ref" field in anno2vcf output.
author
Tom Clegg <tom@tomclegg.ca>
Mon, 1 Nov 2021 14:00:38 +0000
(10:00 -0400)
committer
Tom Clegg <tom@tomclegg.ca>
Mon, 1 Nov 2021 14:42:05 +0000
(10:42 -0400)
refs #17763
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
anno2vcf.go
patch
|
blob
|
history
slicenumpy.go
patch
|
blob
|
history
diff --git
a/anno2vcf.go
b/anno2vcf.go
index 47af7e5caf55ea81d566a6dd7a15e4b979b2899b..3be030036d7c20f817f95a43439a24aa6a5f8f4b 100644
(file)
--- a/
anno2vcf.go
+++ b/
anno2vcf.go
@@
-131,8
+131,8
@@
func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
return nil
}
fields := bytes.Split(line, []byte{','})
return nil
}
fields := bytes.Split(line, []byte{','})
- 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)
+ 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)
}
tile, _ := strconv.ParseInt(string(fields[0]), 10, 64)
variant, _ := strconv.ParseInt(string(fields[2]), 10, 64)
}
tile, _ := strconv.ParseInt(string(fields[0]), 10, 64)
variant, _ := strconv.ParseInt(string(fields[2]), 10, 64)
@@
-141,12
+141,27
@@
func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
if calls[seq] == nil {
calls[seq] = make([]*call, 0, len(lines)/50)
}
if calls[seq] == nil {
calls[seq] = make([]*call, 0, len(lines)/50)
}
+ del := fields[6]
+ ins := fields[7]
+ if len(del) == 0 && len(fields) >= 9 {
+ // "123,,AA,T" means 123insAA
+ // preceded by T. We record it
+ // here as 122TdelinsTAA to
+ // avoid writing an empty
+ // "ref" field in our VCF.
+ del = append([]byte(nil), fields[8]...)
+ ins = append(append([]byte(nil), del...), ins...)
+ position -= int64(len(del))
+ } else {
+ del = append([]byte(nil), del...)
+ ins = append([]byte(nil), ins...)
+ }
calls[seq] = append(calls[seq], &call{
tile: int(tile),
variant: int(variant),
position: int(position),
calls[seq] = append(calls[seq], &call{
tile: int(tile),
variant: int(variant),
position: int(position),
- deletion:
append([]byte(nil), fields[6]...)
,
- insertion:
append([]byte(nil), fields[7]...)
,
+ deletion:
del
,
+ insertion:
ins
,
})
}
mtx.Lock()
})
}
mtx.Lock()
diff --git
a/slicenumpy.go
b/slicenumpy.go
index 5aa97ac5a7c44707b03720ac6631eaa03599ce54..fff70d7379f81aa90e50c2d917bbf5c268ffee7a 100644
(file)
--- a/
slicenumpy.go
+++ b/
slicenumpy.go
@@
-349,7
+349,7
@@
func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
diffs, _ := hgvs.Diff(reftilestr, strings.ToUpper(string(tv.Sequence)), 0)
for _, diff := range diffs {
diff.Position += rt.pos
diffs, _ := hgvs.Diff(reftilestr, strings.ToUpper(string(tv.Sequence)), 0)
for _, diff := range diffs {
diff.Position += rt.pos
- fmt.Fprintf(annow, "%d,%d,%d,%s:g.%s,%s,%d,%s,%s
\n", tag, outcol, remap[v], rt.seqname, diff.String(), rt.seqname, diff.Position, diff.Ref, diff.New
)
+ fmt.Fprintf(annow, "%d,%d,%d,%s:g.%s,%s,%d,%s,%s
,%s\n", tag, outcol, remap[v], rt.seqname, diff.String(), rt.seqname, diff.Position, diff.Ref, diff.New, diff.Left
)
}
}
}
}
}
}