Builds the pile up of all reads based on the alignments and * read sequence */
| 172 | /** Builds the pile up of all reads based on the alignments and |
| 173 | * read sequence */ |
| 174 | static void buildBaseQuality() |
| 175 | { |
| 176 | if (opt::csToNt) |
| 177 | opt::colourSpace = false; |
| 178 | |
| 179 | // for each read and/or set of alignments. |
| 180 | for (string line; getline(cin, line);) { |
| 181 | string readID; |
| 182 | Sequence seq; |
| 183 | AlignmentVector alignments; |
| 184 | |
| 185 | readAlignment(line, readID, seq, alignments); |
| 186 | |
| 187 | // If converting to NT space, check that at least one of the |
| 188 | // alignments starts at read location 0. Otherwise, it is |
| 189 | // likely to introduce a frameshift or erroneous sequence in |
| 190 | // the final consensus. |
| 191 | if (opt::csToNt) { |
| 192 | bool good = false; |
| 193 | for (AlignmentVector::const_iterator |
| 194 | alignIter = alignments.begin(); |
| 195 | alignIter != alignments.end(); ++alignIter) { |
| 196 | if (alignIter->read_start_pos == 0) { |
| 197 | good = true; |
| 198 | break; |
| 199 | } |
| 200 | } |
| 201 | if (!good) |
| 202 | continue; |
| 203 | } |
| 204 | |
| 205 | // For each alignment for the read. |
| 206 | for (AlignmentVector::const_iterator |
| 207 | alignIter = alignments.begin(); |
| 208 | alignIter != alignments.end(); ++alignIter) { |
| 209 | string seqrc; |
| 210 | Alignment a; |
| 211 | if (alignIter->isRC) { |
| 212 | seqrc = reverseComplement(seq); |
| 213 | a = alignIter->flipQuery(); |
| 214 | } else { |
| 215 | seqrc = seq; |
| 216 | a = *alignIter; |
| 217 | } |
| 218 | const char* s = seqrc.c_str(); |
| 219 | |
| 220 | ContigMap::iterator contigIt = g_contigs.find(a.contig); |
| 221 | if (contigIt == g_contigs.end()) { |
| 222 | cerr << "error: unexpected contig ID: `" << a.contig |
| 223 | << "'\n"; |
| 224 | exit(EXIT_FAILURE); |
| 225 | } |
| 226 | |
| 227 | BaseCounts& countsVec = contigIt->second.counts; |
| 228 | |
| 229 | int read_min; |
| 230 | int read_max; |
| 231 | if (!opt::csToNt) { |
no test coverage detected