-
Notifications
You must be signed in to change notification settings - Fork 1
/
kDataFrameMQF.py
184 lines (132 loc) · 5.37 KB
/
kDataFrameMQF.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
from kProcessor.kDataFrame import kDataFrame
class kDataFrameMQF(kDataFrame):
"""The abstract base class defining a kDataFrameMQF.
"""
def __init__(self, kSize):
"""Instantiate a kDataFrameMQF object with predefined kmer size.
:param kSize: Kmer Size
:type kSize: integer
:return: :class:`kProcessor.kDataFrameMQF`
Instantiation Example:
>>> import kProcessor as kp
>>> KF_MQF_1 = kp.kDataFrameMQF(31) # kSize = 31
>>> KF_MQF_1 = kp.kDataFrameMQF(SKIPMERS, integer_hasher, {'m': 2, 'n': 3, 'k': 10}) # Reading mode = skipmers, hashing mode = integer hashing, (m, n, k) are the skipmers params.
>>> KF_MQF_2 = kp.kDataFrameMQF(PROTEIN, protein_hasher, {'kSize': 5}); # Reading/hashing mode = protein, kSize = 5
>>> KF_MQF_3 = kp.kDataFrameMQF(PROTEIN, proteinDayhoff_hasher, {'kSize': 11}); # Reading mode = protein, hashing mode = dayhoff encoding, kSize = 11
.. note:: Read more about hashing modes in the FAQ page.
"""
pass
def getTwin(self):
"""creates a new ``kDataFrameMQF`` using the same parameters as the current ``kDataFrameMQF``.
:return: A shallow copy of the current ``kDataFrameMQF``.
:rtype: kDataFrameMQF
"""
def reserve(self, n):
"""Request a capacity change so that the kDataFrameMQF 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 kDataFrameMQF, 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 kDataFrameMQF
: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 kDataFrameMQF
:param kmer: The kmer to retrieve its count
:type kmer: string
:return: The count of the kmer in the kDataFrameMQF
:rtype: integer
"""
pass
def erase(self, kmer):
"""Removes a kmer from the kDataFrameMQF
: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 kDataFrameMQF
:return: The number of kmers in the kDataFrameMQF
:rtype: integer
"""
pass
def max_size(self):
"""Maximum number of kmers that the kDataFrameMQF can hold.
:return: The maximum number of kmers that the kDataFrameMQF can hold.
:rtype: integer
"""
pass
def empty(self):
"""Check whether the kDataFrameMQF is empty of kmers or not.
:return: Boolean value indicating whether the kDataFrameMQF is empty, i.e. whether its size is 0
:rtype: boolean
"""
pass
def load_factor(self):
"""Retrieving the current load factor of the kDataFrameMQF in percentage to indicate how full is it.
:return: The current load factor in the kDataFrameMQF.
:rtype: integer
"""
pass
def max_load_factor(self):
""" Retrieving the maximum load factor of the kDataFrameMQF in percentage.
:return: The maximum load factor in the kDataFrameMQF.
:rtype: integer
"""
pass
def begin(self):
""" Instantiate a kDataFrameIterator object pointing to the first kmer position
:return: An iterator at the begin of the kDataFrameMQF.
: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 kDataFrameMQF.
:rtype: :class:`kProcessor.kDataFrameIterator`
"""
pass
def save(self):
"""
Serialize the kDataFrameMQF on the disk in a form of binary file alongside other metadata files.
"""
pass
@staticmethod
def load(filePath):
""" A static method to load a kDataFrameMQF file from disk.
.. note:: Load the file without the extension [.mqf, .map, .phmap]
:param filePath: The serialized kDataFrameMQF binary file without the extension
:return: the loaded kDataFrameMQF from disk
:rtype: :class:`kProcessor.kDataFrameMQF`
Example:
>>> import kProcessor as kp
>>> # File path : "path/to/file.mqf"
>>> KF = kp.kDataFrameMQF.load("path/to/file")
"""
pass
def kSize(self):
"""Get the kmer size of the kDataFrameMQF
:return: kmer size
:rtype: integer
"""
pass