code: def _filter_variant_motif_res(
      motif_res, 
      variant_start, 
      variant_end, 
      motif_length, 
      seq,
  ):
      
      import MOODS
      remove = []
      for r in motif_res:
          motif_start = r[0]
          motif_end = r[0] + motif_length
          if r[0] < 0:
              motif_start += len(seq)
              motif_end += len(seq)
  
          if motif_end <= variant_start or motif_start >= variant_end:
              remove.append(r)
      motif_res = list(set(motif_res) - set(remove))
      return motif_res
docs: Remove MOODS motif hits that don't overlap the variant of interest.
      
      Parameters
      ----------
      motif_res : list
          Result from MOODS search like [(21, 3.947748787969809), (-38,
          3.979759977155675)].
          
      variant_start : int
          Relative start position of the allele string in seq (not genomic
          coordinates).  In other words, seq[variant_start:variant_end] should
          give the allele.
          
      variant_end : int
          Relative end position of the allele string in seq (not genomic
          coordinates).  In other words, seq[variant_start:variant_end] should
          give the allele.
          
      motif_length : int
          Length of the motif.
          
      seq : str
          Sequence searched for motifs for this allele.
  
      Returns
      -------
      motif_res : list
          List in the same format as motif_res input but with entries that don't
          overlap the variant removed.