template <typename TChar, typename TValue, typename TQual>
void remove(StringSet<String<TValue> > & seq, StringSet<String<TQual> > & qual, StringSet<String<TChar> > const & adapter)
{
    Align<String<char>, ArrayGaps> align;
    resize(rows(align), 2);

    for (unsigned i = 0; i < length(seq); ++i)
    {
        assignSource(row(align,0), seq[i]);
        for (unsigned j = 0; j < length(adapter); ++j)
        {
            assignSource(row(align,1), adapter[j]);
            int score = globalAlignment(align, Score<int>(1, -1, -1), AlignConfig<true, false, true, false>());
            int alignLength = length(seq[i]) - toViewPosition(row(align, 0), toViewPosition(row(align, 1), beginPosition(row(align, 1))));

            if (alignLength >= 3)
            {
                double rate = 1.0;
                if (alignLength > 6 )
                    rate = 0.9;
                if (score >= rate * alignLength)
                {
                    resize(qual[i], length(seq[i]) - alignLength);
                    resize(seq[i], length(seq[i]) - alignLength);
                    break;
                }
            }
        }
    }
}

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback