Skip to content

Commit

Permalink
Merge 3e73e97 into 169c630
Browse files Browse the repository at this point in the history
  • Loading branch information
smirarab committed Aug 17, 2019
2 parents 169c630 + 3e73e97 commit b32f088
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Version 4.3.10:
* fix issue #70 a bug when hmmsearch fake jobs where not piped
* Version 4.3.9:
* fix info file path in `run_sepp.sh` script
* Version 4.3.7:
Expand Down
2 changes: 1 addition & 1 deletion sepp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

__all__ = ["alignment", "shortreadalignment", "taxonneighbourfinder",
"tools", "problem"]
version = "4.3.9"
version = "4.3.10"
_DEBUG = ("SEPP_DEBUG" in os.environ) and \
(os.environ["SEPP_DEBUG"].lower() == "true")

Expand Down
29 changes: 16 additions & 13 deletions sepp/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,25 +435,28 @@ def read_results(self):
Reads the search output file and returns a dictionary that contains
the e-values of the searched fragments
'''
if self.fake_run:
return {}
if self.pipe:
outfile = (self.stdoutdata.split("\n"))
return self.read_results_from_temp(outfile)
else:
assert os.path.exists(self.outfile)
assert os.stat(self.outfile)[stat.ST_SIZE] != 0
if self.results_on_temp:
if self.results_on_temp:
if self.fake_run:
res = {}
else:
assert os.path.exists(self.outfile)
assert os.stat(self.outfile)[stat.ST_SIZE] != 0
with open(self.outfile, 'r') as outfile:
res = self.read_results_from_temp(outfile)
with open(self.outfile, 'w') as target:
target.write(str(res))
return self.outfile
with open(self.outfile, 'w') as target:
target.write(str(res))
return self.outfile
else:
if self.fake_run:
res = {}
elif self.pipe:
outfile = self.stdoutdata.split("\n")
res = self.read_results_from_temp(outfile)
else:
outfile = open(self.outfile, 'r')
res = self.read_results_from_temp(outfile)
outfile.close()
return res
return res

# Group 1 (e-value) 2 (bitscore) and 9 (taxon name) contain the
# relevant information, other ones can be ignored unless we plan to
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from distutils.spawn import find_executable

use_setuptools(version="0.6.24")
version = "4.3.9"
version = "4.3.10"


def get_tools_dir(where):
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/data/configs/test2.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[commandline]
placementSize = 10
placementSize = 40
#alignment = data/simulated/test.small.fas
#raxml = data/simulated/test.small.fas

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>testseqa
TACGTAGGATGCAAGCGTTATCCGGATTTACTGGGTGTAAAGGGAGCGCAGGCGGGACTGTAAGTTGGATGTGAAATACCGTGGCTTAACCACGGAACTGCATCCAAAACTGTAGTTCTTGAGTG
15 changes: 15 additions & 0 deletions test/unittest/testSepp.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ def test_seqnames_whitespaces(self):
self.x.run()
self.assertTrue(self.x.results is None)

def test_fake_jobs(self):
self.x.options.fragment_file = open(
get_data_path(
"q2-fragment-insertion/input_fragments_tiny.fasta"), "r")
self.x.run()
self.assertTrue(self.x.results is not None)

def test_notpiped_jobs(self):
sepp.config.options().hmmsearch.piped = "False"
self.x.options.fragment_file = open(
get_data_path(
"q2-fragment-insertion/input_fragments_tiny.fasta"), "r")
self.x.run()
self.assertTrue(self.x.results is not None)


if __name__ == "__main__":
unittest.main()

0 comments on commit b32f088

Please sign in to comment.