View Source Bio.BaseSequence (bio_ex_sequence v0.1.1)
Implementations of the basic sequence functionality.
Calling use Bio.BaseSequence
will generate a simple struct in the calling
module, as well as the implementation for the Enumerable
protocol.
Because the Enum
module makes certain assumptions about the data that it is
given, we cannot trust that the functions therein will always behave how it
makes the most sense. As an example, there is no way to ensure that
Enum.slide/3
returns anything other than a list. I believe that it makes
sense for it to return the enumerable type, so you would get e.g. a
Bio.Sequence.DnaStrand
back.
With that said, many of the Enum
module's functions shouldn't make
assumptions. This is largely idiosynctratic, and so instead of trying to
ham-fist the Enum
functions to work, I just wrapped them up with Bio.Enum
.
The implementations in Bio.Enum
rely on the Enum
functions to work, but
they go the extra mile in terms of returning things that seem to make the most
sense. See the documentation of Bio.Enum
for more on that.
This module will also cause new/2
to be defined. This function takes a
sequence as well as the keywords :label
and :length
. For more examples of
using new/2
see Bio.Sequence.AminoAcid
, Bio.Sequence.DnaStrand
, or
Bio.Sequence.RnaStrand
.