Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and change AbstractHomologousDiscreteCharacterData methods #392

Merged
merged 6 commits into from
Oct 18, 2023

Conversation

davidcerny
Copy link
Contributor

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.

Copy link
Member

@hoehna hoehna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice with a good test!

@davidcerny davidcerny merged commit 8f2910e into development Oct 18, 2023
20 checks passed
@davidcerny davidcerny deleted the get-inv-char-indices branch October 18, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants