Skip to content

Commit

Permalink
Fix #1: deal with splitted BLAST databases
Browse files Browse the repository at this point in the history
  • Loading branch information
billzt committed Mar 18, 2021
1 parent ab73ff7 commit a8abbf9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 2 additions & 6 deletions primerserver2/cmd/primertool.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,9 @@ def check_templates(args):
if os.path.isfile(template) is False:
raise Exception(f'File not found: {template}')
if os.path.isfile(template+'.fai') is False:
code = os.system(f'samtools faidx {template} 2>/dev/null')
if code != 0:
raise Exception(f'File {template} cannot be indexed by samtools faidx. Perhaps it is not in FASTA format')
raise Exception(f'File {template} has not been indexed by samtools faidx.')
if os.path.isfile(re.sub('[.]gz$', '', template)+'.nhr') is False and os.path.isfile(re.sub('\.gz$', '', template)+'.nal') is False:
code = os.system(f'makeblastdb -dbtype nucl -in {template} 2>/dev/null')
if code != 0:
raise Exception(f'File {template} cannot be indexed by makeblastdb.')
raise Exception(f'File {template} has not been indexed by makeblastdb.')

# qPCR specific
if i==0:
Expand Down
2 changes: 1 addition & 1 deletion primerserver2/core/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def get():
return '2.0.0b18'
return '2.0.0b19'
5 changes: 3 additions & 2 deletions primerserver2/web/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import sys
import json
import re

def load():
home_dir = os.environ['HOME']
Expand Down Expand Up @@ -52,8 +53,8 @@ def check():
else:
msg = f'File {db_dir}/{dbname} does not exist'
return {'status': status, 'msg': msg}
if os.path.isfile(f'{db_dir}/{dbname}.nhr') is False and os.path.isfile(f'{db_dir}/{dbname.replace(".gz", "")}.nhr') is False:
msg = f'File {db_dir}/{dbname}.nhr does not exist. Use "makeblastdb" to index {db_dir}/{dbname}'
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:
msg = f'File {db_dir}/{dbname} has no index. Use "makeblastdb" to index {db_dir}/{dbname}'
return {'status': status, 'msg': msg}
if os.path.isfile(f'{db_dir}/{dbname}.fai') is False:
msg = f'File {db_dir}/{dbname}.fai does not exist. Use "samtools faidx" to index {db_dir}/{dbname}'
Expand Down

0 comments on commit a8abbf9

Please sign in to comment.