本文整理汇总了Golang中github.com/brentp/irelate/interfaces.Relatable.Source方法的典型用法代码示例。如果您正苦于以下问题:Golang Relatable.Source方法的具体用法?Golang Relatable.Source怎么用?Golang Relatable.Source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/brentp/irelate/interfaces.Relatable
的用法示例。
在下文中一共展示了Relatable.Source方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AnnotateEnds
// AnnotateEnds makes a new 1-base interval for the left and one for the right end
// so that it can use the same machinery to annotate the ends and the entire interval.
// Output into the info field is prefixed with "left_" or "right_".
func (a *Annotator) AnnotateEnds(v interfaces.Relatable, ends string) error {
var err error
// if Both, call the interval, left, and right version to annotate.
if ends == BOTH {
if e := a.AnnotateOne(v, a.Strict); e != nil {
err = e
}
if e := a.PostAnnotate(v.Chrom(), int(v.Start()), int(v.End()), v.(interfaces.IVariant).Info(), ""); e != nil {
err = e
}
if e := a.AnnotateEnds(v, LEFT); e != nil {
err = e
}
if e := a.AnnotateEnds(v, RIGHT); e != nil {
err = e
}
}
if ends == INTERVAL {
err := a.AnnotateOne(v, a.Strict)
err2 := a.PostAnnotate(v.Chrom(), int(v.Start()), int(v.End()), v.(interfaces.IVariant).Info(), "")
if err != nil {
return err
}
return err2
}
// hack:
// modify the variant in-place to create a 1-base variant at the end of
// the interval. annotate that end and then change the position back to what it was.
if ends == LEFT || ends == RIGHT {
// the end is determined by the SVLEN, so we have to make sure it has length 1.
variant := v.(*parsers.Variant).IVariant
var l, r uint32
var ok bool
if ends == LEFT {
l, r, ok = variant.CIPos()
} else {
l, r, ok = variant.CIEnd()
}
// dont reannotate same interval
if !ok && (l == v.Start() && r == v.End()) {
return nil
}
m := vcfgo.NewInfoByte([]byte(fmt.Sprintf("SVLEN=%d;END=%d", r-l-1, r)), variant.(*vcfgo.Variant).Header)
v2 := parsers.NewVariant(&vcfgo.Variant{Chromosome: v.Chrom(), Pos: uint64(l + 1),
Reference: "A", Alternate: []string{"<DEL>"}, Info_: m}, v.Source(), v.Related())
err = a.AnnotateOne(v2, false, ends)
var val interface{}
for _, key := range v2.Info().Keys() {
if key == "SVLEN" || key == "END" {
continue
}
val, err = v2.Info().Get(key)
variant.Info().Set(key, val)
}
err2 := a.PostAnnotate(v.Chrom(), int(l), int(r), variant.Info(), ends)
if err2 != nil {
err = err2
}
}
return err
}