File: UNUSED_shape.cpp

package info (click to toggle)
seqan2 2.4.0%2Bdfsg-16
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 224,180 kB
  • sloc: cpp: 256,886; ansic: 91,672; python: 8,330; sh: 995; xml: 570; makefile: 252; awk: 51; javascript: 21
file content (23 lines) | stat: -rw-r--r-- 676 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
#include <seqan/sequence.h>
#include <seqan/index.h>

using namespace seqan;

int main()
{
    DnaString genome = "ACGACGTGCAACGTACGACTAGCATCGGATCAGCAT";

    Shape<Dna, OneGappedShape> myShape;
    stringToShape(myShape, "1101");

    // compute hash of a search pattern
    unsigned hashedPattern = hash(myShape, "ACGA");
    std::cout << "The hash is: " << hashedPattern << std::endl;

    // compute all overlapping hashes and compare with hash of pattern
    for (unsigned i = 0; i < length(genome) - length(myShape) + 1; ++i)
        if (hash(myShape, begin(genome) + i) == hashedPattern)
            std::cout << "Hit at position: " << i << std::endl;

    return 0;
}