Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/PyPop/_deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@

deprecated_modules = {
"PyPop.datatypes.AlleleCounts": {
"new": "",
"reason": "The :class:`~PyPop.datatypes.Genotypes` class now holds allele count data as pseudo-genotype matrix.",
"deprecated": "0.6.0",
"removal": "1.4.2",
"removed": "1.4.2",
},
"PyPop.Arlequin": {
"new": "PyPop.arlequin",
Expand Down
66 changes: 0 additions & 66 deletions src/PyPop/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,72 +361,6 @@ def getIndividualsData(self):
return self.matrix


class AlleleCounts:
"""Deprecated class to store information in allele count form.

.. deprecated:: 0.6.0
this class is now obsolete, the :class:`Genotypes` class
now holds allele count data as pseudo-genotype matrix.
"""

def __init__(self, alleleTable=None, locusName=None):
self.alleleTable = alleleTable
self.locusName = locusName
self._genDataStructures()

def _genDataStructures(self):
total = 0
self.freqcount = {}

for allele in self.alleleTable:
total += self.alleleTable[allele]

# store in an iVar for the moment
self.totalAlleleCount = total

logger.debug("alleleTable", self.alleleTable)

# simply reconstruct the 3-tuple as generated in
# ParseGenotypeFile: alleleTable (a map of counts keyed by
# allele), total allele count and the number of untyped
# individuals (in this case, by definition it is zero).
# then store in the same data structure as ParseGenotypeFile

# even though we only have a single locus, this will make it
# easy to generalize later

self.freqcount[self.locusName] = self.alleleTable, self.totalAlleleCount, 0, 0

def serializeSubclassMetadataTo(self, stream):
"""Serialize subclass-specific metadata.

Specifically, total number of alleles and loci.
"""
stream.opentag("summaryinfo")
stream.writeln()
stream.tagContents("allelecount", f"{self.totalAlleleCount}")
stream.writeln()
stream.tagContents("locuscount", f"{1}")
stream.writeln()
stream.closetag("summaryinfo")
stream.writeln()

def serializeAlleleCountDataAt(self, stream, locus):
# call the class-independent function...

alleleTable, total, untypedIndividuals, unsequencedSites = self.freqcount[locus]
_serializeAlleleCountDataAt(
stream, alleleTable, total, untypedIndividuals, unsequencedSites
)

def getAlleleCount(self):
return self.freqcount[self.locusName]

def getLocusName(self):
# the first key is the name of the locus
return self.locusName


def _serializeAlleleCountDataAt(
stream, alleleTable, total, untypedIndividuals, unsequencedSites
):
Expand Down
Loading