-
Notifications
You must be signed in to change notification settings - Fork 1
/
kDataFrame.py
167 lines (125 loc) · 4.43 KB
/
kDataFrame.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
"""
.. module:: kProcessor
"""
class kDataFrame:
"""
The abstract base class defining a kDataFrame.
"""
# Will publish it later after cloning kmerDecoder settings.
# def getTwin(self):
# """creates a new ``kDataframe`` using the same parameters as the current ``kDataFrame``.
#
# :return: A shallow copy of the current ``kDataFrame``.
# :rtype: kDataFrame
#
# """
# # pass
def reserve(self, n):
"""Request a capacity change so that the kDataFrame 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 kDataFrame, 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 kDataFrame
: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 kDataFrame
:param kmer: The kmer to retrieve its count
:type kmer: string
:return: The count of the kmer in the kDataFrame
:rtype: integer
"""
pass
def erase(self, kmer):
"""Removes a kmer from the kDataFrame
: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 kDataFrame
:return: The number of kmers in the kDataframe
:rtype: integer
"""
pass
def max_size(self):
"""Maximum number of kmers that the kDataframe can hold.
:return: The maximum number of kmers that the kDataframe can hold.
:rtype: integer
"""
pass
def empty(self):
"""Check whether the kDataFrame is empty of kmers or not.
:return: Boolean value indicating whether the kDataFrame is empty, i.e. whether its size is 0
:rtype: boolean
"""
pass
def load_factor(self):
"""Retrieving the current load factor of the kDataFrame in percentage to indicate how full is it.
:return: The current load factor in the kDataFrame.
:rtype: integer
"""
pass
def max_load_factor(self):
""" Retrieving the maximum load factor of the kDataFrame in percentage.
:return: The maximum load factor in the kDataFrame.
:rtype: integer
"""
pass
def begin(self):
""" Instantiate a kDataFrameIterator object pointing to the first kmer position
:return: An iterator at the begin of the kDataFrame.
: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 kDataFrame.
:rtype: :class:`kProcessor.kDataFrameIterator`
"""
pass
def save(self):
"""
Serialize the kDataFrame on the disk in a form of binary file alongside other metadata files.
"""
pass
@staticmethod
def load(filePath):
""" A static method to load a kDataFrame file from disk.
.. note:: Load the file without the extension [.mqf, .map, .phmap]
:param filePath: The serialized kDataFrame binary file without the extension
:return: the loaded kDataFrame from disk
:rtype: :class:`kProcessor.kDataFrame`
Example:
>>> import kProcessor as kp
>>> # File path : "path/to/file.mqf"
>>> KF = kp.kDataFrame.load("path/to/file")
"""
pass
def kSize(self):
"""Get the kmer size of the kDataFrame
:return: kmer size
:rtype: integer
"""
pass