mirror of
https://github.com/samsledje/D-SCRIPT.git
synced 2026-06-04 15:04:24 +08:00
update command testing
This commit is contained in:
@@ -39,7 +39,7 @@ Evaluate a trained model
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
dscript eval --model [model file] --test [test data] --embedding [embedding file] --outfile [result file]
|
||||
dscript evaluate --model [model file] --test [test data] --embedding [embedding file] --outfile [result file]
|
||||
|
||||
|
||||
Prediction
|
||||
|
||||
@@ -42,7 +42,7 @@ def main():
|
||||
modules = {
|
||||
"train": train,
|
||||
"embed": embed,
|
||||
"eval": evaluate,
|
||||
"evaluate": evaluate,
|
||||
"predict": predict,
|
||||
}
|
||||
|
||||
|
||||
38
dscript/tests/test_commands.py
Normal file
38
dscript/tests/test_commands.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
class TestCommands:
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
os.makedirs("./tmp-dscript-testing/", exist_ok=True)
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
shutil.rmtree("./tmp-dscript-testing/")
|
||||
|
||||
def _run_command(self, cmd):
|
||||
proc = sp.Popen(cmd.split())
|
||||
proc.wait()
|
||||
assert not proc.returncode
|
||||
|
||||
def test_embed(self):
|
||||
cmd = "dscript embed --seqs dscript/tests/test.fasta --outfile tmp-dscript-testing/test_embed.h5 --device 0"
|
||||
self._run_command(cmd)
|
||||
|
||||
def test_train_with_topsy_turvy(self):
|
||||
cmd = "dscript train --topsy-turvy --train dscript/tests/test.csv --test dscript/tests/test.csv --embedding tmp-dscript-testing/test_embed.h5 --outfile tmp-dscript-testing/test_tt-train.log --save-prefix tmp-dscript-testing/test_train --device 0"
|
||||
self._run_command(cmd)
|
||||
|
||||
def test_train_without_topsy_turvy(self):
|
||||
cmd = "dscript train --train dscript/tests/test.csv --test dscript/tests/test.csv --embedding tmp-dscript-testing/test_embed.h5 --outfile tmp-dscript-testing/test_tt-train.log --save-prefix tmp-dscript-testing/test_train --device 0"
|
||||
self._run_command(cmd)
|
||||
|
||||
def test_evaluate(self):
|
||||
cmd = "dscript evaluate --test dscript/tests/test.csv --embedding tmp-dscript-testing/test_embed.h5 --model tmp-dscript-testing/test_train_final.sav --outfile tmp-dscript-testing/test_evaluate --device 0"
|
||||
self._run_command(cmd)
|
||||
|
||||
def test_predict(self):
|
||||
cmd = "dscript predict --seqs dscript/tests/test.fasta --pairs dscript/tests/test.csv --model tmp-dscript-testing/test_train_final.sav --outfile tmp-dscript-testing/test_predict --thresh 0.05 --device 0"
|
||||
self._run_command(cmd)
|
||||
@@ -1,25 +0,0 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
def test_with_topsy_turvy():
|
||||
os.makedirs("./tmp-dscript-testing/", exist_ok=True)
|
||||
|
||||
cmd = "dscript train --topsy-turvy --train dscript/tests/test.csv --test dscript/tests/test.csv --embedding dscript/tests/test.h5 --outfile tmp-dscript-testing/test_tt-train --save-prefix tmp-dscript-testing/test_tt-train --device 0"
|
||||
proc = sp.Popen(cmd.split())
|
||||
proc.wait()
|
||||
assert not proc.returncode
|
||||
|
||||
shutil.rmtree("./tmp-dscript-testing/")
|
||||
|
||||
|
||||
def test_without_topsy_turvy():
|
||||
os.makedirs("./tmp-dscript-testing/", exist_ok=True)
|
||||
|
||||
cmd = "dscript train --train dscript/tests/test.csv --test dscript/tests/test.csv --embedding dscript/tests/test.h5 --outfile tmp-dscript-testing/test_tt-train --save-prefix tmp-dscript-testing/test_tt-train --device 0"
|
||||
proc = sp.Popen(cmd.split())
|
||||
proc.wait()
|
||||
assert not proc.returncode
|
||||
|
||||
shutil.rmtree("./tmp-dscript-testing/")
|
||||
Reference in New Issue
Block a user