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

Function readContigs

AdjList/AdjList.cpp:198–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 */
197template <class KmerType>
198static void readContigs(const string& path,
199 Graph& g, vector<KmerType>& prefixes,
200 unordered_map<KmerType, vector<ContigNode> >& suffixMap)
201{
202 if (opt::verbose > 0)
203 cerr << "Reading `" << path << "'...\n";
204
205 unsigned count = 0;
206 FastaReader in(path.c_str(), FastaReader::FOLD_CASE);
207 for (FastaRecord rec; in >> rec;) {
208 Sequence& seq = rec.seq;
209 if (count++ == 0) {
210 // Detect colour-space contigs.
211 opt::colourSpace = isdigit(seq[0]);
212 } else {
213 if (opt::colourSpace)
214 assert(isdigit(seq[0]));
215 else
216 assert(isalpha(seq[0]));
217 }
218
219 flattenAmbiguityCodes(seq);
220
221 // Add the prefix to the collection.
222 unsigned overlap = opt::k - 1;
223 assert(seq.length() > overlap);
224 KmerType prefix(seq.substr(0, overlap));
225 KmerType suffix(seq.substr(seq.length() - overlap));
226 prefixes.push_back(prefix);
227 prefixes.push_back(reverseComplement(suffix));
228
229 // Add the suffix to the index.
230 ContigProperties vp(seq.length(), getCoverage(rec.comment));
231 ContigNode u = add_vertex(vp, g);
232 put(vertex_name, g, u, rec.id);
233 suffixMap[suffix].push_back(u);
234 suffixMap[reverseComplement(prefix)].push_back(
235 get(vertex_complement, g, u));
236 }
237 assert(in.eof());
238}
239
240/** Build contig overlap graph. */
241template <class KmerType>

Callers 1

loadDataStructuresFunction · 0.70

Calls 10

flattenAmbiguityCodesFunction · 0.85
getCoverageFunction · 0.85
reverseComplementFunction · 0.50
add_vertexFunction · 0.50
putFunction · 0.50
getFunction · 0.50
c_strMethod · 0.45
lengthMethod · 0.45
push_backMethod · 0.45
eofMethod · 0.45

Tested by

no test coverage detected