Add and change AbstractHomologousDiscreteCharacterData methods #392
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch makes the following changes to the class
AbstractHomologousDiscreteCharacterData
, originally suggested by Alessio Capobianco:(1) Add a
.getInvariantSiteIndices()
method, which returns the indices of all characters that are invariant, either with or without accounting for ambiguities. The code is based on the pre-existing.getNumInvariantSites()
method, which has been refactored to remove redundancies.(2) Add a
.removeExcludedCharacters()
method, which entirely removes excluded characters from the matrix. The idea behind this method is to do for characters what we already do for taxa, where we have both an.excludeTaxa()
method (which marks one or more taxa as excluded but keeps them in the matrix) and a.removeTaxa()
method (which removes them entirely).(3) Add a test to check these methods work as intended.
(4) Use the words "exclude" and "remove" in a consistent manner by renaming the existing method
.removeMissingSites()
to.excludeMissingSites()
(since it marks sites consisting entirely of missing data as excluded but keeps them in the matrix) and.removeRandomSites()
to.replaceRandomSitesByMissingData()
. This latter method neither excludes nor removes any sites; instead, it irreversibly changes their coding.