/** * Here is some samples of how to use the functions * @param SequenceMatchInterface $sequenceMatchManager * @param SequenceAlignmentInterface $sequenceAlignmentManager * @param SequenceInterface $sequenceManager * @return Response * @throws \Exception */ public function sequencematch( SequenceMatchInterface $sequenceMatchManager, SequenceAlignmentInterface $sequenceAlignmentManager, SequenceInterface $sequenceManager ){ $sequenceAlignmentManager->setFilename("data/fasta-2.txt"); $sequenceAlignmentManager->setFormat("FASTA"); $sequenceAlignmentManager->parseFile(); $oSequence = $sequenceAlignmentManager->getSeqSet()->offsetGet(0); $oSequence->setMolType("DNA"); $sequenceManager->setSequence($oSequence); // Setting the matrix $oSubMatrix = new SubMatrix(); $oSubMatrix->addrule('D', 'E'); $oSubMatrix->addrule('K', 'R', 'H'); $oSubMatrix->addrule('X'); $sequenceMatchManager->setSubMatrix($oSubMatrix); // Setting the 2 sequences $sSeq1 = $sequenceManager->subSeq(2,100); $sSeq2 = $sequenceManager->subSeq(100,100); // Computes the Hamming Distance between two sequences $iDistance = $sequenceMatchManager->hamdist($sSeq1, $sSeq2); // Compares two letters $let1 and $let2 and returns another letter // indicating if the two were exact matches, partial matches, or non-matches $sCompare1 = $sequenceMatchManager->compareLetter('A', 'T'); $sCompare2 = $sequenceMatchManager->compareLetter('A', 'A'); // Computes the Levenshtein Distance between two sequences with equal/unequal lengths $iLevdist = $sequenceMatchManager->levdist($sSeq1, $sSeq2); // Extended version of levdist() which accepts strings with length greater than 255 but not to exceed 1024 $iXLevdist = $sequenceMatchManager->xlevdist($sSeq1, $sSeq2); // Matching results $sMatch = $sequenceMatchManager->match($sSeq1, $sSeq2); return $this->render('default/sequencematch.html.twig', [ 'submatrix' => $oSubMatrix, 'sequence1' => $sSeq1, 'sequence2' => $sSeq2, 'distance' => $iDistance, 'compare1' => $sCompare1, 'compare2' => $sCompare2, 'levdist' => $iLevdist, 'xlevdist' => $iXLevdist, 'match' => $sMatch ] ); }
Submatrix :
Sequence 1 :
Sequence 2 :
Computes the Hamming Distance between two sequences
Compares two letters $let1 and $let2 and returns another letter
indicating if the two were exact matches, partial matches, or non-matches.
Not matching (A & T) :
Matching (A & A) :
Computes the Levenshtein Distance between two sequences with equal/unequal lengths :
Extended version of levdist() which accepts strings with length greater than 255 but not to exceed 1024 :
Matching results :