Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Bug reading nexus composite characters for non-DNA data (reported by …
Browse files Browse the repository at this point in the history
…a web user)
  • Loading branch information
bqminh committed Jun 7, 2018
1 parent 94a1e2a commit 0950043
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions alignment/alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,24 @@ void Alignment::extractDataBlock(NxsCharactersBlock *data_block) {
pat.push_back(STATE_UNKNOWN);
else if (nstate == 1) {
pat.push_back(char_to_state[(int)data_block->GetState(seq, site, 0)]);
} else {
ASSERT(data_type != NxsCharactersBlock::dna || data_type != NxsCharactersBlock::rna || data_type != NxsCharactersBlock::nucleotide);
} else if (data_type == NxsCharactersBlock::dna || data_type == NxsCharactersBlock::rna || data_type == NxsCharactersBlock::nucleotide) {
// 2018-06-07: correctly interpret ambiguous nucleotide
char pat_ch = 0;
for (int state = 0; state < nstate; state++) {
pat_ch |= (1 << char_to_state[(int)data_block->GetState(seq, site, state)]);
}
pat_ch += 3;
pat.push_back(pat_ch);
} else {
// other ambiguous characters are treated as unknown
stringstream str;
str << "Sequence " << seq_names[seq] << " site " << site+1 << ": {";
for (int state = 0; state < nstate; state++) {
str << data_block->GetState(seq, site, state);
}
str << "} treated as unknown character";
outWarning(str.str());
pat.push_back(STATE_UNKNOWN);
}
}
num_gaps_only += addPattern(pat, site);
Expand Down

0 comments on commit 0950043

Please sign in to comment.