clipkit 2.11.4__tar.gz → 2.12.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. {clipkit-2.11.4 → clipkit-2.12.1}/PKG-INFO +1 -1
  2. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/args_processing.py +24 -1
  3. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/msa.py +11 -3
  4. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/parser.py +10 -7
  5. clipkit-2.12.1/clipkit/version.py +1 -0
  6. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit.egg-info/PKG-INFO +1 -1
  7. clipkit-2.12.1/clipkit.egg-info/SOURCES.txt +34 -0
  8. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit.egg-info/top_level.txt +0 -1
  9. {clipkit-2.11.4 → clipkit-2.12.1}/setup.py +4 -3
  10. clipkit-2.11.4/clipkit/version.py +0 -1
  11. clipkit-2.11.4/clipkit.egg-info/SOURCES.txt +0 -74
  12. clipkit-2.11.4/tests/__init__.py +0 -0
  13. clipkit-2.11.4/tests/conftest.py +0 -21
  14. clipkit-2.11.4/tests/integration/__init__.py +0 -0
  15. clipkit-2.11.4/tests/integration/test_api.py +0 -128
  16. clipkit-2.11.4/tests/integration/test_block_gappy_mode.py +0 -39
  17. clipkit-2.11.4/tests/integration/test_c3.py +0 -45
  18. clipkit-2.11.4/tests/integration/test_codon.py +0 -76
  19. clipkit-2.11.4/tests/integration/test_complementary_output.py +0 -237
  20. clipkit-2.11.4/tests/integration/test_composition_bias_mode.py +0 -39
  21. clipkit-2.11.4/tests/integration/test_cst.py +0 -55
  22. clipkit-2.11.4/tests/integration/test_ecomp_input.py +0 -102
  23. clipkit-2.11.4/tests/integration/test_ends_only.py +0 -47
  24. clipkit-2.11.4/tests/integration/test_gappy_mode.py +0 -522
  25. clipkit-2.11.4/tests/integration/test_gappyout_mode.py +0 -39
  26. clipkit-2.11.4/tests/integration/test_heterotachy_mode.py +0 -39
  27. clipkit-2.11.4/tests/integration/test_kpi_gappy_mode.py +0 -529
  28. clipkit-2.11.4/tests/integration/test_kpi_mode.py +0 -317
  29. clipkit-2.11.4/tests/integration/test_kpi_smart_gap_mode.py +0 -325
  30. clipkit-2.11.4/tests/integration/test_kpic_gappy_mode.py +0 -323
  31. clipkit-2.11.4/tests/integration/test_kpic_mode.py +0 -317
  32. clipkit-2.11.4/tests/integration/test_kpic_smart_gap_mode.py +0 -325
  33. clipkit-2.11.4/tests/integration/test_smart_gap_mode.py +0 -322
  34. clipkit-2.11.4/tests/integration/test_writing_to_different_output_file_formats.py +0 -453
  35. clipkit-2.11.4/tests/integration/test_writing_to_log_file.py +0 -151
  36. clipkit-2.11.4/tests/unit/__init__.py +0 -0
  37. clipkit-2.11.4/tests/unit/ecomp/__init__.py +0 -0
  38. clipkit-2.11.4/tests/unit/ecomp/test_reader.py +0 -1330
  39. clipkit-2.11.4/tests/unit/test_args_parsing.py +0 -212
  40. clipkit-2.11.4/tests/unit/test_entrypoint.py +0 -28
  41. clipkit-2.11.4/tests/unit/test_execution_state.py +0 -204
  42. clipkit-2.11.4/tests/unit/test_files.py +0 -88
  43. clipkit-2.11.4/tests/unit/test_msa.py +0 -188
  44. clipkit-2.11.4/tests/unit/test_parallel.py +0 -92
  45. clipkit-2.11.4/tests/unit/test_parallel_simple.py +0 -127
  46. clipkit-2.11.4/tests/unit/test_parallel_standalone.py +0 -131
  47. clipkit-2.11.4/tests/unit/test_parser.py +0 -61
  48. clipkit-2.11.4/tests/unit/test_plot_report.py +0 -30
  49. clipkit-2.11.4/tests/unit/test_smart_gap_helper.py +0 -156
  50. clipkit-2.11.4/tests/unit/test_thread_heuristics.py +0 -56
  51. clipkit-2.11.4/tests/unit/test_warnings.py +0 -99
  52. {clipkit-2.11.4 → clipkit-2.12.1}/LICENSE.md +0 -0
  53. {clipkit-2.11.4 → clipkit-2.12.1}/README.md +0 -0
  54. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/__init__.py +0 -0
  55. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/__main__.py +0 -0
  56. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/api.py +0 -0
  57. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/clipkit.py +0 -0
  58. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/ecomp/__init__.py +0 -0
  59. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/ecomp/reader.py +0 -0
  60. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/ecomp/writer.py +0 -0
  61. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/exceptions.py +0 -0
  62. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/files.py +0 -0
  63. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/guide_tree.py +0 -0
  64. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/helpers.py +0 -0
  65. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/logger.py +0 -0
  66. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/modes.py +0 -0
  67. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/plot_report.py +0 -0
  68. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/settings.py +0 -0
  69. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/site_classification.py +0 -0
  70. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/smart_gap_helper.py +0 -0
  71. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/stats.py +0 -0
  72. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/warnings.py +0 -0
  73. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit/write.py +0 -0
  74. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit.egg-info/dependency_links.txt +0 -0
  75. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit.egg-info/entry_points.txt +0 -0
  76. {clipkit-2.11.4 → clipkit-2.12.1}/clipkit.egg-info/requires.txt +0 -0
  77. {clipkit-2.11.4 → clipkit-2.12.1}/pyproject.toml +0 -0
  78. {clipkit-2.11.4 → clipkit-2.12.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clipkit
3
- Version: 2.11.4
3
+ Version: 2.12.1
4
4
  Summary: Alignment trimming software for phylogenetics.
5
5
  Home-page: https://github.com/jlsteenwyk/clipkit
6
6
  Author: Jacob L. Steenwyk
@@ -27,7 +27,30 @@ def process_args(args) -> dict:
27
27
  # assign optional arguments
28
28
  complement = args.complementary or False
29
29
  codon = args.codon or False
30
- mode = TrimmingMode(args.mode) if args.mode else TrimmingMode.smart_gap
30
+
31
+ # Modes that dynamically compute their own gap threshold and ignore -g
32
+ _GAP_OVERRIDE_MODES = {
33
+ TrimmingMode.smart_gap,
34
+ TrimmingMode.kpi_smart_gap,
35
+ TrimmingMode.kpic_smart_gap,
36
+ TrimmingMode.gappyout,
37
+ }
38
+
39
+ if args.mode:
40
+ mode = TrimmingMode(args.mode)
41
+ elif args.gaps is not None:
42
+ # User explicitly provided a gap threshold but no mode — default to
43
+ # gappy so the threshold is actually honoured (smart-gap would ignore it).
44
+ mode = TrimmingMode.gappy
45
+ else:
46
+ mode = TrimmingMode.smart_gap
47
+
48
+ if args.gaps is not None and args.mode and mode in _GAP_OVERRIDE_MODES:
49
+ logger.warning(
50
+ f"The gap threshold (-g {args.gaps}) will be ignored because "
51
+ f"{mode.value} mode dynamically determines its own threshold."
52
+ )
53
+
31
54
  if args.gaps is not None:
32
55
  gaps = float(args.gaps)
33
56
  elif mode in {
@@ -116,18 +116,26 @@ class MSA:
116
116
  @staticmethod
117
117
  def from_bio_msa(alignment: MultipleSeqAlignment, gap_chars=None, threads=1) -> "MSA":
118
118
  header_info = []
119
- sequence_rows = []
119
+ sequences = []
120
120
  requires_uppercase_normalization = False
121
121
  for rec in alignment:
122
122
  header_info.append(
123
123
  {"id": rec.id, "name": rec.name, "description": rec.description}
124
124
  )
125
125
  seq = str(rec.seq)
126
- sequence_rows.append(list(seq))
126
+ sequences.append(seq)
127
127
  if not requires_uppercase_normalization and seq != seq.upper():
128
128
  requires_uppercase_normalization = True
129
129
 
130
- seq_records = np.array(sequence_rows)
130
+ alignment_length = len(sequences[0])
131
+ if alignment_length == 0:
132
+ seq_records = np.empty((len(sequences), 0), dtype="U1")
133
+ else:
134
+ seq_records = (
135
+ np.array(sequences, dtype=f"U{alignment_length}")
136
+ .view("U1")
137
+ .reshape(len(sequences), alignment_length)
138
+ )
131
139
  return MSA(
132
140
  header_info,
133
141
  seq_records,
@@ -126,13 +126,16 @@ Modes
126
126
  c3: remove every third codon position
127
127
 
128
128
  Gaps
129
- Positions with gappyness greater than threshold will be trimmed.
130
- Must be between 0 and 1. (Default: 0.9). This argument is ignored
131
- when using the kpi and kpic modes of trimming as well as an
132
- iteration of trimming that uses smart-gap or gappyout. For entropy mode,
133
- this threshold is interpreted as normalized Shannon entropy (default: 0.8).
134
- For composition-bias mode, this threshold is interpreted as a normalized
135
- per-site composition-bias score (default: 0.8).
129
+ Positions with gappyness greater than threshold will be trimmed.
130
+ Must be between 0 and 1. (Default: 0.9). When -g is provided without
131
+ -m, the trimming mode automatically switches from smart-gap to gappy
132
+ so that the threshold is honoured. If -m is explicitly set to a mode
133
+ that dynamically determines its own threshold (smart-gap, kpi-smart-gap,
134
+ kpic-smart-gap, or gappyout), the -g value is ignored and a warning is
135
+ printed. This argument is also ignored when using the kpi and kpic modes.
136
+ For entropy mode, this threshold is interpreted as normalized Shannon
137
+ entropy (default: 0.8). For composition-bias mode, this threshold is
138
+ interpreted as a normalized per-site composition-bias score (default: 0.8).
136
139
  For heterotachy mode, this threshold is interpreted as a normalized
137
140
  clade-entropy variation score based on a parsimony guide tree (default: 0.8).
138
141
 
@@ -0,0 +1 @@
1
+ __version__ = "2.12.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clipkit
3
- Version: 2.11.4
3
+ Version: 2.12.1
4
4
  Summary: Alignment trimming software for phylogenetics.
5
5
  Home-page: https://github.com/jlsteenwyk/clipkit
6
6
  Author: Jacob L. Steenwyk
@@ -0,0 +1,34 @@
1
+ LICENSE.md
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ clipkit/__init__.py
6
+ clipkit/__main__.py
7
+ clipkit/api.py
8
+ clipkit/args_processing.py
9
+ clipkit/clipkit.py
10
+ clipkit/exceptions.py
11
+ clipkit/files.py
12
+ clipkit/guide_tree.py
13
+ clipkit/helpers.py
14
+ clipkit/logger.py
15
+ clipkit/modes.py
16
+ clipkit/msa.py
17
+ clipkit/parser.py
18
+ clipkit/plot_report.py
19
+ clipkit/settings.py
20
+ clipkit/site_classification.py
21
+ clipkit/smart_gap_helper.py
22
+ clipkit/stats.py
23
+ clipkit/version.py
24
+ clipkit/warnings.py
25
+ clipkit/write.py
26
+ clipkit.egg-info/PKG-INFO
27
+ clipkit.egg-info/SOURCES.txt
28
+ clipkit.egg-info/dependency_links.txt
29
+ clipkit.egg-info/entry_points.txt
30
+ clipkit.egg-info/requires.txt
31
+ clipkit.egg-info/top_level.txt
32
+ clipkit/ecomp/__init__.py
33
+ clipkit/ecomp/reader.py
34
+ clipkit/ecomp/writer.py
@@ -40,7 +40,7 @@ setup(
40
40
  author="Jacob L. Steenwyk",
41
41
  author_email="jlsteenwyk@gmail.com",
42
42
  url="https://github.com/jlsteenwyk/clipkit",
43
- packages=find_packages(),
43
+ packages=find_packages(exclude=["tests", "tests.*"]),
44
44
  classifiers=CLASSIFIERS,
45
45
  entry_points={"console_scripts": ["clipkit = clipkit.clipkit:main"]},
46
46
  version=_read_version(),
@@ -50,6 +50,7 @@ setup(
50
50
  )
51
51
 
52
52
  ## push new version to pypi
53
- # rm -rf dist
54
- # python3 setup.py sdist bdist_wheel --universal
53
+ # rm -rf dist build *.egg-info
54
+ # python -m build
55
+ # twine check dist/*
55
56
  # twine upload dist/* -r pypi
@@ -1 +0,0 @@
1
- __version__ = "2.11.4"
@@ -1,74 +0,0 @@
1
- LICENSE.md
2
- README.md
3
- pyproject.toml
4
- setup.py
5
- clipkit/__init__.py
6
- clipkit/__main__.py
7
- clipkit/api.py
8
- clipkit/args_processing.py
9
- clipkit/clipkit.py
10
- clipkit/exceptions.py
11
- clipkit/files.py
12
- clipkit/guide_tree.py
13
- clipkit/helpers.py
14
- clipkit/logger.py
15
- clipkit/modes.py
16
- clipkit/msa.py
17
- clipkit/parser.py
18
- clipkit/plot_report.py
19
- clipkit/settings.py
20
- clipkit/site_classification.py
21
- clipkit/smart_gap_helper.py
22
- clipkit/stats.py
23
- clipkit/version.py
24
- clipkit/warnings.py
25
- clipkit/write.py
26
- clipkit.egg-info/PKG-INFO
27
- clipkit.egg-info/SOURCES.txt
28
- clipkit.egg-info/dependency_links.txt
29
- clipkit.egg-info/entry_points.txt
30
- clipkit.egg-info/requires.txt
31
- clipkit.egg-info/top_level.txt
32
- clipkit/ecomp/__init__.py
33
- clipkit/ecomp/reader.py
34
- clipkit/ecomp/writer.py
35
- tests/__init__.py
36
- tests/conftest.py
37
- tests/integration/__init__.py
38
- tests/integration/test_api.py
39
- tests/integration/test_block_gappy_mode.py
40
- tests/integration/test_c3.py
41
- tests/integration/test_codon.py
42
- tests/integration/test_complementary_output.py
43
- tests/integration/test_composition_bias_mode.py
44
- tests/integration/test_cst.py
45
- tests/integration/test_ecomp_input.py
46
- tests/integration/test_ends_only.py
47
- tests/integration/test_gappy_mode.py
48
- tests/integration/test_gappyout_mode.py
49
- tests/integration/test_heterotachy_mode.py
50
- tests/integration/test_kpi_gappy_mode.py
51
- tests/integration/test_kpi_mode.py
52
- tests/integration/test_kpi_smart_gap_mode.py
53
- tests/integration/test_kpic_gappy_mode.py
54
- tests/integration/test_kpic_mode.py
55
- tests/integration/test_kpic_smart_gap_mode.py
56
- tests/integration/test_smart_gap_mode.py
57
- tests/integration/test_writing_to_different_output_file_formats.py
58
- tests/integration/test_writing_to_log_file.py
59
- tests/unit/__init__.py
60
- tests/unit/test_args_parsing.py
61
- tests/unit/test_entrypoint.py
62
- tests/unit/test_execution_state.py
63
- tests/unit/test_files.py
64
- tests/unit/test_msa.py
65
- tests/unit/test_parallel.py
66
- tests/unit/test_parallel_simple.py
67
- tests/unit/test_parallel_standalone.py
68
- tests/unit/test_parser.py
69
- tests/unit/test_plot_report.py
70
- tests/unit/test_smart_gap_helper.py
71
- tests/unit/test_thread_heuristics.py
72
- tests/unit/test_warnings.py
73
- tests/unit/ecomp/__init__.py
74
- tests/unit/ecomp/test_reader.py
File without changes
@@ -1,21 +0,0 @@
1
- # global fixtures can go here
2
- import pytest
3
- import os
4
- from pathlib import Path
5
-
6
-
7
- def pytest_configure(config):
8
- config.addinivalue_line("markers", "integration: mark as integration test")
9
- config.addinivalue_line("markers", "slow: mark as slow test")
10
-
11
-
12
- @pytest.fixture(autouse=True)
13
- def ensure_output_directory():
14
- """Ensure output directory exists for tests"""
15
- output_dir = Path("output")
16
- output_dir.mkdir(exist_ok=True)
17
- yield
18
- # Optionally clean up after tests (commented out to preserve test outputs)
19
- # if output_dir.exists():
20
- # import shutil
21
- # shutil.rmtree(output_dir)
File without changes
@@ -1,128 +0,0 @@
1
- import pytest
2
-
3
- from Bio.Align import MultipleSeqAlignment
4
- from clipkit import clipkit
5
- from clipkit.files import FileFormat
6
- from clipkit.modes import TrimmingMode
7
- from clipkit.msa import MSA
8
-
9
-
10
- @pytest.mark.integration
11
- class TestApiInvocation(object):
12
- def test_input_file(self):
13
- trim_run, stats = clipkit(
14
- input_file_path="tests/integration/samples/simple.fa",
15
- mode=TrimmingMode.gappy,
16
- gaps=0.3,
17
- sequence_type="nt",
18
- )
19
-
20
- assert stats.summary == {
21
- "alignment_length": 6,
22
- "output_length": 4,
23
- "trimmed_length": 2,
24
- "trimmed_percentage": 33.333,
25
- }
26
- assert isinstance(trim_run.version, str)
27
- assert isinstance(trim_run.trimmed, MultipleSeqAlignment)
28
-
29
- def test_raw_alignment(self):
30
- trim_run, stats = clipkit(
31
- raw_alignment=">1\nA-GTAT\n>2\nA-G-AT\n>3\nA-G-TA\n>4\nAGA-TA\n>5\nACa-T-\n",
32
- mode=TrimmingMode.smart_gap,
33
- gaps=None,
34
- sequence_type="nt",
35
- )
36
- assert stats.summary == {
37
- "alignment_length": 6,
38
- "output_length": 5,
39
- "trimmed_length": 1,
40
- "trimmed_percentage": 16.667,
41
- }
42
- assert isinstance(trim_run.version, str)
43
-
44
- def test_codon_setting(self):
45
- trim_run, stats = clipkit(
46
- raw_alignment=">1\nA-GTAT\n>2\nA-G-AT\n>3\nA-G-TA\n>4\nAGA-TA\n>5\nACa-T-\n",
47
- mode=TrimmingMode.smart_gap,
48
- gaps=None,
49
- codon=True,
50
- sequence_type="nt",
51
- )
52
- assert stats.summary == {
53
- "alignment_length": 6,
54
- "output_length": 3,
55
- "trimmed_length": 3,
56
- "trimmed_percentage": 50.0,
57
- }
58
- assert isinstance(trim_run.version, str)
59
-
60
- def test_threads_must_be_positive(self):
61
- with pytest.raises(ValueError, match="threads must be an integer >= 1"):
62
- clipkit(
63
- input_file_path="tests/integration/samples/simple.fa",
64
- mode=TrimmingMode.gappy,
65
- gaps=0.3,
66
- sequence_type="nt",
67
- threads=0,
68
- )
69
-
70
- def test_requires_exactly_one_input_source(self):
71
- with pytest.raises(
72
- ValueError,
73
- match="Provide exactly one of raw_alignment or input_file_path.",
74
- ):
75
- clipkit(
76
- raw_alignment=">1\nA\n>2\nA\n",
77
- input_file_path="tests/integration/samples/simple.fa",
78
- )
79
-
80
- with pytest.raises(
81
- ValueError,
82
- match="Provide exactly one of raw_alignment or input_file_path.",
83
- ):
84
- clipkit()
85
-
86
- def test_empty_raw_alignment_rejected(self):
87
- with pytest.raises(ValueError, match="raw_alignment cannot be empty."):
88
- clipkit(raw_alignment="")
89
-
90
- def test_empty_input_file_path_rejected(self):
91
- with pytest.raises(ValueError, match="input_file_path cannot be empty."):
92
- clipkit(input_file_path="")
93
-
94
- def test_invalid_sequence_type_rejected(self):
95
- with pytest.raises(ValueError, match="sequence_type must be one of"):
96
- clipkit(
97
- input_file_path="tests/integration/samples/simple.fa",
98
- sequence_type="protein",
99
- )
100
-
101
- def test_plot_trim_report_path_writes_html(self, tmp_path):
102
- report_path = tmp_path / "api_trim_report.html"
103
- trim_run, stats = clipkit(
104
- input_file_path="tests/integration/samples/simple.fa",
105
- mode=TrimmingMode.gappy,
106
- gaps=0.3,
107
- sequence_type="nt",
108
- plot_trim_report_path=str(report_path),
109
- )
110
- assert stats.summary["trimmed_length"] == 2
111
- assert isinstance(trim_run.trimmed, MultipleSeqAlignment)
112
- assert report_path.exists()
113
-
114
- def test_heterotachy_mode(self):
115
- trim_run, stats = clipkit(
116
- input_file_path="tests/integration/samples/simple.fa",
117
- mode=TrimmingMode.heterotachy,
118
- gaps=0.8,
119
- sequence_type="nt",
120
- )
121
-
122
- assert stats.summary == {
123
- "alignment_length": 6,
124
- "output_length": 4,
125
- "trimmed_length": 2,
126
- "trimmed_percentage": 33.333,
127
- }
128
- assert isinstance(trim_run.version, str)
@@ -1,39 +0,0 @@
1
- import pytest
2
- from pathlib import Path
3
-
4
- from clipkit.clipkit import execute
5
- from clipkit.modes import TrimmingMode
6
- from clipkit.settings import DEFAULT_NT_GAP_CHARS
7
-
8
- here = Path(__file__)
9
-
10
-
11
- @pytest.mark.integration
12
- class TestBlockGappyMode(object):
13
- def test_simple_alignment(self):
14
- input_file = f"{here.parent}/samples/simple.fa"
15
- output_file = "output/simple.fa_block_gappy"
16
- kwargs = dict(
17
- input_file=input_file,
18
- output_file=output_file,
19
- input_file_format="fasta",
20
- output_file_format="fasta",
21
- sequence_type=None,
22
- complement=False,
23
- codon=False,
24
- gaps=0.6,
25
- mode=TrimmingMode.block_gappy,
26
- use_log=False,
27
- gap_characters=DEFAULT_NT_GAP_CHARS,
28
- quiet=True,
29
- ends_only=False,
30
- )
31
- execute(**kwargs)
32
-
33
- with open(input_file, "r") as expected:
34
- expected_content = expected.read()
35
-
36
- with open(output_file, "r") as out_file:
37
- output_content = out_file.read()
38
-
39
- assert expected_content == output_content
@@ -1,45 +0,0 @@
1
- import pytest
2
- from pathlib import Path
3
-
4
- from clipkit.clipkit import execute
5
- from clipkit.files import FileFormat
6
- from clipkit.modes import TrimmingMode
7
- from clipkit.settings import DEFAULT_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
8
-
9
- here = Path(__file__)
10
-
11
-
12
- @pytest.mark.integration
13
- class TestC3Out(object):
14
- def test_simple_c3(self):
15
- """
16
- test codon
17
- usage: clipkit simple.fa c3
18
- """
19
- output_file = "output/simple.fa_c3"
20
-
21
- kwargs = dict(
22
- input_file=f"{here.parent}/samples/simple.fa",
23
- output_file=output_file,
24
- input_file_format="fasta",
25
- output_file_format="fasta",
26
- sequence_type=None,
27
- complement=False,
28
- codon=False,
29
- gaps=None,
30
- mode=TrimmingMode.c3,
31
- use_log=False,
32
- gap_characters=DEFAULT_NT_GAP_CHARS,
33
- quiet=True,
34
- ends_only=False,
35
- )
36
-
37
- execute(**kwargs)
38
-
39
- with open(f"{here.parent}/expected/simple.fa_c3", "r") as expected:
40
- expected_content = expected.read()
41
-
42
- with open(output_file, "r") as out_file:
43
- output_content = out_file.read()
44
-
45
- assert expected_content == output_content
@@ -1,76 +0,0 @@
1
- import pytest
2
- from pathlib import Path
3
-
4
- from clipkit.clipkit import execute
5
- from clipkit.files import FileFormat
6
- from clipkit.modes import TrimmingMode
7
- from clipkit.settings import DEFAULT_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
8
-
9
- here = Path(__file__)
10
-
11
-
12
- @pytest.mark.integration
13
- class TestCodonOut(object):
14
- def test_simple_codon(self):
15
- """
16
- test codon
17
- usage: clipkit simple.fa -co
18
- """
19
- output_file = "output/simple.fa_gappy_codon"
20
-
21
- kwargs = dict(
22
- input_file=f"{here.parent}/samples/simple.fa",
23
- output_file=output_file,
24
- input_file_format="fasta",
25
- output_file_format="fasta",
26
- sequence_type=None,
27
- complement=False,
28
- codon=True,
29
- gaps=0.8,
30
- mode=TrimmingMode.gappy,
31
- use_log=False,
32
- gap_characters=DEFAULT_NT_GAP_CHARS,
33
- quiet=True,
34
- ends_only=False,
35
- )
36
-
37
- execute(**kwargs)
38
-
39
- with open(f"{here.parent}/expected/simple.fa_gappy_codon", "r") as expected:
40
- expected_content = expected.read()
41
-
42
- with open(output_file, "r") as out_file:
43
- output_content = out_file.read()
44
-
45
- assert expected_content == output_content
46
-
47
- def test_simple_codon_all_trimmed(self):
48
- """
49
- test codon
50
- usage: clipkit simple.fa -co
51
- """
52
- output_file = "output/simple.fa_gappy_codon"
53
- kwargs = dict(
54
- input_file=f"{here.parent}/samples/simple.fa",
55
- output_file=output_file,
56
- input_file_format="fasta",
57
- output_file_format="fasta",
58
- sequence_type=None,
59
- complement=False,
60
- codon=True,
61
- gaps=0.1,
62
- mode=TrimmingMode.gappy,
63
- use_log=False,
64
- gap_characters=DEFAULT_NT_GAP_CHARS,
65
- quiet=True,
66
- ends_only=False,
67
- )
68
-
69
- execute(**kwargs)
70
-
71
- expected_content = ">1\n>2\n>3\n>4\n>5\n"
72
-
73
- with open(output_file, "r") as out_file:
74
- output_content = out_file.read()
75
-
76
- assert expected_content == output_content