Skip to content

Commit df62cc2

Browse files
committed
- Specify a path for temp files
- Add G,g to filter
1 parent f50756e commit df62cc2

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

pyard/pyard.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from functools import partial
3636
from typing import Dict
3737
import logging
38+
import pathlib
3839

3940
ismac = lambda x: True if re.search(":\D+", x) else False
4041

@@ -79,7 +80,8 @@ class ARD(object):
7980
def __init__(self, dbversion: str='Latest',
8081
download_mac: bool=True,
8182
verbose: bool=False,
82-
remove_invalid: bool=True):
83+
remove_invalid: bool=True,
84+
data_dir: str=None):
8385
"""
8486
ARD -
8587
:param dbversion:
@@ -117,14 +119,20 @@ def __init__(self, dbversion: str='Latest',
117119

118120
# List of expression characters
119121
expre_chars = ['N', 'Q', 'L', 'S']
120-
data_dir = os.path.dirname(__file__)
121-
ars_url = 'https://raw.githubusercontent.com/ANHIG/IMGTHLA/' \
122-
+ dbversion + '/wmda/hla_nom_g.txt'
122+
123+
# Set data directory where all the downloaded files will go
124+
if data_dir is None:
125+
data_dir = os.path.dirname(__file__)
126+
else:
127+
pathlib.Path(data_dir).mkdir(exist_ok=True)
128+
129+
imgt_hla_url = 'https://raw.githubusercontent.com/ANHIG/IMGTHLA/'
130+
ars_url = imgt_hla_url + dbversion + '/wmda/hla_nom_g.txt'
123131
ars_file = data_dir + '/hla_nom_g.' + str(dbversion) + ".txt"
124132
allele_file = data_dir + '/AlleleList.' + str(dbversion) + ".txt"
125133
mac_file = data_dir + "/mac.txt"
126134
mac_pickle = data_dir + "/mac.pickle"
127-
broad_file = data_dir + "/dna_relshp.csv"
135+
broad_file = os.path.dirname(__file__) + "/dna_relshp.csv"
128136
#print("mac_file:", mac_file)
129137

130138
allele_url = "https://raw.githubusercontent.com/ANHIG/IMGTHLA/" \

pyard/smart_sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import functools
22
import re
33

4-
expr_regex = re.compile('[NQLS]')
4+
expr_regex = re.compile('[NQLSGg]')
55

66
@functools.lru_cache(maxsize=None)
77
def smart_sort_comparator(a1, a2):

0 commit comments

Comments
 (0)