Skip to content

Commit ab32d6a

Browse files
committed
cleanup
1 parent 0d87189 commit ab32d6a

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

pyard/util.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# -*- coding: utf-8 -*-
22

3+
import copy
4+
import re
5+
import urllib.request
6+
import zipfile
37
#
48
# pyard pyARD
59
# Copyright (c) 2018 Be The Match operated by National Marrow Donor Program. All Rights Reserved.
@@ -21,34 +25,13 @@
2125
# > http://www.fsf.org/licensing/licenses/lgpl.html
2226
# > http://www.opensource.org/licenses/lgpl-license.php
2327
#
24-
import os
25-
import string
26-
import random as r
2728
from datetime import datetime, date
28-
from six import integer_types, iteritems
29+
2930
import pandas as pd
30-
import copy
31-
import http.client
32-
import pickle
33-
import urllib.request
34-
import zipfile
35-
import re
31+
from six import integer_types, iteritems
3632

3733

38-
# def all_macs(csv_file, url='hml.nmdp.org'):
39-
# # conn = http.client.HTTPSConnection(url, 443)
40-
# # conn.putrequest('GET', '/mac/api/codes')
41-
# # conn.endheaders()
42-
# # response = conn.getresponse().read().decode('utf8').splitlines()
43-
# data = [l.split("\t")[1:3] for l in response]
44-
# urllib.request.urlretrieve(url, 'numeric.v3.zip')
45-
# df = pd.DataFrame(data, columns=['Code','Alleles'])
46-
# df.to_csv(csv_file, header=True, index=False)
47-
# df['Alleles'] = df['Alleles'].apply(lambda x: x.split("/"))
48-
# mac_dict = df.set_index("Code").to_dict('index')
49-
# return mac_dict
50-
51-
def all_macs(csv_file, url='https://hml.nmdp.org/mac/files/numer.v3.zip', data_dir=os.path.dirname(__file__)):
34+
def all_macs(csv_file, data_dir, url='https://hml.nmdp.org/mac/files/numer.v3.zip'):
5235
urllib.request.urlretrieve(url, 'numeric.v3.zip')
5336
zip_ref = zipfile.ZipFile('numeric.v3.zip', 'r')
5437
zip_ref.extractall(data_dir)

0 commit comments

Comments
 (0)