/// <summary> /// Computes the longest common subsequence of the two sequences. /// </summary> /// <param name="source">The source sequence</param> /// <param name="target">The target sequence</param> /// <param name="minLength">The minimum length of an aligned substring</param> /// <param name="scorer">The score provider to use</param> /// <param name="picker">An extension disambiguator (may be null)</param> public static List <AlignedSubstring> ComputeLongestCommonSubsequence(IList <T> source, IList <T> target, int minLength, ISequenceAlignmentItemScoreProvider <T> scorer, IExtensionDisambiguator picker) { return(ComputeCoverage(source, target, minLength, scorer, picker, 1)); }
/// <summary> /// Computes the longest local alignment coverage of the two sequences. /// </summary> /// <param name="source">The source sequence</param> /// <param name="target">The target sequence</param> /// <param name="scorer">The score provider to use</param> /// <param name="picker">An extension disambiguator (may be null)</param> public static List <AlignedSubstring> ComputeCoverage(IList <T> source, IList <T> target, ISequenceAlignmentItemScoreProvider <T> scorer, IExtensionDisambiguator picker) { return(ComputeCoverage(source, target, 1, scorer, picker, 0)); }
/// <summary> /// Computes the longest local alignment coverage of the two sequences. /// </summary> /// <param name="source">The source sequence</param> /// <param name="target">The target sequence</param> /// <param name="minLength">The minimum length of an aligned substring</param> /// <param name="scorer">The score provider to use</param> /// <param name="picker">An extension disambiguator (may be null)</param> /// <param name="maxItems">The maximum number of items in the result coverage. If 1, /// no coverage, but only the longest subsequence will be computed. If 0, the full /// coverage will be computed.</param> public static List <AlignedSubstring> ComputeCoverage(IList <T> source, IList <T> target, int minLength, ISequenceAlignmentItemScoreProvider <T> scorer, IExtensionDisambiguator picker, int maxItems) { SequenceAlignmentComputer <T> aligner = new SequenceAlignmentComputer <T>(source, target, scorer, picker, minLength, maxItems); return(aligner.Compute()); }
/// <summary> /// Initializes a new instance with the provided values. Once initialized, /// call <see cref="Compute()"/> to compute and return the actual alignment. /// </summary> /// <param name="source">The source sequence</param> /// <param name="target">The target sequence</param> /// <param name="scorer">The score provider to use</param> /// <param name="picker">An extension disambiguator (may be null)</param> /// <param name="minLength">The minimum length of an aligned substring</param> /// <param name="maxItems">The maximum number of items in the result coverage. If 1, /// no coverage, but only the longest subsequence will be computed. If 0, the full /// coverage will be computed.</param> public SequenceAlignmentComputer(IList <T> source, IList <T> target, ISequenceAlignmentItemScoreProvider <T> scorer, IExtensionDisambiguator picker, int minLength, int maxItems) { if (source == null) { throw new ArgumentNullException("source"); } if (target == null) { throw new ArgumentNullException("target"); } if (scorer == null) { throw new ArgumentNullException("scorer"); } if (minLength <= 0) { minLength = 1; } if (maxItems < 0) { maxItems = 0; } _MinLength = minLength; _MaxItems = maxItems; _Source = source; _Target = target; _Scorer = scorer; _Picker = picker; }