21 #include "../GeneralExceptions.h"
23 #include "../PolymorphismMultiGContainer.h"
24 #include "../PolymorphismSequenceContainer.h"
42 std::vector<std::unique_ptr<Group>>
groups_;
112 std::shared_ptr<const Locality<double>>
getLocalityByName(
const std::string& name)
const;
183 void setGroupName(
size_t group_id,
const std::string& group_name)
const;
232 void splitGroup(
size_t group_id, std::vector<size_t> individuals_selection);
321 size_t groupPosition,
322 size_t individualPosition,
333 size_t groupPosition,
334 size_t individualPosition)
const;
352 size_t groupPosition,
353 size_t individualPosition)
const;
363 size_t groupPosition,
364 size_t individualPosition,
365 const std::string& localityName);
375 size_t groupPosition,
376 size_t individualPosition)
const;
387 size_t groupPosition,
388 size_t individualPosition,
389 size_t sequencePosition,
390 std::unique_ptr<Sequence>& sequence);
497 size_t groupPosition,
498 size_t individualPosition,
499 size_t locusPosition,
512 size_t groupPosition,
513 size_t individualPosition,
514 size_t locusPosition,
515 const std::vector<size_t> alleleKeys);
527 size_t groupPosition,
528 size_t individualPosition,
529 size_t locusPosition,
530 const std::vector<std::string> alleleId);
542 size_t groupPosition,
543 size_t individualPosition,
544 size_t locusPosition)
const;
612 throw Exception(
"DataSet::initAnalyzedLoci: analyzedLoci_ already initialized.");
613 analyzedLoci_ = std::make_unique<AnalyzedLoci>(numberOfLoci);
699 const std::map<
size_t, std::vector<size_t>>& selection,
700 size_t sequence_position)
const;
The AlleleInfo interface.
AnalyzedLoci * clone() const
const Group & getGroupAtPosition(size_t groupPosition) const
Get a group by position.
void deleteLocalityAtPosition(size_t localityPosition)
Delete a Locality from the DataSet.
size_t getIndividualSequencePositionInGroup(size_t groupPosition, size_t individualPosition, const std::string &sequenceName) const
Get the position of a Sequence in an Individual of a Group.
size_t getNumberOfGroups() const
Get the number of Groups.
std::unique_ptr< PolymorphismSequenceContainer > getPolymorphismSequenceContainer(const std::map< size_t, std::vector< size_t >> &selection, size_t sequence_position) const
Get a PolymorphismSequenceContainer from a selection of groups and individuals.
const Group & getGroupById(size_t group_id) const
Get a group by identifier.
std::string getAlphabetType() const
Get the alphabet type as a string.
void deleteIndividualGenotypeInGroup(size_t groupPosition, size_t individualPosition)
Delete the MultilocusGenotype of an Individual from a Group.
bool hasAlleleicData() const
Tell if there is alelelic data.
std::unique_ptr< PolymorphismMultiGContainer > getPolymorphismMultiGContainer() const
Get a PolymorphismMultiGContainer with all allelic data of the DataSet.
void addAlleleInfoByLocusName(const std::string &locus_name, const AlleleInfo &allele)
Add an AlleleInfo to a LocusInfo.
void setIndividualMonolocusGenotypeByAlleleKeyInGroup(size_t groupPosition, size_t individualPosition, size_t locusPosition, const std::vector< size_t > alleleKeys)
Set a MonolocusGenotype of an Individual from a group.
void addAlleleInfoByLocusPosition(size_t locus_position, const AlleleInfo &allele)
Add an AlleleInfo to a LocusInfo.
void initAnalyzedLoci(size_t numberOfLoci)
Initialize the AnalyzedLoci for number of loci.
std::shared_ptr< const Locality< double > > getIndividualLocalityInGroup(size_t groupPosition, size_t individualPosition) const
Get the Locality of an Individual in a Group.
void deleteGroupAtPosition(size_t groupPosition)
Delete a Group from the DataSet.
size_t getPloidyByLocusPosition(size_t locus_position) const
Get the ploidy of a locus.
void mergeTwoGroups(size_t source_id, size_t target_id)
Merge two groups.
const Sequence & getIndividualSequenceByNameInGroup(size_t groupPosition, size_t individualPosition, const std::string &sequenceName) const
Get a Sequence from an Individual of a Group.
size_t getIndividualPositionInGroup(size_t groupPosition, const std::string &individual_id) const
Get the position of an Individual in a Group.
void mergeGroups(std::vector< size_t > &group_ids)
Merge some Groups in one.
unsigned short getIndividualSexInGroup(size_t groupPosition, size_t individualPosition) const
Get the sex of an Individual in a Group.
std::shared_ptr< const Alphabet > getAlphabet() const
Get a pointer toward the alphabet if there is sequence data.
void deleteLocalityByName(const std::string &name)
Delete a Locality from the DataSet.
const Individual & getIndividualAtPositionFromGroup(size_t groupPosition, size_t individualPosition) const
Get an Individual from a Group.
const AnalyzedLoci & analyzedLoci() const
Get the AnalyzedLoci if there is one.
void setIndividualCoordInGroup(size_t groupPosition, size_t individualPosition, const Point2D< double > &coord)
Set the coordinates of an Individual in a Group.
void setGroupName(size_t group_id, const std::string &group_name) const
set the name of a Group.
std::vector< std::unique_ptr< Group > > groups_
void deleteIndividualSequenceAtPositionInGroup(size_t groupPosition, size_t individualPosition, size_t sequencePosition)
Delete a Sequence of an Individual of a Group.
void deleteIndividualAtPositionFromGroup(size_t groupPosition, size_t individualPosition)
Delete an Individual from a group.
void setAnalyzedLoci(const AnalyzedLoci &analyzedLoci)
Set the AnalyzedLoci to the DataSet.
size_t getGroupPosition(size_t group_id) const
Get the position of a Group.
const Individual & getIndividualByIdFromGroup(size_t groupPosition, const std::string &individualId) const
Get an Individual from a Group.
std::string getGroupName(size_t group_id) const
Get the name of a Group. If the name is an empty string it just returns the group_id.
DataSet & operator=(const DataSet &ds)
void addGroup(const Group &group)
Add a Group to the DataSet.
const MonolocusGenotypeInterface & getIndividualMonolocusGenotypeInGroup(size_t groupPosition, size_t individualPosition, size_t locusPosition) const
Get a MonolocusGenotype from an Individual of a Group.
void setLocusInfo(size_t locus_position, const LocusInfo &locus)
Set a LocusInfo.
size_t getNumberOfIndividualsInGroup(size_t groupPosition) const
Get the number of Individuals in a Group.
void addIndividualSequenceInGroup(size_t groupPosition, size_t individualPosition, size_t sequencePosition, std::unique_ptr< Sequence > &sequence)
Add a Sequence to an Individual in a Group.
void deleteIndividualSequenceByNameInGroup(size_t groupPosition, size_t individualPosition, const std::string &sequenceName)
Delete a Sequence of an Individual of a Group.
void setIndividualGenotypeInGroup(size_t groupPosition, size_t individualPosition, const MultilocusGenotype &genotype)
Set the MultilocusGenotype of an Individual in a Group.
size_t getIndividualNumberOfSequencesInGroup(size_t groupPosition, size_t individualPosition) const
Get the number of Sequences in an Individual of a Group.
bool hasSequenceData() const
Tell if at least one individual has at least one sequence.
void setIndividualSexInGroup(size_t groupPosition, size_t individualPosition, const unsigned short sex)
Set the sex of an Individual in a Group.
void setAlphabet(std::shared_ptr< const Alphabet > alpha)
Set the alphabet of the AnalyzedSequences.
void deleteAnalyzedLoci()
Delete the AnalyzedLoci.
std::vector< std::shared_ptr< Locality< double > > > localities_
void setIndividualMonolocusGenotypeByAlleleIdInGroup(size_t groupPosition, size_t individualPosition, size_t locusPosition, const std::vector< std::string > alleleId)
Set a MonolocusGenotype of an Individual from a group.
const Date & individualDateInGroup(size_t groupPosition, size_t individualPosition) const
Get the Date of an Individual in a Group.
const Point2D< double > & individualCoordInGroup(size_t groupPosition, size_t individualPosition) const
Get the coordinate of an Individual in a Group.
void deleteIndividualByIdFromGroup(size_t groupPosition, const std::string &individualId)
Delete an Individual from a group.
const LocusInfo & getLocusInfoByName(const std::string &locus_name) const
Get a LocusInfo by its name.
size_t getPloidyByLocusName(const std::string &locus_name) const
Get the ploidy of a locus.
const Locality< double > & localityByName(const std::string &name) const
Get a Locality by name.
size_t getLocalityPosition(const std::string &name) const
Get the position of a locality in the container.
const Locality< double > & localityAtPosition(size_t localityPosition) const
Get a Locality by localityPosition.
virtual ~DataSet()=default
Destroy a DataSet.
size_t getNumberOfLocalities() const
Get the number of Localities.
void addEmptyIndividualToGroup(size_t groupPosition, const std::string &individual_id)
Add an empty Individual to a Group.
std::shared_ptr< const Locality< double > > getLocalityByName(const std::string &name) const
Get a Locality by name.
const LocusInfo & getLocusInfoAtPosition(size_t locus_position) const
Get a LocusInfo by its position.
size_t getNumberOfLoci() const
Get the number of loci.
void setIndividualLocalityInGroupByName(size_t groupPosition, size_t individualPosition, const std::string &localityName)
Set the Locality of an Individual in a Group.
void addIndividualToGroup(size_t groupPosition, const Individual &individual)
Add an Individual to a Group.
std::shared_ptr< const Alphabet > sequenceAlphabet_
std::vector< std::string > getIndividualSequencesNamesInGroup(size_t groupPosition, size_t individualPosition) const
Get the Sequences' names from an Individual of a Group.
void setIndividualMonolocusGenotypeInGroup(size_t groupPosition, size_t individualPosition, size_t locusPosition, const MonolocusGenotypeInterface &monogen)
Set a MonolocusGenotype of an Individual from a group.
const Sequence & getIndividualSequenceAtPositionInGroup(size_t groupPosition, size_t individualPosition, size_t sequencePosition) const
Get a Sequence from an Individual of a Group.
std::unique_ptr< AnalyzedLoci > analyzedLoci_
void initIndividualGenotypeInGroup(size_t groupPosition, size_t individualPosition)
Initialize the genotype of an Individual in a Group.
bool hasLocality() const
Tell if there is at least one locality.
std::shared_ptr< const Locality< double > > getLocalityAtPosition(size_t localityPosition) const
Get a Locality by localityPosition.
void setIndividualDateInGroup(size_t groupPosition, size_t individualPosition, const Date &date)
Set the Date of an Individual in a Group.
const Alphabet & alphabet() const
Get a reference toward the alphabet if there is sequence data.
void addEmptyGroup(size_t group_id)
Add an empty Group to the DataSet.
void splitGroup(size_t group_id, std::vector< size_t > individuals_selection)
Split a group in two.
DataSet()
Build a new void DataSet.
void addLocality(const Locality< double > &locality)
Add a locality to the DataSet.
The MonolocusGenotype virtual class.
The MultilocusGenotype class.