ahh yes... that sneaky +1


On Sat, Apr 12, 2014 at 9:45 PM, Greg Caporaso <notifications@github.com>wrote:

> In skbio/core/sequence.py:
>
> > +        ['ACA', 'CAC', 'ACG', 'CGA', 'GAC', 'ACG', 'CGT', 'GTT']
> > +
> > +        """
> > +        if k < 1:
> > +            raise ValueError("k must be greater than 0.")
> > +
> > +        result = []
> > +        sequence_length = len(self)
> > +
> > +        if overlapping:
> > +            step = 1
> > +        else:
> > +            step = k
> > +
> > +        for i in range(0, sequence_length, step):
> > +            if i+k > sequence_length:
>
> That was close, but it's actually slightly different:
>
> for i in range(0, sequence_length - k + 1, step):
>             yield constructor(self[i:i+k])
>
> because we need all words to be exactly length k, so the last slice is
> based on k, not on step (step is used for figuring out the start, and
> differs based on the value of overlapping).
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/biocore/scikit-bio/pull/264/files#r11563175>
> .
>