dcatoolkit 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dcatoolkit-0.1.6/src/dcatoolkit.egg-info → dcatoolkit-0.1.7}/PKG-INFO +1 -1
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/pyproject.toml +1 -1
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit/__init__.py +1 -1
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit/analytics.py +31 -16
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7/src/dcatoolkit.egg-info}/PKG-INFO +1 -1
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/LICENSE +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/README.md +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/setup.cfg +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit/representation.py +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit.egg-info/SOURCES.txt +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit.egg-info/dependency_links.txt +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit.egg-info/requires.txt +0 -0
- {dcatoolkit-0.1.6 → dcatoolkit-0.1.7}/src/dcatoolkit.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dcatoolkit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Collection of useful modules and representations for managing DCA output data.
|
|
5
5
|
Author-email: Raheel Syed Ahmed <raheelsyedahmed@gmail.com>
|
|
6
6
|
Maintainer-email: Raheel Syed Ahmed <raheelsyedahmed@gmail.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dcatoolkit"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.7"
|
|
8
8
|
description = "Collection of useful modules and representations for managing DCA output data."
|
|
9
9
|
keywords = ["dca", "toolkit", "DI", "coevolution"]
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from collections import Counter
|
|
3
|
-
from typing import Optional
|
|
4
|
-
import string
|
|
3
|
+
from typing import Optional, Union
|
|
4
|
+
import string, io
|
|
5
5
|
|
|
6
6
|
class MSATools:
|
|
7
7
|
"""
|
|
@@ -16,23 +16,31 @@ class MSATools:
|
|
|
16
16
|
self.MSA = MSA
|
|
17
17
|
|
|
18
18
|
@staticmethod
|
|
19
|
-
def load_from_file(
|
|
19
|
+
def load_from_file(msa_source: Union[str, io.IOBase]) -> 'MSATools':
|
|
20
20
|
"""
|
|
21
21
|
Generates MSATools object from an MSA file in ".afa" format.
|
|
22
22
|
|
|
23
23
|
Parameters
|
|
24
24
|
----------
|
|
25
|
-
|
|
26
|
-
Filepath of the MSA in ".afa" format that is provided.
|
|
25
|
+
msa_source : str or io.IOBase
|
|
26
|
+
Filepath or IOBase of the MSA in ".afa" format that is provided.
|
|
27
27
|
|
|
28
28
|
Returns
|
|
29
29
|
-------
|
|
30
30
|
MSATools
|
|
31
31
|
An MSATools instance with the appropriate list of (header, sequence) tuples where sequences are simplified and converted to single line format.
|
|
32
32
|
"""
|
|
33
|
+
data = ""
|
|
33
34
|
msa_entries: list[tuple[str, str]] = []
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
if isinstance(msa_source, str):
|
|
36
|
+
with open(msa_source, 'r') as fs:
|
|
37
|
+
data = fs.read()
|
|
38
|
+
elif isinstance(msa_source, io.BytesIO):
|
|
39
|
+
data = msa_source.getvalue().decode()
|
|
40
|
+
elif isinstance(msa_source, io.StringIO):
|
|
41
|
+
data = msa_source.getvalue()
|
|
42
|
+
else:
|
|
43
|
+
raise Exception("msa_file is not bytesIO, stringIO, or a filepath.")
|
|
36
44
|
split_data = data.split(">")[1:]
|
|
37
45
|
for entry in split_data:
|
|
38
46
|
line_split_entry = entry.split("\n")
|
|
@@ -113,25 +121,32 @@ class MSATools:
|
|
|
113
121
|
kept_entries.append((header, sequence))
|
|
114
122
|
return kept_entries
|
|
115
123
|
|
|
116
|
-
def write(self,
|
|
124
|
+
def write(self, destination: Union[str, io.IOBase]) -> None:
|
|
117
125
|
"""
|
|
118
|
-
Writes this MSA's headers and sequences to the
|
|
126
|
+
Writes this MSA's headers and sequences to the destination specified.
|
|
119
127
|
|
|
120
128
|
Parameters
|
|
121
129
|
----------
|
|
122
|
-
|
|
123
|
-
Filepath to write the MSA supplied to.
|
|
130
|
+
destination : str or io.IOBase
|
|
131
|
+
Filepath or IO to write the MSA supplied to.
|
|
124
132
|
|
|
125
133
|
Returns
|
|
126
134
|
-------
|
|
127
135
|
None
|
|
128
136
|
"""
|
|
129
|
-
|
|
137
|
+
if isinstance(destination, str):
|
|
138
|
+
with open(destination, 'w') as fs:
|
|
139
|
+
for header, sequence in self.MSA:
|
|
140
|
+
fs.write(header)
|
|
141
|
+
fs.write("\n")
|
|
142
|
+
fs.write(sequence)
|
|
143
|
+
fs.write("\n")
|
|
144
|
+
elif isinstance(destination, io.IOBase):
|
|
130
145
|
for header, sequence in self.MSA:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
destination.write(header)
|
|
147
|
+
destination.write("\n")
|
|
148
|
+
destination.write(sequence)
|
|
149
|
+
destination.write("\n")
|
|
135
150
|
|
|
136
151
|
def __len__(self):
|
|
137
152
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dcatoolkit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Collection of useful modules and representations for managing DCA output data.
|
|
5
5
|
Author-email: Raheel Syed Ahmed <raheelsyedahmed@gmail.com>
|
|
6
6
|
Maintainer-email: Raheel Syed Ahmed <raheelsyedahmed@gmail.com>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|