diff --git a/setup.cfg b/setup.cfg index 1d48b941a4af24a65daf41637c08ab7cb0e4950c..4ae1933487026c9a428c707dc11646bbb34d568a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,11 @@ [flake8] max-line-length = 120 -docstring-convention = google \ No newline at end of file +docstring-convention = google + +[coverage:report] +exclude_lines = + if __name__ == '__main__': + +[coverage:run] +omit = + */cli.py \ No newline at end of file diff --git a/src/polyA_classifier/__init__.py b/src/polyA_classifier/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0f5ce032e98c6174c7674e9a49fb1373faa53533 --- /dev/null +++ b/src/polyA_classifier/__init__.py @@ -0,0 +1 @@ +"""Module for classifying poly(A) sequences.""" diff --git a/src/polyA_classifier/cli.py b/src/polyA_classifier/cli.py new file mode 100644 index 0000000000000000000000000000000000000000..397ccf83519f4762711b5670f10c22667a8cc969 --- /dev/null +++ b/src/polyA_classifier/cli.py @@ -0,0 +1,30 @@ +"""Command-line interface for the poly(A) classifier.""" + +import sys +import argparse +from src.polyA_classifier.polyA_classifier import PolyAClassifier + +parser = argparse.ArgumentParser() + +parser.add_argument('data', action='store', help='str or list(str) of length 200 chars to classify.') +parser.add_argument('-p', '--path', action='store', help='Path to state-dict for Net-model.', + default='./models/internal_priming.pth') + + +if __name__ == '__main__': + + args = parser.parse_args() + + if args.data[0] == '[': + + data = args.data[1:-1].replace(' ', '').split(',') + + else: + + data = args.data + + classifier = PolyAClassifier(state_dict_path=args.path) + + result = classifier.classify(data) + + sys.stdout.write(str(result)) diff --git a/src/polyA_classifier.py b/src/polyA_classifier/polyA_classifier.py similarity index 100% rename from src/polyA_classifier.py rename to src/polyA_classifier/polyA_classifier.py diff --git a/tests/test_poly_a.py b/tests/test_poly_a.py index 1f3760ccd4dafc4923d0b08f461f5f71fc3b285d..8c95e90a166916eee199eaf9e2b1acba18cf9ae1 100644 --- a/tests/test_poly_a.py +++ b/tests/test_poly_a.py @@ -3,7 +3,7 @@ import pytest import os from src.poly_a import generate_poly_a -from src.polyA_classifier import PolyAClassifier, Net +from src.polyA_classifier.polyA_classifier import PolyAClassifier, Net import linecache