ddi-fw 0.0.18__py3-none-any.whl → 0.0.20__py3-none-any.whl
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.
- ddi_fw/drugbank/drugbank_processor.py +2 -2
- ddi_fw/utils/zip_helper.py +22 -1
- {ddi_fw-0.0.18.dist-info → ddi_fw-0.0.20.dist-info}/METADATA +2 -1
- {ddi_fw-0.0.18.dist-info → ddi_fw-0.0.20.dist-info}/RECORD +6 -6
- {ddi_fw-0.0.18.dist-info → ddi_fw-0.0.20.dist-info}/WHEEL +0 -0
- {ddi_fw-0.0.18.dist-info → ddi_fw-0.0.20.dist-info}/top_level.txt +0 -0
@@ -67,12 +67,12 @@ class DrugBankProcessor():
|
|
67
67
|
return external_identifier_list
|
68
68
|
|
69
69
|
def process(self,
|
70
|
+
ner_data_path,
|
70
71
|
input_path='drugs',
|
71
72
|
output_path='output',
|
72
73
|
save_as_sql=True,
|
73
74
|
db_path=r"./drugbank.db",
|
74
|
-
zip_outputs=True
|
75
|
-
ner_data_path):
|
75
|
+
zip_outputs=True):
|
76
76
|
if not os.path.exists(output_path):
|
77
77
|
os.makedirs(output_path)
|
78
78
|
ner_df = CTakesNER().load(ner_data_path)
|
ddi_fw/utils/zip_helper.py
CHANGED
@@ -15,6 +15,18 @@ class ZipHelper:
|
|
15
15
|
with z.ZipFile(f'{output_path}/{name}.zip', 'w', compression=z.ZIP_LZMA, compresslevel=z.ZIP_LZMA) as zipObj:
|
16
16
|
zipObj.write(file_path, basename(file_path))
|
17
17
|
|
18
|
+
def zip_as_multipart(self, name, file_path,output_path, chunk_size):
|
19
|
+
self.zip_single_file(name,file_path, output_path+"/parts")
|
20
|
+
with open(file_path, 'rb') as f:
|
21
|
+
chunk_number = 1
|
22
|
+
while True:
|
23
|
+
chunk = f.read(chunk_size)
|
24
|
+
if not chunk:
|
25
|
+
break
|
26
|
+
with open(f"{file_path}.part{chunk_number:03}", 'wb') as chunk_file:
|
27
|
+
chunk_file.write(chunk)
|
28
|
+
chunk_number += 1
|
29
|
+
|
18
30
|
def zip(self, zip_prefix, input_path, output_path, chunk_size):
|
19
31
|
files_paths = [input_path+'/' + p for p in os.listdir(input_path)]
|
20
32
|
count_of_chunks = math.ceil(len(files_paths) / chunk_size)
|
@@ -50,6 +62,15 @@ class ZipHelper:
|
|
50
62
|
z1.extractall(path=output_path)
|
51
63
|
print(f'{file_path} has been extracted')
|
52
64
|
|
65
|
+
def extract_multiparts(self, output_path, parts_path):
|
66
|
+
input_parts = [parts_path+'/' + p for p in os.listdir(parts_path)]
|
67
|
+
with open(output_file, 'wb') as outfile:
|
68
|
+
for part in input_parts:
|
69
|
+
with open(part, 'rb') as infile:
|
70
|
+
outfile.write(infile.read())
|
71
|
+
self.extract(parts_path,output_path)
|
72
|
+
|
73
|
+
|
53
74
|
|
54
75
|
# if __name__ == "__main__":
|
55
76
|
# helper = ZipHelper()
|
@@ -63,4 +84,4 @@ class ZipHelper:
|
|
63
84
|
# df = pd.DataFrame(data=d)
|
64
85
|
# df.to_pickle('test/dataframe.pickle')
|
65
86
|
# helper.zip_single_file(file_path='test/dataframe.pickle',output_path='test/output', name='zip')
|
66
|
-
# helper.extract(input_path='test/output', output_path='test/output')
|
87
|
+
# helper.extract(input_path='test/output', output_path='test/output')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ddi_fw
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.20
|
4
4
|
Summary: Do not use :)
|
5
5
|
Author-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
|
6
6
|
Maintainer-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
|
@@ -22,6 +22,7 @@ Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
23
23
|
Requires-Python: >=3.8
|
24
24
|
Description-Content-Type: text/markdown
|
25
|
+
Requires-Dist: python-stopwatch
|
25
26
|
Requires-Dist: importlib-resources
|
26
27
|
Requires-Dist: lxml
|
27
28
|
Requires-Dist: matplotlib
|
@@ -53,7 +53,7 @@ ddi_fw/datasets/mdf_sa_ddi/indexes/validation_fold_4.txt,sha256=STKdpjRqA0Vi63RJ
|
|
53
53
|
ddi_fw/drugbank/__init__.py,sha256=4_eKdZsnXUSJyr-TZpHwIn13JC6PqS5imeLJJbgt2-A,94
|
54
54
|
ddi_fw/drugbank/drugbank.xsd,sha256=y-WzMHANyzmf5T_0ywlMOq63ft9uW41B5I1WfBKbh9c,43306
|
55
55
|
ddi_fw/drugbank/drugbank_parser.py,sha256=lxUuhB0s8ef_aPNDs0V8ClKF7-KIWugNIV9gVsRvzrw,5610
|
56
|
-
ddi_fw/drugbank/drugbank_processor.py,sha256=
|
56
|
+
ddi_fw/drugbank/drugbank_processor.py,sha256=vmkt68n9nFLevufgGyXhOSDtTo4G1XzwT9PVncGTXtk,18127
|
57
57
|
ddi_fw/drugbank/drugbank_processor_org.py,sha256=eO5Yset50P91qkic79RUXPoEuxRxQKFkKW0l4G29Mas,13322
|
58
58
|
ddi_fw/drugbank/event_extractor.py,sha256=6odoZohhK7OdLF-LF0l-5BFq0_NMG_5jrFJbHrBXsI8,4600
|
59
59
|
ddi_fw/experiments/__init__.py,sha256=UJwd2i3QcuaI1YjC_2yGCiLuEMTT5Yo7rDFxw89chIw,108
|
@@ -78,8 +78,8 @@ ddi_fw/test/type_guarding_test.py,sha256=KxjyBxohDu7lwpejalCj-REjtJ-k1S1wQbOB6TG
|
|
78
78
|
ddi_fw/utils/__init__.py,sha256=nhNU_sEp55xsZ5VtvhozjKg6r4GWP6SJI13v8F_jbCg,217
|
79
79
|
ddi_fw/utils/enums.py,sha256=19eJ3fX5eRK_xPvkYcukmug144jXPH4X9zQqtsFBj5A,671
|
80
80
|
ddi_fw/utils/utils.py,sha256=Na6Y8mY-CFbQjrgd9xC8agcrjVvTj_7KIXqFm1H_3qU,3549
|
81
|
-
ddi_fw/utils/zip_helper.py,sha256=
|
82
|
-
ddi_fw-0.0.
|
83
|
-
ddi_fw-0.0.
|
84
|
-
ddi_fw-0.0.
|
85
|
-
ddi_fw-0.0.
|
81
|
+
ddi_fw/utils/zip_helper.py,sha256=Rwpgslpea8HKCr6Q9yML9t6HbiyUcX5VlWnyBGMWcCQ,3528
|
82
|
+
ddi_fw-0.0.20.dist-info/METADATA,sha256=hKr40hLqVDLM3Tvn-Y0_0gLSphtCH3PW3Q0Aeho5ShM,1541
|
83
|
+
ddi_fw-0.0.20.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
84
|
+
ddi_fw-0.0.20.dist-info/top_level.txt,sha256=PMwHICFZTZtcpzQNPV4UQnfNXYIeLR_Ste-Wfc1h810,7
|
85
|
+
ddi_fw-0.0.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|