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

Function loadSequences

Assembly/LoadAlgorithm.h:74–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72/** Load sequence data into the collection. */
73template <typename Graph>
74void loadSequences(Graph* seqCollection, std::string inFile)
75{
76 typedef typename graph_traits<Graph>::vertex_descriptor V;
77
78 Timer timer("LoadSequences " + inFile);
79
80 logger(0) << "Reading `" << inFile << "'...\n";
81
82 if (inFile.find(".kmer") != std::string::npos) {
83 if (opt::rank <= 0)
84 seqCollection->setColourSpace(false);
85 seqCollection->load(inFile.c_str());
86 return;
87 }
88
89 size_t count = 0, count_good = 0,
90 count_small = 0, count_nonACGT = 0,
91 count_reversed = 0;
92 int fastaFlags = opt::maskCov ? FastaReader::NO_FOLD_CASE :
93 FastaReader::FOLD_CASE;
94 FastaReader reader(inFile.c_str(), fastaFlags);
95 if (endsWith(inFile, ".jf") || endsWith(inFile, ".jfq")) {
96 // Load k-mer with coverage data.
97 count = loadKmer(*seqCollection, reader);
98 count_good = count;
99 } else
100 for (FastaRecord rec; reader >> rec;) {
101 Sequence seq = rec.seq;
102 size_t len = seq.length();
103 if (V::length() > len) {
104 count_small++;
105 continue;
106 }
107
108 if (opt::rank <= 0
109 && count == 0 && seqCollection->empty()) {
110 // Detect colour-space reads.
111 bool colourSpace
112 = seq.find_first_of("0123") != std::string::npos;
113 seqCollection->setColourSpace(colourSpace);
114 if (colourSpace)
115 std::cout << "Colour-space assembly\n";
116 }
117
118 if (opt::ss && rec.id.size() > 2
119 && rec.id.substr(rec.id.size()-2) == "/1") {
120 seq = reverseComplement(seq);
121 count_reversed++;
122 }
123
124 bool discarded = loadSequence(seqCollection, seq);
125
126 if (discarded)
127 count_nonACGT++;
128 else
129 count_good++;
130
131 if (++count % 100000 == 0) {

Callers 4

loadSequencesMethod · 0.85
runMethod · 0.85
runControlMethod · 0.85
assembleFunction · 0.85

Calls 15

endsWithFunction · 0.85
loadKmerFunction · 0.85
loadSequenceFunction · 0.85
addToDbFunction · 0.85
unchasteMethod · 0.80
reverseComplementFunction · 0.70
findMethod · 0.45
setColourSpaceMethod · 0.45
loadMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected