Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit a8abbf9

Browse files
author
billzt
committed
Fix #1: deal with splitted BLAST databases
1 parent ab73ff7 commit a8abbf9

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

primerserver2/cmd/primertool.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,9 @@ def check_templates(args):
122122
if os.path.isfile(template) is False:
123123
raise Exception(f'File not found: {template}')
124124
if os.path.isfile(template+'.fai') is False:
125-
code = os.system(f'samtools faidx {template} 2>/dev/null')
126-
if code != 0:
127-
raise Exception(f'File {template} cannot be indexed by samtools faidx. Perhaps it is not in FASTA format')
125+
raise Exception(f'File {template} has not been indexed by samtools faidx.')
128126
if os.path.isfile(re.sub('[.]gz$', '', template)+'.nhr') is False and os.path.isfile(re.sub('\.gz$', '', template)+'.nal') is False:
129-
code = os.system(f'makeblastdb -dbtype nucl -in {template} 2>/dev/null')
130-
if code != 0:
131-
raise Exception(f'File {template} cannot be indexed by makeblastdb.')
127+
raise Exception(f'File {template} has not been indexed by makeblastdb.')
132128

133129
# qPCR specific
134130
if i==0:

primerserver2/core/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def get():
2-
return '2.0.0b18'
2+
return '2.0.0b19'

primerserver2/web/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import os
1010
import sys
1111
import json
12+
import re
1213

1314
def load():
1415
home_dir = os.environ['HOME']
@@ -52,8 +53,8 @@ def check():
5253
else:
5354
msg = f'File {db_dir}/{dbname} does not exist'
5455
return {'status': status, 'msg': msg}
55-
if os.path.isfile(f'{db_dir}/{dbname}.nhr') is False and os.path.isfile(f'{db_dir}/{dbname.replace(".gz", "")}.nhr') is False:
56-
msg = f'File {db_dir}/{dbname}.nhr does not exist. Use "makeblastdb" to index {db_dir}/{dbname}'
56+
if os.path.isfile(re.sub('[.]gz$', '', f'{db_dir}/{dbname}')+'.nhr') is False and os.path.isfile(re.sub('[.]gz$', '', f'{db_dir}/{dbname}')+'.nal') is False:
57+
msg = f'File {db_dir}/{dbname} has no index. Use "makeblastdb" to index {db_dir}/{dbname}'
5758
return {'status': status, 'msg': msg}
5859
if os.path.isfile(f'{db_dir}/{dbname}.fai') is False:
5960
msg = f'File {db_dir}/{dbname}.fai does not exist. Use "samtools faidx" to index {db_dir}/{dbname}'

0 commit comments

Comments
 (0)