File: filter_similar_sequences.cpp

package info (click to toggle)
seqan2 2.4.0%2Bdfsg-14
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 224,136 kB
  • sloc: cpp: 256,886; ansic: 91,672; python: 8,330; sh: 995; xml: 570; makefile: 251; awk: 51; javascript: 21
file content (48 lines) | stat: -rw-r--r-- 1,424 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//![includes]
#include <seqan/stream.h>
#include <seqan/index.h>
#include <seqan/store.h>
#include <iostream>

using namespace seqan;
//![includes]

//![load_reads]
int main(int argc, char const * argv[])
{
    FragmentStore<> fragStore;
    if (argc < 2 || !loadReads(fragStore, argv[1]))
    {
        std::cerr << "ERROR: Coud not load reads." << std::endl;
        return 0;
    }
//![load_reads]

//![filter]
    typedef FragmentStore<>::TReadSeqStore TReadSeqStore;
    typedef GetValue<TReadSeqStore>::Type TReadSeq;
    typedef Index<TReadSeqStore, IndexQGram<Shape<Dna, UngappedShape<11> >, OpenAddressing> > TIndex;
    typedef Pattern<TIndex, Swift<SwiftSemiGlobal> > TPattern;
    typedef Finder<TReadSeq, Swift<SwiftSemiGlobal> > TFinder;

    TIndex index(fragStore.readSeqStore);
    TPattern pattern(index);
    for (unsigned i = 0; i < length(fragStore.readSeqStore); ++i)
    {
        if ((i % 1000) == 0)
            std::cout << "." << std::flush;
        TFinder finder(fragStore.readSeqStore[i]);
        while (find(finder, pattern, 0.1))
        {
            if (i == position(pattern).i1)
                continue;
            // do further alignment here
/*			std::cout << "Found possible overlap of " << std::endl;
            std::cout << "\t" << infix(finder) << std::endl;
            std::cout << "\t" << seqs[position(pattern).i1] << std::endl;
*/      }
    }

    return 0;
}
//![filter]