Skip to content

Commit

Permalink
fix: Show initial sequences on invalid site error
Browse files Browse the repository at this point in the history
  • Loading branch information
danieledler committed Jun 22, 2020
1 parent 2be2908 commit 53798b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/typecheckAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export default function typecheckAlignment(alignment) {
alignment.sequences.forEach((seq, index) => {
const invalidSiteIndex = findInvalidCharacter(seq.code, dataType);
if (invalidSiteIndex !== -1) {
throw new Error(`Invalid character '${seq.code[invalidSiteIndex]}' in sequence ${index + 1} at site ${invalidSiteIndex + 1} for inferred data type '${dataType}'`);
const sample = seq.code.length <= 8 ? `'${seq.code}'` : `'${seq.code.substring(0, 8)}'...`;
throw new Error(`Invalid character '${seq.code[invalidSiteIndex]}' at site ${invalidSiteIndex + 1} in sequence ${index + 1} (${sample}) for inferred data type '${dataType}'`);
}
})
alignment.hasInvariantSites = hasInvariantSites(alignment.sequences);
Expand Down

0 comments on commit 53798b8

Please sign in to comment.