Using sequtils.Stitch

14 views
Skip to first unread message

aboffin

unread,
May 2, 2017, 10:53:55 AM5/2/17
to biogo-user
Hi,

I am trying to use the Stitch function from sequtils following the example given in: biogo/seq/sequtils/example_test.go:

func ExampleStitch() {
        s := stringToConformRangeOffSlice("aAGTATAAgtcagtgcagtgtctggcagTGCTCGTGCgtagtgaagtagGGTTAGTTTa")
        f
:= fs{
                fe
{s: 1, e: 8},
                fe
{s: 28, e: 37},
                fe
{s: 49, e: len(s.slice) - 1},
       
}
        fmt
.Printf("%s\n", s)
       
if err := Stitch(s, s, f); err == nil {
                fmt
.Printf("%s\n", s)
       
}
       
// Output:
       
// aAGTATAAgtcagtgcagtgtctggcagTGCTCGTGCgtagtgaagtagGGTTAGTTTa
       
// AGTATAATGCTCGTGCGGTTAGTTT
}


I am unable to determine how to assign the Start and End positions of the sequence. I tried reading seq/sequtils/utils.go and feat/feature.go, but it is unclear how to use feat.Set

Thanks in advance for any pointers and clue sticks.

Sincerely,
Senthil

Dan Kortschak

unread,
May 2, 2017, 10:28:25 PM5/2/17
to aboffin, biogo-user
fs is defined here[1] and fe is defined here[2], so you need to define
types like them that satisfy feat.Feature[3] and feat.Set[4]. Note that
feat.Set is just a value that can return a set of feature with its
Features method.

The start and end are set in the provided sequence types by the
SetOffset method (or via the .Annotation.Offset field directly if you
have a concrete type). This specifies the start and the end is then
calculated based on the start and the length of the sequence.


[1]https://github.com/biogo/biogo/blob/master/seq/sequtils/utils_test.go#L187-L189
[2]https://github.com/biogo/biogo/blob/master/seq/sequtils/utils_test.go#L176-L185
[3]https://godoc.org/github.com/biogo/biogo/feat#Feature
[4]https://godoc.org/github.com/biogo/biogo/feat#Set

aboffin

unread,
May 3, 2017, 3:18:38 AM5/3/17
to biogo-user, senthil.m...@inra.fr
Thank you Dan, I had overlooked the definitions of fs and fe! I am able to use Stitch with my test data now.

Senthil
Reply all
Reply to author
Forward
0 new messages