MCPcopy Create free account
hub / github.com/BirolLab/abyss / loadSequence

Function loadSequence

Assembly/LoadAlgorithm.h:38–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37template <typename Graph>
38bool loadSequence(Graph* seqCollection, Sequence& seq)
39{
40 typedef typename graph_traits<Graph>::vertex_descriptor V;
41
42 size_t len = seq.length();
43
44 if (isalnum(seq[0])) {
45 if (opt::colourSpace)
46 assert(isdigit(seq[0]));
47 else
48 assert(isalpha(seq[0]));
49 }
50
51 bool good = seq.find_first_not_of("ACGT0123") == std::string::npos;
52 bool discarded = true;
53
54 for (unsigned i = 0; i < len - V::length() + 1; ++i) {
55 Sequence kmer(seq, i, V::length());
56 if (good || kmer.find_first_not_of("acgtACGT0123")
57 == std::string::npos) {
58 if (good || kmer.find_first_of("acgt") == std::string::npos)
59 seqCollection->add(V(kmer));
60 else {
61 transform(kmer.begin(), kmer.end(), kmer.begin(),
62 ::toupper);
63 seqCollection->add(V(kmer), 0);
64 }
65 discarded = false;
66 }
67 }
68
69 return discarded;
70}
71
72/** Load sequence data into the collection. */
73template <typename Graph>

Callers 3

TESTFunction · 0.85
TESTFunction · 0.85
loadSequencesFunction · 0.85

Calls 4

lengthMethod · 0.45
addMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 2

TESTFunction · 0.68
TESTFunction · 0.68