throttle.Acquire()
go func() {
defer throttle.Release()
- throttle.Report(cmd.annotateSequence(throttle, outch, tilelib, taglen, refname, seqname, refcs[seqname]))
+ throttle.Report(cmd.annotateSequence(throttle, outch, tilelib, taglen, refname, seqname, refcs[seqname], len(refs) > 1))
}()
}
}
return throttle.Err()
}
-func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string, tilelib *tileLibrary, taglen int, refname, seqname string, reftiles []tileLibRef) error {
+func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string, tilelib *tileLibrary, taglen int, refname, seqname string, reftiles []tileLibRef, refnamecol bool) error {
var refseq []byte
// tilestart[123] is the index into refseq
// where the tile for tag 123 was placed.
} else {
varid = fmt.Sprintf("%d", variant)
}
- outch <- fmt.Sprintf("%d\t%s\t%s\t%s:g.%s\n", tag, varid, refname, seqname, diff.String())
+ refnamefield := ""
+ if refnamecol {
+ refnamefield = "\t" + refname
+ }
+ outch <- fmt.Sprintf("%d\t%s%s\t%s:g.%s\n", tag, varid, refnamefield, seqname, diff.String())
}
}()
}
c.Check(annotateout.Len() > 0, check.Equals, true)
sorted := sortLines(annotateout.String())
c.Logf("%s", sorted)
- c.Check(sorted, check.Equals, sortLines(`0 8d4fe9a63921b testdata/ref.fasta chr1:g.161A>T
-0 8d4fe9a63921b testdata/ref.fasta chr1:g.178A>T
-0 8d4fe9a63921b testdata/ref.fasta chr1:g.1_3delinsGGC
-0 8d4fe9a63921b testdata/ref.fasta chr1:g.222_224del
-0 ba4263ca4199c testdata/ref.fasta chr1:g.1_3delinsGGC
-0 ba4263ca4199c testdata/ref.fasta chr1:g.222_224del
-0 ba4263ca4199c testdata/ref.fasta chr1:g.41_42delinsAA
-1 139890345dbb8 testdata/ref.fasta chr1:g.302_305delinsAAAA
-4 cbfca15d241d3 testdata/ref.fasta chr2:g.125_127delinsAAA
-4 cbfca15d241d3 testdata/ref.fasta chr2:g.1_3delinsAAA
-4 f5fafe9450b02 testdata/ref.fasta chr2:g.241_245delinsAAAAA
-4 f5fafe9450b02 testdata/ref.fasta chr2:g.291C>A
-4 fe9a71a42adb4 testdata/ref.fasta chr2:g.125_127delinsAAA
-6 e36dce85efbef testdata/ref.fasta chr2:g.471_472delinsAA
-6 f81388b184f4a testdata/ref.fasta chr2:g.470_472del
+ c.Check(sorted, check.Equals, sortLines(`0 8d4fe9a63921b chr1:g.161A>T
+0 8d4fe9a63921b chr1:g.178A>T
+0 8d4fe9a63921b chr1:g.1_3delinsGGC
+0 8d4fe9a63921b chr1:g.222_224del
+0 ba4263ca4199c chr1:g.1_3delinsGGC
+0 ba4263ca4199c chr1:g.222_224del
+0 ba4263ca4199c chr1:g.41_42delinsAA
+1 139890345dbb8 chr1:g.302_305delinsAAAA
+4 cbfca15d241d3 chr2:g.125_127delinsAAA
+4 cbfca15d241d3 chr2:g.1_3delinsAAA
+4 f5fafe9450b02 chr2:g.241_245delinsAAAAA
+4 f5fafe9450b02 chr2:g.291C>A
+4 fe9a71a42adb4 chr2:g.125_127delinsAAA
+6 e36dce85efbef chr2:g.471_472delinsAA
+6 f81388b184f4a chr2:g.470_472del
`))
}