Skip to content

Motif Pattern

Jess Davis edited this page Dec 15, 2016 · 1 revision

The Motif pattern represents a short sequence of characters existing within a gene sequence. The pattern also exhibits a similarity threshold that must be met by the argument in order for the match to succeed. The similarity threshold is 0-1 value that represents a proportion of the Motif sequence.

Creation

A Motif object can be created much like any object. The constructor takes two arguments:

  1. motif : string
  2. threshold : float

The "threshold" argument is optional and, if ignored, the Motif will be given a default similarity threshold of 1.0, meaning a given sequence will need to contain an exact match.

let myMotif = Motif("ATTGCA", 0.7)
let lazyMotif = Motif("ATTGCA")       // threshold = 1.0

Usage

In order to make use of the Motif pattern, the "Match" member function must be called with a Bio.ISequence as an argument. The Motif pattern will then proceed to look through the input in search of a match that satisfies the similarity threshold, and returns a boolean response.

// create a Bio.Sequence
let mySeq   = new Bio.Sequence(Bio.Alphabets.DNA, "ATTC")

// create a Motif (here a 0.75 or 75% matching subsequence will need to appear)
let myMotif = Motif("ATTG", 0.75)
let result  = myMotif.Match(mySeq)    // true (because "ATTC" is a 75% match of "ATTG")
                
Clone this wiki locally