LongestCommonSubsequencePositions
LongestCommonSubsequencePositions[s1,s2]
finds the longest contiguous subsequence of elements common to the strings, biomolecular sequences or lists s1 and s2 and returns their positions {pos1,pos2} in s1 and s2.
Details and Options
- For lists si, Take[si,posi] returns the longest common subsequence. For strings si, StringTake[si,posi] returns the longest common contiguous substring.
- If there are several common subsequences of the same length, LongestCommonSubsequencePositions returns the position of the one that appears earliest in s1.
- For strings, setting the option IgnoreCase->True makes LongestCommonSubsequencePositions treat lowercase and uppercase letters as equivalent, and returns the form of common subsequence that occurs in s1.
Examples
open allclose allBasic Examples (3)
Options (1)
IgnoreCase (1)
By default, LongestCommonSubsequencePositions distinguishes lower and upper case:
Properties & Relations (1)
Find the positions of the longest common sequence of characters:
The corresponding strings coincide:
LongestCommonSubsequence returns those strings joined:
Text
Wolfram Research (2015), LongestCommonSubsequencePositions, Wolfram Language function, https://reference.wolfram.com/language/ref/LongestCommonSubsequencePositions.html.
CMS
Wolfram Language. 2015. "LongestCommonSubsequencePositions." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LongestCommonSubsequencePositions.html.
APA
Wolfram Language. (2015). LongestCommonSubsequencePositions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LongestCommonSubsequencePositions.html