Skip to content

Commit

Permalink
Added also version number to mob_hostrange and moved taxa.sqlfile to …
Browse files Browse the repository at this point in the history
…databases directory as issue #38. Also changed python calls to sys.executable as per issue #39
  • Loading branch information
kbessonov1984 committed Nov 6, 2019
1 parent 6742f50 commit e7b13b2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions mob_suite/mob_host_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from argparse import ArgumentParser
from collections import Counter,OrderedDict
from ete3 import NCBITaxa
from mob_suite.version import __version__


#pandas.options.display.float_format = '{:.1E}'.format #render scientific notation
Expand Down Expand Up @@ -301,7 +302,7 @@ def getHostRangeRankCovergence(taxids):
then traverse the tree and report rank at genus level. Of course this literature based host range prediction might be understatement.
"""

ncbi = NCBITaxa()
ncbi = NCBITaxa(dbfile=os.path.abspath(__file__)+"/databases/taxa.sqlite")
#taxids=[562,573,1288825,439842]
tree = ncbi.get_topology(taxids)
tree.annotate_ncbi_taxa(taxid_attr='name')
Expand Down Expand Up @@ -687,7 +688,7 @@ def parse_args():
parser.add_argument('--outdir', action='store', required=True, help='Output files name prefix')
parser.add_argument('--inputseq', action='store', required=False, help='Single plasmid sequence in FASTA format (optional)')
parser.add_argument('--debug', required=False, help='Show debug detailed information (optional)', action='store_true')

parser.add_argument('-V', '--version', action='version', version="%(prog)s (" + __version__ + ")")
args = parser.parse_args()


Expand Down
2 changes: 1 addition & 1 deletion mob_suite/mob_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def main():

try:
logger.info("Init ete3 library ...")
os.system('python -c "from ete3 import NCBITaxa; ncbi = NCBITaxa(); ncbi.update_taxonomy_database()"')
os.system(sys.executable+' -c "from ete3 import NCBITaxa; ncbi = NCBITaxa(); ncbi.update_taxonomy_database('+database_directory+')"')
except Exception as e:
logger.error("Init of ete3 library failed with error {}. Removing lock file".format(e))
os.remove(lockfilepath)
Expand Down
4 changes: 2 additions & 2 deletions mob_suite/mob_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def run_mob_typer(plasmid_file_abs_path, outdir, num_threads=1,database_dir=None
logger = logging.getLogger(__name__)
logger.info("Launching mob_typer to type recently reconstructed plasmid {}".format(plasmid_file_abs_path))
if database_dir is None:
p = Popen(['python', mob_typer_path,
p = Popen([sys.executable, mob_typer_path,
'--infile', plasmid_file_abs_path,
'--outdir', outdir,
'--keep_tmp',
Expand All @@ -155,7 +155,7 @@ def run_mob_typer(plasmid_file_abs_path, outdir, num_threads=1,database_dir=None
stderr=PIPE, universal_newlines=True
)
else:
p = Popen(['python', mob_typer_path,
p = Popen([sys.executable, mob_typer_path,
'--infile', plasmid_file_abs_path,
'--outdir', outdir,
'--keep_tmp',
Expand Down
4 changes: 2 additions & 2 deletions mob_suite/tests/test_mob_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_concurrent_init():
shell=False
)
except:
p1 = subprocess.Popen(['python','../mob_init.py', '-v', '-d', TEST_ROOT+'/run_test/databases'],stdout=subprocess.PIPE,stderr=subprocess.PIPE,
p1 = subprocess.Popen([sys.executable,'../mob_init.py', '-v', '-d', TEST_ROOT+'/run_test/databases'],stdout=subprocess.PIPE,stderr=subprocess.PIPE,
)
print("Strated process 1 ...")
time.sleep(10)
Expand All @@ -45,7 +45,7 @@ def test_concurrent_init():
stderr=subprocess.PIPE,
shell=False)
except:
p2 = subprocess.Popen(['python','../mob_init.py', '-v', '-d', TEST_ROOT+'/run_test/databases'],
p2 = subprocess.Popen([sys.executable,'../mob_init.py', '-v', '-d', TEST_ROOT+'/run_test/databases'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=False)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Programming Language :: Python
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: Implementation :: CPython
Operating System :: POSIX :: Linux
""".strip().split('\n')
Expand Down

0 comments on commit e7b13b2

Please sign in to comment.