-
Notifications
You must be signed in to change notification settings - Fork 1
/
kDataFramePHMAP.py
187 lines (134 loc) · 5.37 KB
/
kDataFramePHMAP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
from kProcessor.kDataFrame import kDataFrame
class kDataFramePHMAP(kDataFrame):
"""
The abstract base class defining a kDataFramePHMAP.
"""
def __init__(self, kSize):
"""Instantiate a kDataFramePHMAP object with predefined kmer size.
:param kSize: Kmer Size
:type kSize: integer
:param mode: Hashing mode for the kDataFramePHMAP, default = 1
:type mode: integer
:return: :class:`kProcessor.kDataFramePHMAP`
Instantiation Example:
>>> import kProcessor as kp
>>> KF_PHMAP_1 = kp.kDataFramePHMAP(31) # kSize = 31
>>> KF_PHMAP_2 = kp.kDataFramePHMAP(PROTEIN, protein_hasher, {'kSize': 5}); # Reading/hashing mode = protein, kSize = 5
>>> KF_PHMAP_3 = kp.kDataFramePHMAP(PROTEIN, proteinDayhoff_hasher, {'kSize': 11}); # Reading mode = protein, hashing mode = dayhoff encoding, kSize = 11
.. note:: Read more about reading and hashing modes in the FAQ page.
"""
pass
def getTwin(self):
"""creates a new ``kDataFramePHMAP`` using the same parameters as the current ``kDataFramePHMAP``.
:return: A shallow copy of the current ``kDataFramePHMAP``.
:rtype: kDataFramePHMAP
"""
def reserve(self, n):
"""Request a capacity change so that the kDataFramePHMAP can approximately hold at least n kmers
:param n: Minimum number of kmers
:type n: integer
.. note:: Read more about the usage of `reserve(n)` in the FAQ page.
"""
pass
def insert(self, kmer, N = 1):
"""Insert the kmer N time in the kDataFramePHMAP, or increment the kmer count with N if it is already exists.
:param kmer: The Kmer to increment its count
:type kmer: string
:param N: Kmer count (Optional, Default = 1)
:type N: integer
:return: Boolean value indicating whether the kmer is inserted or not
:rtype: bool
"""
pass
def setCount(self, kmer, N):
"""Set the kmer's count to N time in the kDataFramePHMAP
:param kmer: The Kmer to set its count
:type kmer: string
:param N: Kmer count
:type N: integer
:return: Boolean value indicating whether the kmer is inserted or not
:rtype: bool
"""
pass
def getCount(self, kmer):
"""Retrieve number of times the kmer was inserted in the kDataFramePHMAP
:param kmer: The kmer to retrieve its count
:type kmer: string
:return: The count of the kmer in the kDataFramePHMAP
:rtype: integer
"""
pass
def erase(self, kmer):
"""Removes a kmer from the kDataFramePHMAP
:param kmer: The kmer to be erased
:type kmer: string
:return: Boolean value indicating whether the kmer is erased or not
:rtype: bool
"""
pass
def size(self):
"""Number of kmers in the kDataFramePHMAP
:return: The number of kmers in the kDataFramePHMAP
:rtype: integer
"""
pass
def max_size(self):
"""Maximum number of kmers that the kDataFramePHMAP can hold.
:return: The maximum number of kmers that the kDataFramePHMAP can hold.
:rtype: integer
"""
pass
def empty(self):
"""Check whether the kDataFramePHMAP is empty of kmers or not.
:return: Boolean value indicating whether the kDataFramePHMAP is empty, i.e. whether its size is 0
:rtype: boolean
"""
pass
def load_factor(self):
"""Retrieving the current load factor of the kDataFramePHMAP in percentage to indicate how full is it.
:return: The current load factor in the kDataFramePHMAP.
:rtype: integer
"""
pass
def max_load_factor(self):
""" Retrieving the maximum load factor of the kDataFramePHMAP in percentage.
:return: The maximum load factor in the kDataFramePHMAP.
:rtype: integer
"""
pass
def begin(self):
""" Instantiate a kDataFrameIterator object pointing to the first kmer position
:return: An iterator at the begin of the kDataFramePHMAP.
:rtype: :class:`kProcessor.kDataFrameIterator`
"""
pass
def end(self):
""" Instantiate a kDataFrameIterator object pointing to the last kmer position
:return: An iterator at the end of the kDataFramePHMAP.
:rtype: :class:`kProcessor.kDataFrameIterator`
"""
pass
def save(self):
"""
Serialize the kDataFramePHMAP on the disk in a form of binary file alongside other metadata files.
"""
pass
@staticmethod
def load(filePath):
""" A static method to load a kDataFramePHMAP file from disk.
.. note:: Load the file without the extension [.mqf, .map, .phmap]
:param filePath: The serialized kDataFramePHMAP binary file without the extension
:return: the loaded kDataFramePHMAP from disk
:rtype: :class:`kProcessor.kDataFramePHMAP`
Example:
>>> import kProcessor as kp
>>> # File path : "path/to/file.mqf"
>>> KF = kp.kDataFramePHMAP.load("path/to/file")
"""
pass
def kSize(self):
"""Get the kmer size of the kDataFramePHMAP
:return: kmer size
:rtype: integer
"""
pass