Read all contigs in and store the contigs in g_contigs and make a * g_baseCounts, to store pile-up for each base. */
| 105 | /** Read all contigs in and store the contigs in g_contigs and make a |
| 106 | * g_baseCounts, to store pile-up for each base. */ |
| 107 | static void readContigs(const string& contigsPath) |
| 108 | { |
| 109 | FastaReader contigsFile(contigsPath.c_str(), |
| 110 | FastaReader::NO_FOLD_CASE); |
| 111 | int count = 0; |
| 112 | for (FastaRecord rec; contigsFile >> rec;) { |
| 113 | const Sequence& seq = rec.seq; |
| 114 | ContigCount& contig = g_contigs[rec.id]; |
| 115 | contig.seq = seq; |
| 116 | |
| 117 | istringstream ss(rec.comment); |
| 118 | unsigned length; |
| 119 | contig.coverage = 0; |
| 120 | ss >> length >> contig.coverage >> ws; |
| 121 | getline(ss, contig.comment); |
| 122 | |
| 123 | if (count == 0) { |
| 124 | // Detect colour-space contigs. |
| 125 | opt::colourSpace = isdigit(seq[0]); |
| 126 | if (!opt::outputCS) |
| 127 | opt::csToNt = opt::colourSpace; |
| 128 | else if (!opt::colourSpace) { |
| 129 | cerr << "error: Cannot convert nucleotide data to " |
| 130 | "colour space.\n"; |
| 131 | exit(EXIT_FAILURE); |
| 132 | } |
| 133 | } else { |
| 134 | if (opt::colourSpace) |
| 135 | assert(isdigit(seq[0])); |
| 136 | else |
| 137 | assert(isalpha(seq[0])); |
| 138 | } |
| 139 | |
| 140 | contig.counts = BaseCounts(contig.seq.length() |
| 141 | + (opt::csToNt ? 1 : 0)); |
| 142 | |
| 143 | count++; |
| 144 | } |
| 145 | cerr << "Read " << count << " contigs\n"; |
| 146 | assert(contigsFile.eof()); |
| 147 | assert(count > 0); |
| 148 | } |
| 149 | |
| 150 | typedef vector<Alignment> AlignmentVector; |
| 151 |