Example #1
0
    def distance_to(self, other):
        """return the distance between two sequence

        this method return the distance between two sequence using
        skbio Sequence class and and distance method. While this
        method can only compute distance between sequence with the same
        length we will delete some of the nucleotide of the longest
        sequence.

        """
        if len(self.sequence) > len(other.sequence):
            cut = len(self.sequence) - len(other.sequence)
            self.sequence = self.sequence[0:-cut]
        elif len(other.sequence) > len(self.sequence):
            cut = len(other.sequence) - len(self.sequence)
            other.sequence = other.sequence[0:-cut]
        else:
            pass

        skseq_self = SkSequence(self.sequence)
        skseq_other = SkSequence(other.sequence)

        return skseq_self.distance(skseq_other)